blob: 79efe8e114c8c693ab0b60e7b6bebe5edb52b3ee [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
William M. Brack015ccb22005-02-13 08:18:52 +0000196/*
197 We need some "remote" addresses, but want to avoid getting into
198 name resolution delays, so we use these
199*/
200#define REMOTE1GOOD "http://localhost/"
201#define REMOTE1BAD "http://missing. example.org/"
202#define REMOTE2GOOD "ftp://localhost/foo"
203
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000204#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000205
Daniel Veillard3d97e662004-11-04 10:49:00 +0000206static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000207 return(NULL);
208}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000209static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000210}
211
Daniel Veillardce244ad2004-11-05 10:03:46 +0000212#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000213#define gen_nb_const_void_ptr 2
214
215static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
216 if (no == 0) return((const void *) "immutable string");
217 return(NULL);
218}
219static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000221#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000222
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223#define gen_nb_userdata 3
224
Daniel Veillard3d97e662004-11-04 10:49:00 +0000225static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000226 if (no == 0) return((void *) &call_tests);
227 if (no == 1) return((void *) -1);
228 return(NULL);
229}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000230static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000231}
232
233
Daniel Veillardd93f6252004-11-02 15:53:51 +0000234#define gen_nb_int 4
235
Daniel Veillard3d97e662004-11-04 10:49:00 +0000236static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
237 if (no == 0) return(0);
238 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000239 if (no == 2) return(-1);
240 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000241 return(-1);
242}
243
244static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
245}
246
Daniel Veillard6128c012004-11-08 17:16:15 +0000247#define gen_nb_parseroptions 5
248
249static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
250 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
251 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
252 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
253 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
254 return(XML_PARSE_SAX1);
255}
256
257static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
258}
259
Daniel Veillardce244ad2004-11-05 10:03:46 +0000260#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000261#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000262
263static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
264 if (no == 0) return(0);
265 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000266 if (no == 2) return(-1);
267 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000268 return(-1);
269}
270
271static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
272}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000273#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000274
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000275#define gen_nb_xmlChar 4
276
277static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
278 if (no == 0) return('a');
279 if (no == 1) return(' ');
280 if (no == 2) return('ø');
281 return(0);
282}
283
284static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
285}
286
Daniel Veillard3d97e662004-11-04 10:49:00 +0000287#define gen_nb_unsigned_int 3
288
289static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000290 if (no == 0) return(0);
291 if (no == 1) return(1);
292 if (no == 2) return(122);
293 return(-1);
294}
295
Daniel Veillard3d97e662004-11-04 10:49:00 +0000296static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000297}
298
Daniel Veillard3d95c732004-11-06 22:25:14 +0000299#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000300
301static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
302 if (no == 0) return(0);
303 if (no == 1) return(1);
304 if (no == 2) return(122);
305 return(-1);
306}
307
308static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
309}
310
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311#define gen_nb_double 4
312
313static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
314 if (no == 0) return(0);
315 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000317 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000318#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000319 return(-1);
320}
321
322static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
323}
324
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000325#define gen_nb_unsigned_long_ptr 2
326
327static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
328 if (no == 0) return(&longtab[nr]);
329 return(NULL);
330}
331
332static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
333}
334
335#define gen_nb_int_ptr 2
336
337static int *gen_int_ptr(int no, int nr) {
338 if (no == 0) return(&inttab[nr]);
339 return(NULL);
340}
341
342static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
343}
344
Daniel Veillardd93f6252004-11-02 15:53:51 +0000345#define gen_nb_const_char_ptr 4
346
Daniel Veillardce682bc2004-11-05 17:22:25 +0000347static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
348 if (no == 0) return((char *) "foo");
349 if (no == 1) return((char *) "<foo/>");
350 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000351 return(NULL);
352}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000353static 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 +0000354}
355
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000356#define gen_nb_xmlChar_ptr 2
357
Daniel Veillard3d97e662004-11-04 10:49:00 +0000358static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000359 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000360 return(NULL);
361}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000362static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000363}
364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000365#define gen_nb_FILE_ptr 2
366
367static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
368 if (no == 0) return(fopen("test.out", "a+"));
369 return(NULL);
370}
371static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillarda82b1822004-11-08 16:24:57 +0000375#define gen_nb_debug_FILE_ptr 2
376static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
377 return(fopen("test.out", "a+"));
378}
379static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
380 if (val != NULL) fclose(val);
381}
382
Daniel Veillardd93f6252004-11-02 15:53:51 +0000383#define gen_nb_const_xmlChar_ptr 5
384
Daniel Veillardce682bc2004-11-05 17:22:25 +0000385static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
386 if (no == 0) return((xmlChar *) "foo");
387 if (no == 1) return((xmlChar *) "<foo/>");
388 if (no == 2) return((xmlChar *) "nøne");
389 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 return(NULL);
391}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000392static 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 +0000393}
394
395#define gen_nb_filepath 8
396
Daniel Veillard3d97e662004-11-04 10:49:00 +0000397static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000398 if (no == 0) return("missing.xml");
399 if (no == 1) return("<foo/>");
400 if (no == 2) return("test/ent2");
401 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000402 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
William M. Brack015ccb22005-02-13 08:18:52 +0000403 if (no == 5) return(REMOTE1GOOD);
404 if (no == 6) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000405 return(NULL);
406}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000407static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000408}
409
Daniel Veillard27f20102004-11-05 11:50:11 +0000410#define gen_nb_eaten_name 2
411
412static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000413 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000414 return(NULL);
415}
416static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
417}
418
Daniel Veillardd93f6252004-11-02 15:53:51 +0000419#define gen_nb_fileoutput 6
420
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422 if (no == 0) return("/missing.xml");
423 if (no == 1) return("<foo/>");
William M. Brack015ccb22005-02-13 08:18:52 +0000424 if (no == 2) return(REMOTE2GOOD);
425 if (no == 3) return(REMOTE1GOOD);
426 if (no == 4) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000427 return(NULL);
428}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000429static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000430}
431
Daniel Veillarda521d282004-11-09 14:59:59 +0000432#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000433static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000434 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000435 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000436 return(NULL);
437}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000438static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000439 if (val != NULL)
440 xmlFreeParserCtxt(val);
441}
442
Daniel Veillard34099b42004-11-04 17:34:35 +0000443#define gen_nb_xmlSAXHandlerPtr 2
444static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000445#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000446 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000448 return(NULL);
449}
450static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
451}
452
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000453#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000454static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000455#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000456 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000457#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000458 return(NULL);
459}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000460static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000461#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000462 if (val != NULL)
463 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000464#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000465}
466
Daniel Veillard34099b42004-11-04 17:34:35 +0000467#define gen_nb_xmlParserInputBufferPtr 8
468
469static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
470 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
471 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
472 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
473 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
474 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
William M. Brack015ccb22005-02-13 08:18:52 +0000475 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE));
476 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE));
Daniel Veillard34099b42004-11-04 17:34:35 +0000477 return(NULL);
478}
479static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
480 xmlFreeParserInputBuffer(val);
481}
482
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000484static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000485 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
486 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
487 return(NULL);
488}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000489static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000490 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000491 xmlFreeDoc(val);
492}
493
Daniel Veillardce244ad2004-11-05 10:03:46 +0000494#define gen_nb_xmlAttrPtr 2
495static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
496 if (no == 0) return(get_api_attr());
497 return(NULL);
498}
499static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
500 if (no == 0) free_api_doc();
501}
502
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000503#define gen_nb_xmlDictPtr 2
504static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
505 if (no == 0) return(xmlDictCreate());
506 return(NULL);
507}
508static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
509 if (val != NULL)
510 xmlDictFree(val);
511}
512
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000514static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000516 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000517 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000518/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000519}
Daniel Veillard27f20102004-11-05 11:50:11 +0000520static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard7e21fd12005-07-03 21:44:07 +0000521 if (no == 1) {
Daniel Veillard7e21fd12005-07-03 21:44:07 +0000522 free_api_doc();
523 } else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000524 xmlUnlinkNode(val);
525 xmlFreeNode(val);
526 }
527}
528
Daniel Veillard27f20102004-11-05 11:50:11 +0000529#define gen_nb_xmlDtdPtr 3
530static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000531 if (no == 0)
532 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000533 if (no == 1) return(get_api_dtd());
534 return(NULL);
535}
536static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
537 if (no == 1) free_api_doc();
538 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000539 xmlUnlinkNode((xmlNodePtr) val);
540 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000541 }
542}
543
544#define gen_nb_xmlNsPtr 2
545static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
546 if (no == 0) return(get_api_ns());
547 return(NULL);
548}
549static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
550 if (no == 0) free_api_doc();
551}
552
Daniel Veillardd93f6252004-11-02 15:53:51 +0000553#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000554static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000555 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
556 if (no == 0) return(xmlNewText(BAD_CAST "text"));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000560}
561
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000564static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000565 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
566 return(NULL);
567}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000568static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000569 if (val != NULL) xmlFreeTextWriter(val);
570}
Daniel Veillardc8311492004-11-08 16:51:13 +0000571#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000572
Daniel Veillardc8311492004-11-08 16:51:13 +0000573#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000574#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000575static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
577 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
578 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
579 return(NULL);
580}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000581static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000582 if (val != NULL) xmlFreeTextReader(val);
583}
Daniel Veillardc8311492004-11-08 16:51:13 +0000584#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000585
Daniel Veillard34099b42004-11-04 17:34:35 +0000586#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000587static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000588 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000589 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000590 return(NULL);
591}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000592static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000593 if (val != NULL) {
594 xmlBufferFree(val);
595 }
596}
597
598#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000599static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000600 if (no == 0) return(xmlListCreate(NULL, NULL));
601 return(NULL);
602}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000603static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000604 if (val != NULL) {
605 xmlListDelete(val);
606 }
607}
608
609#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000610static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000611 if (no == 0) return(xmlHashCreate(10));
612 return(NULL);
613}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000614static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000615 if (val != NULL) {
616 xmlHashFree(val, NULL);
617 }
618}
619
620#include <libxml/xpathInternals.h>
621
Daniel Veillardc8311492004-11-08 16:51:13 +0000622#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000624static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000625 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
626 if (no == 1) return(xmlXPathNewFloat(1.1));
627 if (no == 2) return(xmlXPathNewBoolean(1));
628 if (no == 3) return(xmlXPathNewNodeSet(NULL));
629 return(NULL);
630}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000631static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000632 if (val != NULL) {
633 xmlXPathFreeObject(val);
634 }
635}
Daniel Veillardc8311492004-11-08 16:51:13 +0000636#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000637
Daniel Veillardc8311492004-11-08 16:51:13 +0000638#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000639#define gen_nb_xmlOutputBufferPtr 2
640static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
641 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
642 return(NULL);
643}
644static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
645 if (val != NULL) {
646 xmlOutputBufferClose(val);
647 }
648}
Daniel Veillardc8311492004-11-08 16:51:13 +0000649#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000650
Daniel Veillardc8311492004-11-08 16:51:13 +0000651#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000652#define gen_nb_xmlNanoFTPCtxtPtr 4
653static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
William M. Brack015ccb22005-02-13 08:18:52 +0000654 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
655 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
Daniel Veillard27f20102004-11-05 11:50:11 +0000656 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
657 return(NULL);
658}
659static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
660 if (val != NULL) {
661 xmlNanoFTPFreeCtxt(val);
662 }
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillardc8311492004-11-08 16:51:13 +0000666#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000667#define gen_nb_xmlNanoHTTPCtxtPtr 1
William M. Brack015ccb22005-02-13 08:18:52 +0000668static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
669 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
670 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
671 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
Daniel Veillard27f20102004-11-05 11:50:11 +0000672 return(NULL);
673}
William M. Brack015ccb22005-02-13 08:18:52 +0000674static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
675 if (val != NULL) {
676 xmlNanoHTTPClose(val);
677 }
Daniel Veillard27f20102004-11-05 11:50:11 +0000678}
Daniel Veillardc8311492004-11-08 16:51:13 +0000679#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000680
Daniel Veillard3d97e662004-11-04 10:49:00 +0000681#define gen_nb_xmlCharEncoding 4
682static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
683 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
684 if (no == 1) return(XML_CHAR_ENCODING_NONE);
William M. Brack015ccb22005-02-13 08:18:52 +0000685 if (no == 2) return(XML_CHAR_ENCODING_8859_1);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000686 return(XML_CHAR_ENCODING_ERROR);
687}
688static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
689}
690
Daniel Veillard42595322004-11-08 10:52:06 +0000691#define gen_nb_xmlHashDeallocator 2
692static void
693test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
694}
695
696static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
697 if (no == 0) return(test_xmlHashDeallocator);
698 return(NULL);
699}
700static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
701}
702
Daniel Veillardd93f6252004-11-02 15:53:51 +0000703
704static void desret_int(int val ATTRIBUTE_UNUSED) {
705}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000706static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
707}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000708static void desret_long(long val ATTRIBUTE_UNUSED) {
709}
William M. Brack094dd862004-11-14 14:28:34 +0000710static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
711}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000712static void desret_double(double val ATTRIBUTE_UNUSED) {
713}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000714static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
715}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000717static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
718}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000719#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000720static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
721}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000722static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
723}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000724static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
725}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000726static void desret_xmlChar_ptr(xmlChar *val) {
727 if (val != NULL)
728 xmlFree(val);
729}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000730static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000731 if (val != api_doc)
732 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000733}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000734static void desret_xmlDictPtr(xmlDictPtr val) {
735 xmlDictFree(val);
736}
Daniel Veillardc8311492004-11-08 16:51:13 +0000737#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000738static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
739 xmlOutputBufferClose(val);
740}
Daniel Veillardc8311492004-11-08 16:51:13 +0000741#endif
742#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000743static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
744 xmlFreeTextReader(val);
745}
Daniel Veillardc8311492004-11-08 16:51:13 +0000746#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000747static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000748 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
749 xmlUnlinkNode(val);
750 xmlFreeNode(val);
751 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000752}
Daniel Veillard57b25162004-11-06 14:50:18 +0000753static void desret_xmlAttrPtr(xmlAttrPtr val) {
754 if (val != NULL) {
755 xmlUnlinkNode((xmlNodePtr) val);
756 xmlFreeNode((xmlNodePtr) val);
757 }
758}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000759static void desret_xmlEntityPtr(xmlEntityPtr val) {
760 if (val != NULL) {
761 xmlUnlinkNode((xmlNodePtr) val);
762 xmlFreeNode((xmlNodePtr) val);
763 }
764}
Daniel Veillard42595322004-11-08 10:52:06 +0000765static void desret_xmlElementPtr(xmlElementPtr val) {
766 if (val != NULL) {
767 xmlUnlinkNode((xmlNodePtr) val);
768 }
769}
770static void desret_xmlAttributePtr(xmlAttributePtr val) {
771 if (val != NULL) {
772 xmlUnlinkNode((xmlNodePtr) val);
773 }
774}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000775static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
776}
Daniel Veillard34099b42004-11-04 17:34:35 +0000777static void desret_xmlDtdPtr(xmlDtdPtr val) {
778 desret_xmlNodePtr((xmlNodePtr)val);
779}
Daniel Veillardc8311492004-11-08 16:51:13 +0000780#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000781static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000782 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000783}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000784static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
785 xmlXPathFreeNodeSet(val);
786}
Daniel Veillardc8311492004-11-08 16:51:13 +0000787#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000788static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
789 xmlFreeParserCtxt(val);
790}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000791static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
792 xmlFreeParserInputBuffer(val);
793}
Daniel Veillard42595322004-11-08 10:52:06 +0000794static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
795 xmlFreeInputStream(val);
796}
Daniel Veillardc8311492004-11-08 16:51:13 +0000797#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000798static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
799 xmlFreeTextWriter(val);
800}
Daniel Veillardc8311492004-11-08 16:51:13 +0000801#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000802static void desret_xmlBufferPtr(xmlBufferPtr val) {
803 xmlBufferFree(val);
804}
Daniel Veillardc8311492004-11-08 16:51:13 +0000805#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000806static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
807 xmlSchemaFreeParserCtxt(val);
808}
809static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
810}
811static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
812 xmlRelaxNGFreeParserCtxt(val);
813}
Daniel Veillardc8311492004-11-08 16:51:13 +0000814#endif
815#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000816static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000817}
Daniel Veillard8aa7afa2005-05-10 09:50:01 +0000818#endif
819#ifdef LIBXML_HTTP_ENABLED
William M. Brack015ccb22005-02-13 08:18:52 +0000820static void desret_xmlNanoHTTPCtxtPtr(void *val) {
821 xmlNanoHTTPClose(val);
822}
Daniel Veillardc8311492004-11-08 16:51:13 +0000823#endif
William M. Brack015ccb22005-02-13 08:18:52 +0000824#ifdef LIBXML_FTP_ENABLED
825static void desret_xmlNanoFTPCtxtPtr(void *val) {
826 xmlNanoFTPClose(val);
827}
828#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000829/* cut and pasted from autogenerated to avoid troubles */
830#define gen_nb_const_xmlChar_ptr_ptr 1
831static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832 return(NULL);
833}
834static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
835}
836
837#define gen_nb_unsigned_char_ptr 1
838static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 return(NULL);
840}
841static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
842}
843
844#define gen_nb_const_unsigned_char_ptr 1
845static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
846 return(NULL);
847}
848static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
849}
850
851#ifdef LIBXML_HTML_ENABLED
852#define gen_nb_const_htmlNodePtr 1
853static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
854 return(NULL);
855}
856static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
857}
858#endif
859
860#ifdef LIBXML_HTML_ENABLED
861#define gen_nb_htmlDocPtr 3
862static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
863 if (no == 0) return(htmlNewDoc(NULL, NULL));
864 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
865 return(NULL);
866}
867static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
868 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
869 xmlFreeDoc(val);
870}
871static void desret_htmlDocPtr(htmlDocPtr val) {
872 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
873 xmlFreeDoc(val);
874}
875#define gen_nb_htmlParserCtxtPtr 3
876static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
877 if (no == 0) return(xmlNewParserCtxt());
878 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
879 return(NULL);
880}
881static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
882 if (val != NULL)
883 htmlFreeParserCtxt(val);
884}
885static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
886 if (val != NULL)
887 htmlFreeParserCtxt(val);
888}
889#endif
890
891#ifdef LIBXML_XPATH_ENABLED
892#define gen_nb_xmlNodeSetPtr 1
893static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
894 return(NULL);
895}
896static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
897}
898#endif
899
900#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000901#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000902#define gen_nb_xmlShellCtxtPtr 1
903static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
904 return(NULL);
905}
906static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
907}
908#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000909#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000910
911#ifdef LIBXML_PATTERN_ENABLED
912#define gen_nb_xmlPatternPtr 1
913static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914 return(NULL);
915}
916static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
917}
918#endif
919
William M. Brack094dd862004-11-14 14:28:34 +0000920#define gen_nb_xmlElementContentPtr 1
921static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
922 return(NULL);
923}
924static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
925 if (val != NULL)
926 xmlFreeElementContent(val);
927}
928static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
929 if (val != NULL)
930 xmlFreeElementContent(val);
931}
932
933#define gen_nb_xmlParserNodeInfoSeqPtr 1
934static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
935 return(NULL);
936}
937static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
938}
939
940static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
941}
942
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000943/************************************************************************
944 * *
945 * WARNING: end of the manually maintained part of the test code *
946 * do not remove or alter the CUT HERE line *
947 * *
948 ************************************************************************/
949
Daniel Veillard34099b42004-11-04 17:34:35 +0000950/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000951#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000952static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
953}
954
Daniel Veillarda521d282004-11-09 14:59:59 +0000955#endif
956
Daniel Veillard57b25162004-11-06 14:50:18 +0000957#define gen_nb_xmlAttributeDefault 4
958static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_ATTRIBUTE_FIXED);
960 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
961 if (no == 3) return(XML_ATTRIBUTE_NONE);
962 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
963 return(0);
964}
William M. Brack094dd862004-11-14 14:28:34 +0000965
Daniel Veillard57b25162004-11-06 14:50:18 +0000966static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
967}
Daniel Veillard57b25162004-11-06 14:50:18 +0000968
969#define gen_nb_xmlAttributeType 4
970static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
971 if (no == 1) return(XML_ATTRIBUTE_CDATA);
972 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
973 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
974 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
975 return(0);
976}
William M. Brack094dd862004-11-14 14:28:34 +0000977
Daniel Veillard57b25162004-11-06 14:50:18 +0000978static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
979}
Daniel Veillard57b25162004-11-06 14:50:18 +0000980
981#define gen_nb_xmlBufferAllocationScheme 3
982static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
983 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
984 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
985 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
986 return(0);
987}
William M. Brack094dd862004-11-14 14:28:34 +0000988
Daniel Veillard57b25162004-11-06 14:50:18 +0000989static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
990}
William M. Brack094dd862004-11-14 14:28:34 +0000991
Daniel Veillard57b25162004-11-06 14:50:18 +0000992static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
993}
994
Daniel Veillarda521d282004-11-09 14:59:59 +0000995#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000996#define gen_nb_xmlCatalogAllow 4
997static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
998 if (no == 1) return(XML_CATA_ALLOW_ALL);
999 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
1000 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1001 if (no == 4) return(XML_CATA_ALLOW_NONE);
1002 return(0);
1003}
William M. Brack094dd862004-11-14 14:28:34 +00001004
Daniel Veillard57b25162004-11-06 14:50:18 +00001005static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1006}
William M. Brack094dd862004-11-14 14:28:34 +00001007
Daniel Veillard57b25162004-11-06 14:50:18 +00001008static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1009}
1010
Daniel Veillarda521d282004-11-09 14:59:59 +00001011#endif
1012
1013#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001014#define gen_nb_xmlCatalogPrefer 3
1015static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1016 if (no == 1) return(XML_CATA_PREFER_NONE);
1017 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1018 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1019 return(0);
1020}
William M. Brack094dd862004-11-14 14:28:34 +00001021
Daniel Veillard57b25162004-11-06 14:50:18 +00001022static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1023}
William M. Brack094dd862004-11-14 14:28:34 +00001024
Daniel Veillard57b25162004-11-06 14:50:18 +00001025static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1026}
1027
Daniel Veillarda521d282004-11-09 14:59:59 +00001028#endif
1029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030#define gen_nb_xmlElementContentType 4
1031static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1032 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1033 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1034 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1035 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1036 return(0);
1037}
Daniel Veillard57b25162004-11-06 14:50:18 +00001038
William M. Brack094dd862004-11-14 14:28:34 +00001039static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001040}
1041
1042#define gen_nb_xmlElementTypeVal 4
1043static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1044 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1045 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1046 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1047 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1048 return(0);
1049}
William M. Brack094dd862004-11-14 14:28:34 +00001050
Daniel Veillard57b25162004-11-06 14:50:18 +00001051static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1052}
Daniel Veillard57b25162004-11-06 14:50:18 +00001053
Daniel Veillard57b25162004-11-06 14:50:18 +00001054static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1055}
1056
William M. Brackea152c02005-06-09 18:12:28 +00001057#ifdef LIBXML_PATTERN_ENABLED
1058#define gen_nb_xmlPatternFlags 4
1059static xmlPatternFlags gen_xmlPatternFlags(int no, int nr ATTRIBUTE_UNUSED) {
1060 if (no == 1) return(XML_PATTERN_DEFAULT);
1061 if (no == 2) return(XML_PATTERN_XPATH);
1062 if (no == 3) return(XML_PATTERN_XSFIELD);
1063 if (no == 4) return(XML_PATTERN_XSSEL);
1064 return(0);
1065}
1066
1067static void des_xmlPatternFlags(int no ATTRIBUTE_UNUSED, xmlPatternFlags val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1068}
1069
1070#endif
1071
Daniel Veillarda521d282004-11-09 14:59:59 +00001072#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001073#define gen_nb_xmlSchemaValType 4
1074static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1075 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1076 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1077 if (no == 3) return(XML_SCHEMAS_ANYURI);
1078 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1079 return(0);
1080}
William M. Brack094dd862004-11-14 14:28:34 +00001081
Daniel Veillard57b25162004-11-06 14:50:18 +00001082static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1083}
Daniel Veillard57b25162004-11-06 14:50:18 +00001084
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001085static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1086}
1087
Daniel Veillarda521d282004-11-09 14:59:59 +00001088#endif
1089
Daniel Veillardb5839c32005-02-19 18:27:14 +00001090#ifdef LIBXML_SCHEMAS_ENABLED
1091#define gen_nb_xmlSchemaWhitespaceValueType 4
1092static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1093 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1094 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1095 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1096 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1097 return(0);
1098}
1099
1100static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1101}
1102
1103#endif
1104
Daniel Veillard34099b42004-11-04 17:34:35 +00001105#include <libxml/HTMLparser.h>
1106#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001107#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001108#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001109#include <libxml/catalog.h>
1110#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001111#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001112#include <libxml/dict.h>
1113#include <libxml/encoding.h>
1114#include <libxml/entities.h>
1115#include <libxml/hash.h>
1116#include <libxml/list.h>
1117#include <libxml/nanoftp.h>
1118#include <libxml/nanohttp.h>
1119#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001120#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001121#include <libxml/pattern.h>
1122#include <libxml/relaxng.h>
1123#include <libxml/schemasInternals.h>
1124#include <libxml/tree.h>
1125#include <libxml/uri.h>
1126#include <libxml/valid.h>
1127#include <libxml/xinclude.h>
1128#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001129#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001130#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001131#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001132#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001133#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001134#include <libxml/xmlsave.h>
1135#include <libxml/xmlschemas.h>
1136#include <libxml/xmlschemastypes.h>
1137#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001138#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001139#include <libxml/xmlwriter.h>
1140#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001141#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001142#include <libxml/xpointer.h>
1143static int test_HTMLparser(void);
1144static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001145static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001146static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001147static int test_catalog(void);
1148static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001149static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001150static int test_dict(void);
1151static int test_encoding(void);
1152static int test_entities(void);
1153static int test_hash(void);
1154static int test_list(void);
1155static int test_nanoftp(void);
1156static int test_nanohttp(void);
1157static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001158static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001159static int test_pattern(void);
1160static int test_relaxng(void);
1161static int test_schemasInternals(void);
1162static int test_tree(void);
1163static int test_uri(void);
1164static int test_valid(void);
1165static int test_xinclude(void);
1166static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001167static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001168static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001169static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001170static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001171static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001172static int test_xmlsave(void);
1173static int test_xmlschemas(void);
1174static int test_xmlschemastypes(void);
1175static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001176static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001177static int test_xmlwriter(void);
1178static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001179static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001180static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001181
1182/**
1183 * testlibxml2:
1184 *
1185 * Main entry point of the tester for the full libxml2 module,
1186 * it calls all the tester entry point for each module.
1187 *
1188 * Returns the number of error found
1189 */
1190static int
1191testlibxml2(void)
1192{
Daniel Veillard42595322004-11-08 10:52:06 +00001193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001194
Daniel Veillard42595322004-11-08 10:52:06 +00001195 test_ret += test_HTMLparser();
1196 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001197 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001198 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001199 test_ret += test_catalog();
1200 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001201 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001202 test_ret += test_dict();
1203 test_ret += test_encoding();
1204 test_ret += test_entities();
1205 test_ret += test_hash();
1206 test_ret += test_list();
1207 test_ret += test_nanoftp();
1208 test_ret += test_nanohttp();
1209 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001210 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001211 test_ret += test_pattern();
1212 test_ret += test_relaxng();
1213 test_ret += test_schemasInternals();
1214 test_ret += test_tree();
1215 test_ret += test_uri();
1216 test_ret += test_valid();
1217 test_ret += test_xinclude();
1218 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001219 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001220 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001221 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001222 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001223 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001224 test_ret += test_xmlsave();
1225 test_ret += test_xmlschemas();
1226 test_ret += test_xmlschemastypes();
1227 test_ret += test_xmlstring();
1228 test_ret += test_xmlunicode();
1229 test_ret += test_xmlwriter();
1230 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001231 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001232 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001233
Daniel Veillard3d97e662004-11-04 10:49:00 +00001234 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001235 function_tests, call_tests, test_ret);
1236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001237}
1238
1239
1240static int
1241test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001243
William M. Brack21e4ef22005-01-02 09:53:13 +00001244#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001245 int mem_base;
1246 int ret_val;
1247 unsigned char * out; /* a pointer to an array of bytes to store the result */
1248 int n_out;
1249 int * outlen; /* the length of @out */
1250 int n_outlen;
1251 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1252 int n_in;
1253 int * inlen; /* the length of @in */
1254 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001255
Daniel Veillardce682bc2004-11-05 17:22:25 +00001256 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1257 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1258 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1259 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1260 mem_base = xmlMemBlocks();
1261 out = gen_unsigned_char_ptr(n_out, 0);
1262 outlen = gen_int_ptr(n_outlen, 1);
1263 in = gen_const_unsigned_char_ptr(n_in, 2);
1264 inlen = gen_int_ptr(n_inlen, 3);
1265
William M. Brackf13f77f2004-11-12 16:03:48 +00001266 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001267 desret_int(ret_val);
1268 call_tests++;
1269 des_unsigned_char_ptr(n_out, out, 0);
1270 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001271 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001272 des_int_ptr(n_inlen, inlen, 3);
1273 xmlResetLastError();
1274 if (mem_base != xmlMemBlocks()) {
1275 printf("Leak of %d blocks found in UTF8ToHtml",
1276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001277 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001278 printf(" %d", n_out);
1279 printf(" %d", n_outlen);
1280 printf(" %d", n_in);
1281 printf(" %d", n_inlen);
1282 printf("\n");
1283 }
1284 }
1285 }
1286 }
1287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001288 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001289#endif
1290
Daniel Veillard42595322004-11-08 10:52:06 +00001291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001292}
1293
Daniel Veillarda521d282004-11-09 14:59:59 +00001294#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001295
Daniel Veillardce682bc2004-11-05 17:22:25 +00001296#define gen_nb_const_htmlElemDesc_ptr 1
1297static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1298 return(NULL);
1299}
1300static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1301}
Daniel Veillarda521d282004-11-09 14:59:59 +00001302#endif
1303
Daniel Veillardce682bc2004-11-05 17:22:25 +00001304
Daniel Veillardd93f6252004-11-02 15:53:51 +00001305static int
1306test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001308
William M. Brack21e4ef22005-01-02 09:53:13 +00001309#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001310 int mem_base;
1311 htmlStatus ret_val;
1312 htmlElemDesc * elt; /* HTML element */
1313 int n_elt;
1314 xmlChar * attr; /* HTML attribute */
1315 int n_attr;
1316 int legacy; /* whether to allow deprecated attributes */
1317 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001318
Daniel Veillard57b25162004-11-06 14:50:18 +00001319 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1320 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1321 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1322 mem_base = xmlMemBlocks();
1323 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1324 attr = gen_const_xmlChar_ptr(n_attr, 1);
1325 legacy = gen_int(n_legacy, 2);
1326
William M. Brackf13f77f2004-11-12 16:03:48 +00001327 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001328 desret_htmlStatus(ret_val);
1329 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001330 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1331 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001332 des_int(n_legacy, legacy, 2);
1333 xmlResetLastError();
1334 if (mem_base != xmlMemBlocks()) {
1335 printf("Leak of %d blocks found in htmlAttrAllowed",
1336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001337 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001338 printf(" %d", n_elt);
1339 printf(" %d", n_attr);
1340 printf(" %d", n_legacy);
1341 printf("\n");
1342 }
1343 }
1344 }
1345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001346 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001347#endif
1348
Daniel Veillard42595322004-11-08 10:52:06 +00001349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001350}
1351
Daniel Veillarda521d282004-11-09 14:59:59 +00001352#ifdef LIBXML_HTML_ENABLED
1353
1354#define gen_nb_htmlNodePtr 1
1355static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1356 return(NULL);
1357}
1358static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1359}
1360#endif
1361
Daniel Veillardd93f6252004-11-02 15:53:51 +00001362
1363static int
1364test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001366
William M. Brack21e4ef22005-01-02 09:53:13 +00001367#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001368 int mem_base;
1369 int ret_val;
1370 htmlDocPtr doc; /* the HTML document */
1371 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001372 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001373 int n_name;
1374 htmlNodePtr elem; /* the HTML element */
1375 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001376
Daniel Veillarda521d282004-11-09 14:59:59 +00001377 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001378 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001379 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001380 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001381 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001382 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001383 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001384
William M. Brackf13f77f2004-11-12 16:03:48 +00001385 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001386 desret_int(ret_val);
1387 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001388 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001389 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001390 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001391 xmlResetLastError();
1392 if (mem_base != xmlMemBlocks()) {
1393 printf("Leak of %d blocks found in htmlAutoCloseTag",
1394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001396 printf(" %d", n_doc);
1397 printf(" %d", n_name);
1398 printf(" %d", n_elem);
1399 printf("\n");
1400 }
1401 }
1402 }
1403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001404 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001405#endif
1406
Daniel Veillard42595322004-11-08 10:52:06 +00001407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001408}
1409
1410
1411static int
1412test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001414
William M. Brack21e4ef22005-01-02 09:53:13 +00001415#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001416 int mem_base;
1417 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001418 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001419 int n_buffer;
1420 int size; /* the size of the array */
1421 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001422
Daniel Veillard34099b42004-11-04 17:34:35 +00001423 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1424 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1425 mem_base = xmlMemBlocks();
1426 buffer = gen_const_char_ptr(n_buffer, 0);
1427 size = gen_int(n_size, 1);
1428
William M. Brackf13f77f2004-11-12 16:03:48 +00001429 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001430 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001431 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001432 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001433 des_int(n_size, size, 1);
1434 xmlResetLastError();
1435 if (mem_base != xmlMemBlocks()) {
1436 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001438 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001439 printf(" %d", n_buffer);
1440 printf(" %d", n_size);
1441 printf("\n");
1442 }
1443 }
1444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001445 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001446#endif
1447
Daniel Veillard42595322004-11-08 10:52:06 +00001448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001449}
1450
Daniel Veillarda521d282004-11-09 14:59:59 +00001451#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001452
Daniel Veillardce682bc2004-11-05 17:22:25 +00001453#define gen_nb_htmlSAXHandlerPtr 1
1454static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1455 return(NULL);
1456}
1457static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1458}
Daniel Veillarda521d282004-11-09 14:59:59 +00001459#endif
1460
Daniel Veillardce682bc2004-11-05 17:22:25 +00001461
Daniel Veillardd93f6252004-11-02 15:53:51 +00001462static int
1463test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001465
William M. Brack21e4ef22005-01-02 09:53:13 +00001466#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001467 int mem_base;
1468 htmlParserCtxtPtr ret_val;
1469 htmlSAXHandlerPtr sax; /* a SAX handler */
1470 int n_sax;
1471 void * user_data; /* The user data returned on SAX callbacks */
1472 int n_user_data;
1473 char * chunk; /* a pointer to an array of chars */
1474 int n_chunk;
1475 int size; /* number of chars in the array */
1476 int n_size;
1477 const char * filename; /* an optional file name or URI */
1478 int n_filename;
1479 xmlCharEncoding enc; /* an optional encoding */
1480 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001481
Daniel Veillardce682bc2004-11-05 17:22:25 +00001482 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1483 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1484 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1485 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001486 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001487 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1488 mem_base = xmlMemBlocks();
1489 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1490 user_data = gen_userdata(n_user_data, 1);
1491 chunk = gen_const_char_ptr(n_chunk, 2);
1492 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001493 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001494 enc = gen_xmlCharEncoding(n_enc, 5);
1495
William M. Brackf13f77f2004-11-12 16:03:48 +00001496 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001497 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001498 call_tests++;
1499 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1500 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001501 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001502 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001503 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504 des_xmlCharEncoding(n_enc, enc, 5);
1505 xmlResetLastError();
1506 if (mem_base != xmlMemBlocks()) {
1507 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001509 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001510 printf(" %d", n_sax);
1511 printf(" %d", n_user_data);
1512 printf(" %d", n_chunk);
1513 printf(" %d", n_size);
1514 printf(" %d", n_filename);
1515 printf(" %d", n_enc);
1516 printf("\n");
1517 }
1518 }
1519 }
1520 }
1521 }
1522 }
1523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001524 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001525#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001526
Daniel Veillard42595322004-11-08 10:52:06 +00001527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001528}
1529
1530
1531static int
1532test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001534
William M. Brack21e4ef22005-01-02 09:53:13 +00001535#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001536 int mem_base;
1537 htmlDocPtr ret_val;
1538 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1539 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001540 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001541 int n_cur;
1542 const char * URL; /* the base URL to use for the document */
1543 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001544 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001545 int n_encoding;
1546 int options; /* a combination of htmlParserOption(s) */
1547 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001548
Daniel Veillarda521d282004-11-09 14:59:59 +00001549 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001550 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1551 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1552 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1553 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1554 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001555 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001556 cur = gen_const_xmlChar_ptr(n_cur, 1);
1557 URL = gen_filepath(n_URL, 2);
1558 encoding = gen_const_char_ptr(n_encoding, 3);
1559 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001560
William M. Brackf13f77f2004-11-12 16:03:48 +00001561 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001562 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001563 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001564 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001565 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001566 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001567 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001568 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001569 xmlResetLastError();
1570 if (mem_base != xmlMemBlocks()) {
1571 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001574 printf(" %d", n_ctxt);
1575 printf(" %d", n_cur);
1576 printf(" %d", n_URL);
1577 printf(" %d", n_encoding);
1578 printf(" %d", n_options);
1579 printf("\n");
1580 }
1581 }
1582 }
1583 }
1584 }
1585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001586 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001587#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001588
Daniel Veillard42595322004-11-08 10:52:06 +00001589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001590}
1591
1592
1593static int
1594test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001596
William M. Brack21e4ef22005-01-02 09:53:13 +00001597#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001598 htmlDocPtr ret_val;
1599 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1600 int n_ctxt;
1601 const char * filename; /* a file or URL */
1602 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001603 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001604 int n_encoding;
1605 int options; /* a combination of htmlParserOption(s) */
1606 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001607
Daniel Veillarda521d282004-11-09 14:59:59 +00001608 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001609 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1610 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1611 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001612 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001613 filename = gen_filepath(n_filename, 1);
1614 encoding = gen_const_char_ptr(n_encoding, 2);
1615 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001616
William M. Brackf13f77f2004-11-12 16:03:48 +00001617 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001618 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001619 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001620 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001621 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001622 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001623 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001624 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001625 }
1626 }
1627 }
1628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001629 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001630#endif
1631
Daniel Veillard42595322004-11-08 10:52:06 +00001632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001633}
1634
1635
1636static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001637test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001639
William M. Brack21e4ef22005-01-02 09:53:13 +00001640#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001641 int mem_base;
1642 htmlDocPtr ret_val;
1643 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1644 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001645 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001646 int n_buffer;
1647 int size; /* the size of the array */
1648 int n_size;
1649 const char * URL; /* the base URL to use for the document */
1650 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001651 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001652 int n_encoding;
1653 int options; /* a combination of htmlParserOption(s) */
1654 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001655
Daniel Veillarda521d282004-11-09 14:59:59 +00001656 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001657 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1658 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1659 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1660 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1661 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1662 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001663 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001664 buffer = gen_const_char_ptr(n_buffer, 1);
1665 size = gen_int(n_size, 2);
1666 URL = gen_filepath(n_URL, 3);
1667 encoding = gen_const_char_ptr(n_encoding, 4);
1668 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001669
William M. Brackf13f77f2004-11-12 16:03:48 +00001670 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001671 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001672 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001673 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001674 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001675 des_int(n_size, size, 2);
1676 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001677 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001678 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001679 xmlResetLastError();
1680 if (mem_base != xmlMemBlocks()) {
1681 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001684 printf(" %d", n_ctxt);
1685 printf(" %d", n_buffer);
1686 printf(" %d", n_size);
1687 printf(" %d", n_URL);
1688 printf(" %d", n_encoding);
1689 printf(" %d", n_options);
1690 printf("\n");
1691 }
1692 }
1693 }
1694 }
1695 }
1696 }
1697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001698 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001699#endif
1700
Daniel Veillard42595322004-11-08 10:52:06 +00001701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001702}
1703
1704
1705static int
1706test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001708
William M. Brack21e4ef22005-01-02 09:53:13 +00001709#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001710 int mem_base;
1711 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1712 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001713
Daniel Veillarda521d282004-11-09 14:59:59 +00001714 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001715 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001716 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001717
1718 htmlCtxtReset(ctxt);
1719 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001720 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001721 xmlResetLastError();
1722 if (mem_base != xmlMemBlocks()) {
1723 printf("Leak of %d blocks found in htmlCtxtReset",
1724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001726 printf(" %d", n_ctxt);
1727 printf("\n");
1728 }
1729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001730 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001731#endif
1732
Daniel Veillard42595322004-11-08 10:52:06 +00001733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001734}
1735
1736
1737static int
1738test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001740
William M. Brack21e4ef22005-01-02 09:53:13 +00001741#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001742 int mem_base;
1743 int ret_val;
1744 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1745 int n_ctxt;
1746 int options; /* a combination of htmlParserOption(s) */
1747 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001748
Daniel Veillarda521d282004-11-09 14:59:59 +00001749 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001750 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1751 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001752 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001753 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001754
1755 ret_val = htmlCtxtUseOptions(ctxt, options);
1756 desret_int(ret_val);
1757 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001758 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001759 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001760 xmlResetLastError();
1761 if (mem_base != xmlMemBlocks()) {
1762 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001764 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001765 printf(" %d", n_ctxt);
1766 printf(" %d", n_options);
1767 printf("\n");
1768 }
1769 }
1770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001771 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001772#endif
1773
Daniel Veillard42595322004-11-08 10:52:06 +00001774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001775}
1776
1777
1778static int
1779test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001781
William M. Brack21e4ef22005-01-02 09:53:13 +00001782#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001783 int mem_base;
1784 int ret_val;
1785 htmlElemDesc * parent; /* HTML parent element */
1786 int n_parent;
1787 xmlChar * elt; /* HTML element */
1788 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001789
Daniel Veillardce682bc2004-11-05 17:22:25 +00001790 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1791 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1792 mem_base = xmlMemBlocks();
1793 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1794 elt = gen_const_xmlChar_ptr(n_elt, 1);
1795
William M. Brackf13f77f2004-11-12 16:03:48 +00001796 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001797 desret_int(ret_val);
1798 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001799 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1800 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001801 xmlResetLastError();
1802 if (mem_base != xmlMemBlocks()) {
1803 printf("Leak of %d blocks found in htmlElementAllowedHere",
1804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001805 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001806 printf(" %d", n_parent);
1807 printf(" %d", n_elt);
1808 printf("\n");
1809 }
1810 }
1811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001812 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001813#endif
1814
Daniel Veillard42595322004-11-08 10:52:06 +00001815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001816}
1817
1818
1819static int
1820test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001822
William M. Brack21e4ef22005-01-02 09:53:13 +00001823#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001824 int mem_base;
1825 htmlStatus ret_val;
1826 htmlElemDesc * parent; /* HTML parent element */
1827 int n_parent;
1828 htmlElemDesc * elt; /* HTML element */
1829 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001830
Daniel Veillard57b25162004-11-06 14:50:18 +00001831 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1832 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1833 mem_base = xmlMemBlocks();
1834 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1835 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1836
William M. Brackf13f77f2004-11-12 16:03:48 +00001837 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001838 desret_htmlStatus(ret_val);
1839 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001840 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1841 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001842 xmlResetLastError();
1843 if (mem_base != xmlMemBlocks()) {
1844 printf("Leak of %d blocks found in htmlElementStatusHere",
1845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001846 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001847 printf(" %d", n_parent);
1848 printf(" %d", n_elt);
1849 printf("\n");
1850 }
1851 }
1852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001853 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001854#endif
1855
Daniel Veillard42595322004-11-08 10:52:06 +00001856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001857}
1858
1859
1860static int
1861test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001863
William M. Brack21e4ef22005-01-02 09:53:13 +00001864#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001865 int mem_base;
1866 int ret_val;
1867 unsigned char * out; /* a pointer to an array of bytes to store the result */
1868 int n_out;
1869 int * outlen; /* the length of @out */
1870 int n_outlen;
1871 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1872 int n_in;
1873 int * inlen; /* the length of @in */
1874 int n_inlen;
1875 int quoteChar; /* the quote character to escape (' or ") or zero. */
1876 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001877
Daniel Veillardce682bc2004-11-05 17:22:25 +00001878 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1879 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1880 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1881 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1882 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1883 mem_base = xmlMemBlocks();
1884 out = gen_unsigned_char_ptr(n_out, 0);
1885 outlen = gen_int_ptr(n_outlen, 1);
1886 in = gen_const_unsigned_char_ptr(n_in, 2);
1887 inlen = gen_int_ptr(n_inlen, 3);
1888 quoteChar = gen_int(n_quoteChar, 4);
1889
William M. Brackf13f77f2004-11-12 16:03:48 +00001890 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001891 desret_int(ret_val);
1892 call_tests++;
1893 des_unsigned_char_ptr(n_out, out, 0);
1894 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001895 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001896 des_int_ptr(n_inlen, inlen, 3);
1897 des_int(n_quoteChar, quoteChar, 4);
1898 xmlResetLastError();
1899 if (mem_base != xmlMemBlocks()) {
1900 printf("Leak of %d blocks found in htmlEncodeEntities",
1901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001902 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001903 printf(" %d", n_out);
1904 printf(" %d", n_outlen);
1905 printf(" %d", n_in);
1906 printf(" %d", n_inlen);
1907 printf(" %d", n_quoteChar);
1908 printf("\n");
1909 }
1910 }
1911 }
1912 }
1913 }
1914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001915 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001916#endif
1917
Daniel Veillard42595322004-11-08 10:52:06 +00001918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001919}
1920
1921
1922static int
1923test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001925
William M. Brack21e4ef22005-01-02 09:53:13 +00001926#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001927 int mem_base;
1928 const htmlEntityDesc * ret_val;
1929 xmlChar * name; /* the entity name */
1930 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001931
Daniel Veillard42595322004-11-08 10:52:06 +00001932 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1933 mem_base = xmlMemBlocks();
1934 name = gen_const_xmlChar_ptr(n_name, 0);
1935
William M. Brackf13f77f2004-11-12 16:03:48 +00001936 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001937 desret_const_htmlEntityDesc_ptr(ret_val);
1938 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001939 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001940 xmlResetLastError();
1941 if (mem_base != xmlMemBlocks()) {
1942 printf("Leak of %d blocks found in htmlEntityLookup",
1943 xmlMemBlocks() - mem_base);
1944 test_ret++;
1945 printf(" %d", n_name);
1946 printf("\n");
1947 }
1948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001949 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001950#endif
1951
Daniel Veillard42595322004-11-08 10:52:06 +00001952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001953}
1954
1955
1956static int
1957test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001959
William M. Brack21e4ef22005-01-02 09:53:13 +00001960#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001961 int mem_base;
1962 const htmlEntityDesc * ret_val;
1963 unsigned int value; /* the entity's unicode value */
1964 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001965
Daniel Veillard42595322004-11-08 10:52:06 +00001966 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1967 mem_base = xmlMemBlocks();
1968 value = gen_unsigned_int(n_value, 0);
1969
1970 ret_val = htmlEntityValueLookup(value);
1971 desret_const_htmlEntityDesc_ptr(ret_val);
1972 call_tests++;
1973 des_unsigned_int(n_value, value, 0);
1974 xmlResetLastError();
1975 if (mem_base != xmlMemBlocks()) {
1976 printf("Leak of %d blocks found in htmlEntityValueLookup",
1977 xmlMemBlocks() - mem_base);
1978 test_ret++;
1979 printf(" %d", n_value);
1980 printf("\n");
1981 }
1982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001983 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001984#endif
1985
Daniel Veillard42595322004-11-08 10:52:06 +00001986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001987}
1988
1989
1990static int
1991test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001993
William M. Brack21e4ef22005-01-02 09:53:13 +00001994#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001995 int mem_base;
1996 int ret_val;
1997 int val; /* int 0 or 1 */
1998 int n_val;
1999
2000 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2001 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002002 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002003
2004 ret_val = htmlHandleOmittedElem(val);
2005 desret_int(ret_val);
2006 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002007 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002008 xmlResetLastError();
2009 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002010 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002012 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002013 printf(" %d", n_val);
2014 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002015 }
2016 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002017 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002018#endif
2019
Daniel Veillard42595322004-11-08 10:52:06 +00002020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002021}
2022
2023
2024static int
2025test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002027
William M. Brack21e4ef22005-01-02 09:53:13 +00002028#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002029 int mem_base;
2030 int ret_val;
2031 htmlDocPtr doc; /* the HTML document */
2032 int n_doc;
2033 htmlNodePtr elem; /* the HTML element */
2034 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002035
Daniel Veillarda521d282004-11-09 14:59:59 +00002036 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2037 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002038 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002039 doc = gen_htmlDocPtr(n_doc, 0);
2040 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002041
2042 ret_val = htmlIsAutoClosed(doc, elem);
2043 desret_int(ret_val);
2044 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002045 des_htmlDocPtr(n_doc, doc, 0);
2046 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002047 xmlResetLastError();
2048 if (mem_base != xmlMemBlocks()) {
2049 printf("Leak of %d blocks found in htmlIsAutoClosed",
2050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002051 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002052 printf(" %d", n_doc);
2053 printf(" %d", n_elem);
2054 printf("\n");
2055 }
2056 }
2057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002058 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002059#endif
2060
Daniel Veillard42595322004-11-08 10:52:06 +00002061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002062}
2063
2064
2065static int
2066test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002068
William M. Brack21e4ef22005-01-02 09:53:13 +00002069#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002070 int mem_base;
2071 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002072 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002073 int n_name;
2074
2075 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002077 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002078
William M. Brackf13f77f2004-11-12 16:03:48 +00002079 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002080 desret_int(ret_val);
2081 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002082 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002083 xmlResetLastError();
2084 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002085 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002087 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002088 printf(" %d", n_name);
2089 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002090 }
2091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002092 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002093#endif
2094
Daniel Veillard42595322004-11-08 10:52:06 +00002095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002096}
2097
2098
2099static int
2100test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002102
William M. Brack21e4ef22005-01-02 09:53:13 +00002103#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002104 int mem_base;
2105 htmlStatus ret_val;
2106 htmlNodePtr node; /* an htmlNodePtr in a tree */
2107 int n_node;
2108 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2109 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002110
Daniel Veillarda521d282004-11-09 14:59:59 +00002111 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002112 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2113 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002114 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002115 legacy = gen_int(n_legacy, 1);
2116
William M. Brackf13f77f2004-11-12 16:03:48 +00002117 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002118 desret_htmlStatus(ret_val);
2119 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002120 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002121 des_int(n_legacy, legacy, 1);
2122 xmlResetLastError();
2123 if (mem_base != xmlMemBlocks()) {
2124 printf("Leak of %d blocks found in htmlNodeStatus",
2125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002126 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002127 printf(" %d", n_node);
2128 printf(" %d", n_legacy);
2129 printf("\n");
2130 }
2131 }
2132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002133 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002134#endif
2135
Daniel Veillard42595322004-11-08 10:52:06 +00002136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002137}
2138
2139
2140static int
2141test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002143
William M. Brack21e4ef22005-01-02 09:53:13 +00002144#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002145 int mem_base;
2146 int ret_val;
2147 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2148 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002149
Daniel Veillarda521d282004-11-09 14:59:59 +00002150 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002151 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002152 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002153
2154 ret_val = htmlParseCharRef(ctxt);
2155 desret_int(ret_val);
2156 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002157 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002158 xmlResetLastError();
2159 if (mem_base != xmlMemBlocks()) {
2160 printf("Leak of %d blocks found in htmlParseCharRef",
2161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002162 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 printf(" %d", n_ctxt);
2164 printf("\n");
2165 }
2166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002167 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168#endif
2169
Daniel Veillard42595322004-11-08 10:52:06 +00002170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002171}
2172
2173
2174static int
2175test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002177
William M. Brack21e4ef22005-01-02 09:53:13 +00002178#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002179 int mem_base;
2180 int ret_val;
2181 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2182 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002183 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002184 int n_chunk;
2185 int size; /* the size in byte of the chunk */
2186 int n_size;
2187 int terminate; /* last chunk indicator */
2188 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002189
Daniel Veillarda521d282004-11-09 14:59:59 +00002190 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002191 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2192 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2193 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2194 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002195 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002196 chunk = gen_const_char_ptr(n_chunk, 1);
2197 size = gen_int(n_size, 2);
2198 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002199
William M. Brackf13f77f2004-11-12 16:03:48 +00002200 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002201 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002202 desret_int(ret_val);
2203 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002204 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002205 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002206 des_int(n_size, size, 2);
2207 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002208 xmlResetLastError();
2209 if (mem_base != xmlMemBlocks()) {
2210 printf("Leak of %d blocks found in htmlParseChunk",
2211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002212 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002213 printf(" %d", n_ctxt);
2214 printf(" %d", n_chunk);
2215 printf(" %d", n_size);
2216 printf(" %d", n_terminate);
2217 printf("\n");
2218 }
2219 }
2220 }
2221 }
2222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002223 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002224#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002225
Daniel Veillard42595322004-11-08 10:52:06 +00002226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002227}
2228
2229
2230static int
2231test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002233
William M. Brack21e4ef22005-01-02 09:53:13 +00002234#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002235 int mem_base;
2236 htmlDocPtr ret_val;
2237 xmlChar * cur; /* a pointer to an array of xmlChar */
2238 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002239 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002240 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002241
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002242 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2243 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002245 cur = gen_xmlChar_ptr(n_cur, 0);
2246 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002247
William M. Brackf13f77f2004-11-12 16:03:48 +00002248 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002249 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002250 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002251 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002252 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002253 xmlResetLastError();
2254 if (mem_base != xmlMemBlocks()) {
2255 printf("Leak of %d blocks found in htmlParseDoc",
2256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002257 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002258 printf(" %d", n_cur);
2259 printf(" %d", n_encoding);
2260 printf("\n");
2261 }
2262 }
2263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002264 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002265#endif
2266
Daniel Veillard42595322004-11-08 10:52:06 +00002267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002268}
2269
2270
2271static int
2272test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002274
William M. Brack21e4ef22005-01-02 09:53:13 +00002275#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002276 int mem_base;
2277 int ret_val;
2278 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2279 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002280
Daniel Veillarda521d282004-11-09 14:59:59 +00002281 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002282 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002283 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002284
2285 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002286 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002287 desret_int(ret_val);
2288 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002289 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002290 xmlResetLastError();
2291 if (mem_base != xmlMemBlocks()) {
2292 printf("Leak of %d blocks found in htmlParseDocument",
2293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002294 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002295 printf(" %d", n_ctxt);
2296 printf("\n");
2297 }
2298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002299 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002300#endif
2301
Daniel Veillard42595322004-11-08 10:52:06 +00002302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002303}
2304
2305
2306static int
2307test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002309
William M. Brack21e4ef22005-01-02 09:53:13 +00002310#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002311 int mem_base;
2312 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2313 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002314
Daniel Veillarda521d282004-11-09 14:59:59 +00002315 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002316 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002317 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002318
2319 htmlParseElement(ctxt);
2320 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002321 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002322 xmlResetLastError();
2323 if (mem_base != xmlMemBlocks()) {
2324 printf("Leak of %d blocks found in htmlParseElement",
2325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002326 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327 printf(" %d", n_ctxt);
2328 printf("\n");
2329 }
2330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002331 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002332#endif
2333
Daniel Veillard42595322004-11-08 10:52:06 +00002334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002335}
2336
2337
2338static int
2339test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002341
William M. Brack21e4ef22005-01-02 09:53:13 +00002342#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002343 int mem_base;
2344 const htmlEntityDesc * ret_val;
2345 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2346 int n_ctxt;
2347 xmlChar ** str; /* location to store the entity name */
2348 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002349
Daniel Veillarda521d282004-11-09 14:59:59 +00002350 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002351 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2352 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002353 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002354 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2355
William M. Brackf13f77f2004-11-12 16:03:48 +00002356 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002357 desret_const_htmlEntityDesc_ptr(ret_val);
2358 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002359 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002360 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002361 xmlResetLastError();
2362 if (mem_base != xmlMemBlocks()) {
2363 printf("Leak of %d blocks found in htmlParseEntityRef",
2364 xmlMemBlocks() - mem_base);
2365 test_ret++;
2366 printf(" %d", n_ctxt);
2367 printf(" %d", n_str);
2368 printf("\n");
2369 }
2370 }
2371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002372 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002373#endif
2374
Daniel Veillard42595322004-11-08 10:52:06 +00002375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002376}
2377
2378
2379static int
2380test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002382
William M. Brack21e4ef22005-01-02 09:53:13 +00002383#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002384 htmlDocPtr ret_val;
2385 const char * filename; /* the filename */
2386 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002387 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002388 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002389
Daniel Veillarda03e3652004-11-02 18:45:30 +00002390 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2391 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002392 filename = gen_filepath(n_filename, 0);
2393 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394
William M. Brackf13f77f2004-11-12 16:03:48 +00002395 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002396 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002398 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002399 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002400 xmlResetLastError();
2401 }
2402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002403 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002404#endif
2405
Daniel Veillard42595322004-11-08 10:52:06 +00002406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002407}
2408
2409
2410static int
2411test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002413
William M. Brack21e4ef22005-01-02 09:53:13 +00002414#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002415 int mem_base;
2416 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002417 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002418 int n_cur;
2419 const char * URL; /* the base URL to use for the document */
2420 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002421 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 int n_encoding;
2423 int options; /* a combination of htmlParserOption(s) */
2424 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002425
Daniel Veillarda03e3652004-11-02 18:45:30 +00002426 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2427 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2428 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2429 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2430 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002431 cur = gen_const_xmlChar_ptr(n_cur, 0);
2432 URL = gen_filepath(n_URL, 1);
2433 encoding = gen_const_char_ptr(n_encoding, 2);
2434 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002435
William M. Brackf13f77f2004-11-12 16:03:48 +00002436 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002437 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002439 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002440 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002441 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002442 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002443 xmlResetLastError();
2444 if (mem_base != xmlMemBlocks()) {
2445 printf("Leak of %d blocks found in htmlReadDoc",
2446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002447 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002448 printf(" %d", n_cur);
2449 printf(" %d", n_URL);
2450 printf(" %d", n_encoding);
2451 printf(" %d", n_options);
2452 printf("\n");
2453 }
2454 }
2455 }
2456 }
2457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002458 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002459#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002460
Daniel Veillard42595322004-11-08 10:52:06 +00002461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002462}
2463
2464
2465static int
2466test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002468
William M. Brack21e4ef22005-01-02 09:53:13 +00002469#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002470 int mem_base;
2471 htmlDocPtr ret_val;
2472 const char * filename; /* a file or URL */
2473 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002474 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002475 int n_encoding;
2476 int options; /* a combination of htmlParserOption(s) */
2477 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002478
Daniel Veillarda03e3652004-11-02 18:45:30 +00002479 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2480 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2481 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2482 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002483 filename = gen_filepath(n_filename, 0);
2484 encoding = gen_const_char_ptr(n_encoding, 1);
2485 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486
William M. Brackf13f77f2004-11-12 16:03:48 +00002487 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002488 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002490 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002491 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002492 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002493 xmlResetLastError();
2494 if (mem_base != xmlMemBlocks()) {
2495 printf("Leak of %d blocks found in htmlReadFile",
2496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002497 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002498 printf(" %d", n_filename);
2499 printf(" %d", n_encoding);
2500 printf(" %d", n_options);
2501 printf("\n");
2502 }
2503 }
2504 }
2505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002506 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002507#endif
2508
Daniel Veillard42595322004-11-08 10:52:06 +00002509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002510}
2511
2512
2513static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002514test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002516
William M. Brack21e4ef22005-01-02 09:53:13 +00002517#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002518 int mem_base;
2519 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002520 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002521 int n_buffer;
2522 int size; /* the size of the array */
2523 int n_size;
2524 const char * URL; /* the base URL to use for the document */
2525 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002526 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002527 int n_encoding;
2528 int options; /* a combination of htmlParserOption(s) */
2529 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002530
Daniel Veillarda03e3652004-11-02 18:45:30 +00002531 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2532 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2533 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2534 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2535 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2536 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002537 buffer = gen_const_char_ptr(n_buffer, 0);
2538 size = gen_int(n_size, 1);
2539 URL = gen_filepath(n_URL, 2);
2540 encoding = gen_const_char_ptr(n_encoding, 3);
2541 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002542
William M. Brackf13f77f2004-11-12 16:03:48 +00002543 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002544 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002545 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002546 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002547 des_int(n_size, size, 1);
2548 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002549 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002550 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002551 xmlResetLastError();
2552 if (mem_base != xmlMemBlocks()) {
2553 printf("Leak of %d blocks found in htmlReadMemory",
2554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002556 printf(" %d", n_buffer);
2557 printf(" %d", n_size);
2558 printf(" %d", n_URL);
2559 printf(" %d", n_encoding);
2560 printf(" %d", n_options);
2561 printf("\n");
2562 }
2563 }
2564 }
2565 }
2566 }
2567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002568 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002569#endif
2570
Daniel Veillard42595322004-11-08 10:52:06 +00002571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002572}
2573
2574
2575static int
2576test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002578
William M. Brack21e4ef22005-01-02 09:53:13 +00002579#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002580 int mem_base;
2581 htmlDocPtr ret_val;
2582 xmlChar * cur; /* a pointer to an array of xmlChar */
2583 int n_cur;
2584 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2585 int n_encoding;
2586 htmlSAXHandlerPtr sax; /* the SAX handler block */
2587 int n_sax;
2588 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2589 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002590
Daniel Veillardce682bc2004-11-05 17:22:25 +00002591 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2592 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2593 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2594 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2595 mem_base = xmlMemBlocks();
2596 cur = gen_xmlChar_ptr(n_cur, 0);
2597 encoding = gen_const_char_ptr(n_encoding, 1);
2598 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2599 userData = gen_userdata(n_userData, 3);
2600
William M. Brackf13f77f2004-11-12 16:03:48 +00002601 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002602 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002603 call_tests++;
2604 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002605 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002606 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2607 des_userdata(n_userData, userData, 3);
2608 xmlResetLastError();
2609 if (mem_base != xmlMemBlocks()) {
2610 printf("Leak of %d blocks found in htmlSAXParseDoc",
2611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002612 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002613 printf(" %d", n_cur);
2614 printf(" %d", n_encoding);
2615 printf(" %d", n_sax);
2616 printf(" %d", n_userData);
2617 printf("\n");
2618 }
2619 }
2620 }
2621 }
2622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002623 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002624#endif
2625
Daniel Veillard42595322004-11-08 10:52:06 +00002626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002627}
2628
2629
2630static int
2631test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002633
William M. Brack21e4ef22005-01-02 09:53:13 +00002634#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002635 int mem_base;
2636 htmlDocPtr ret_val;
2637 const char * filename; /* the filename */
2638 int n_filename;
2639 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2640 int n_encoding;
2641 htmlSAXHandlerPtr sax; /* the SAX handler block */
2642 int n_sax;
2643 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2644 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002645
Daniel Veillardce682bc2004-11-05 17:22:25 +00002646 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2647 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2648 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2649 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2650 mem_base = xmlMemBlocks();
2651 filename = gen_filepath(n_filename, 0);
2652 encoding = gen_const_char_ptr(n_encoding, 1);
2653 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2654 userData = gen_userdata(n_userData, 3);
2655
William M. Brackf13f77f2004-11-12 16:03:48 +00002656 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002657 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002658 call_tests++;
2659 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002660 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002661 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2662 des_userdata(n_userData, userData, 3);
2663 xmlResetLastError();
2664 if (mem_base != xmlMemBlocks()) {
2665 printf("Leak of %d blocks found in htmlSAXParseFile",
2666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002667 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002668 printf(" %d", n_filename);
2669 printf(" %d", n_encoding);
2670 printf(" %d", n_sax);
2671 printf(" %d", n_userData);
2672 printf("\n");
2673 }
2674 }
2675 }
2676 }
2677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002678 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002679#endif
2680
Daniel Veillard42595322004-11-08 10:52:06 +00002681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002682}
2683
2684
2685static int
2686test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002688
2689
2690 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002692}
2693
2694static int
2695test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002697
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002698 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002699 test_ret += test_UTF8ToHtml();
2700 test_ret += test_htmlAttrAllowed();
2701 test_ret += test_htmlAutoCloseTag();
2702 test_ret += test_htmlCreateMemoryParserCtxt();
2703 test_ret += test_htmlCreatePushParserCtxt();
2704 test_ret += test_htmlCtxtReadDoc();
2705 test_ret += test_htmlCtxtReadFile();
2706 test_ret += test_htmlCtxtReadMemory();
2707 test_ret += test_htmlCtxtReset();
2708 test_ret += test_htmlCtxtUseOptions();
2709 test_ret += test_htmlElementAllowedHere();
2710 test_ret += test_htmlElementStatusHere();
2711 test_ret += test_htmlEncodeEntities();
2712 test_ret += test_htmlEntityLookup();
2713 test_ret += test_htmlEntityValueLookup();
2714 test_ret += test_htmlHandleOmittedElem();
2715 test_ret += test_htmlIsAutoClosed();
2716 test_ret += test_htmlIsScriptAttribute();
2717 test_ret += test_htmlNodeStatus();
2718 test_ret += test_htmlParseCharRef();
2719 test_ret += test_htmlParseChunk();
2720 test_ret += test_htmlParseDoc();
2721 test_ret += test_htmlParseDocument();
2722 test_ret += test_htmlParseElement();
2723 test_ret += test_htmlParseEntityRef();
2724 test_ret += test_htmlParseFile();
2725 test_ret += test_htmlReadDoc();
2726 test_ret += test_htmlReadFile();
2727 test_ret += test_htmlReadMemory();
2728 test_ret += test_htmlSAXParseDoc();
2729 test_ret += test_htmlSAXParseFile();
2730 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002731
Daniel Veillard42595322004-11-08 10:52:06 +00002732 if (test_ret != 0)
2733 printf("Module HTMLparser: %d errors\n", test_ret);
2734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002735}
2736
2737static int
2738test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002740
William M. Brack21e4ef22005-01-02 09:53:13 +00002741#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002742 int mem_base;
2743 xmlOutputBufferPtr buf; /* the HTML buffer output */
2744 int n_buf;
2745 xmlDocPtr cur; /* the document */
2746 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002747 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002748 int n_encoding;
2749 int format; /* should formatting spaces been added */
2750 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002751
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2753 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2754 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2755 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2756 mem_base = xmlMemBlocks();
2757 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2758 cur = gen_xmlDocPtr(n_cur, 1);
2759 encoding = gen_const_char_ptr(n_encoding, 2);
2760 format = gen_int(n_format, 3);
2761
William M. Brackf13f77f2004-11-12 16:03:48 +00002762 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002763 call_tests++;
2764 des_xmlOutputBufferPtr(n_buf, buf, 0);
2765 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002766 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002767 des_int(n_format, format, 3);
2768 xmlResetLastError();
2769 if (mem_base != xmlMemBlocks()) {
2770 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002772 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002773 printf(" %d", n_buf);
2774 printf(" %d", n_cur);
2775 printf(" %d", n_encoding);
2776 printf(" %d", n_format);
2777 printf("\n");
2778 }
2779 }
2780 }
2781 }
2782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002783 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002784#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002785
Daniel Veillard42595322004-11-08 10:52:06 +00002786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002787}
2788
2789
2790static int
2791test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002793
William M. Brack21e4ef22005-01-02 09:53:13 +00002794#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002795 int mem_base;
2796 xmlOutputBufferPtr buf; /* the HTML buffer output */
2797 int n_buf;
2798 xmlDocPtr cur; /* the document */
2799 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002800 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002801 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002802
Daniel Veillard3d97e662004-11-04 10:49:00 +00002803 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2804 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2805 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2806 mem_base = xmlMemBlocks();
2807 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2808 cur = gen_xmlDocPtr(n_cur, 1);
2809 encoding = gen_const_char_ptr(n_encoding, 2);
2810
William M. Brackf13f77f2004-11-12 16:03:48 +00002811 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002812 call_tests++;
2813 des_xmlOutputBufferPtr(n_buf, buf, 0);
2814 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002815 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002816 xmlResetLastError();
2817 if (mem_base != xmlMemBlocks()) {
2818 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002820 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002821 printf(" %d", n_buf);
2822 printf(" %d", n_cur);
2823 printf(" %d", n_encoding);
2824 printf("\n");
2825 }
2826 }
2827 }
2828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002829 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002830#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002831
Daniel Veillard42595322004-11-08 10:52:06 +00002832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002833}
2834
2835
2836static int
2837test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002839
William M. Brack21e4ef22005-01-02 09:53:13 +00002840#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002841 int mem_base;
2842 int ret_val;
2843 FILE * f; /* the FILE* */
2844 int n_f;
2845 xmlDocPtr cur; /* the document */
2846 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002847
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002848 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2849 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2850 mem_base = xmlMemBlocks();
2851 f = gen_FILE_ptr(n_f, 0);
2852 cur = gen_xmlDocPtr(n_cur, 1);
2853
2854 ret_val = htmlDocDump(f, cur);
2855 desret_int(ret_val);
2856 call_tests++;
2857 des_FILE_ptr(n_f, f, 0);
2858 des_xmlDocPtr(n_cur, cur, 1);
2859 xmlResetLastError();
2860 if (mem_base != xmlMemBlocks()) {
2861 printf("Leak of %d blocks found in htmlDocDump",
2862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002863 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002864 printf(" %d", n_f);
2865 printf(" %d", n_cur);
2866 printf("\n");
2867 }
2868 }
2869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002870 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002871#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002872
Daniel Veillard42595322004-11-08 10:52:06 +00002873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002874}
2875
2876
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002877#define gen_nb_xmlChar_ptr_ptr 1
2878static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2879 return(NULL);
2880}
2881static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2882}
2883
Daniel Veillardd93f6252004-11-02 15:53:51 +00002884static int
2885test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002887
William M. Brack21e4ef22005-01-02 09:53:13 +00002888#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002889 int mem_base;
2890 xmlDocPtr cur; /* the document */
2891 int n_cur;
2892 xmlChar ** mem; /* OUT: the memory pointer */
2893 int n_mem;
2894 int * size; /* OUT: the memory length */
2895 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002896
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002897 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2898 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2899 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2900 mem_base = xmlMemBlocks();
2901 cur = gen_xmlDocPtr(n_cur, 0);
2902 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2903 size = gen_int_ptr(n_size, 2);
2904
2905 htmlDocDumpMemory(cur, mem, size);
2906 call_tests++;
2907 des_xmlDocPtr(n_cur, cur, 0);
2908 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2909 des_int_ptr(n_size, size, 2);
2910 xmlResetLastError();
2911 if (mem_base != xmlMemBlocks()) {
2912 printf("Leak of %d blocks found in htmlDocDumpMemory",
2913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002914 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002915 printf(" %d", n_cur);
2916 printf(" %d", n_mem);
2917 printf(" %d", n_size);
2918 printf("\n");
2919 }
2920 }
2921 }
2922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002923 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002924#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002925
Daniel Veillard42595322004-11-08 10:52:06 +00002926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002927}
2928
2929
2930static int
2931test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002933
William M. Brack21e4ef22005-01-02 09:53:13 +00002934#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002935 int mem_base;
2936 const xmlChar * ret_val;
2937 htmlDocPtr doc; /* the document */
2938 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002939
Daniel Veillarda521d282004-11-09 14:59:59 +00002940 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002941 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002942 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002943
2944 ret_val = htmlGetMetaEncoding(doc);
2945 desret_const_xmlChar_ptr(ret_val);
2946 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002947 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002948 xmlResetLastError();
2949 if (mem_base != xmlMemBlocks()) {
2950 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002952 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002953 printf(" %d", n_doc);
2954 printf("\n");
2955 }
2956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002957 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002958#endif
2959
Daniel Veillard42595322004-11-08 10:52:06 +00002960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961}
2962
2963
2964static int
2965test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002967
William M. Brack21e4ef22005-01-02 09:53:13 +00002968#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002969 int mem_base;
2970 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002971 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002972 int n_name;
2973
2974 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002976 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002977
William M. Brackf13f77f2004-11-12 16:03:48 +00002978 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002979 desret_int(ret_val);
2980 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002981 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002982 xmlResetLastError();
2983 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002984 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002986 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 printf(" %d", n_name);
2988 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002989 }
2990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002991 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002992#endif
2993
Daniel Veillard42595322004-11-08 10:52:06 +00002994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002995}
2996
2997
2998static int
2999test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003001
William M. Brack21e4ef22005-01-02 09:53:13 +00003002#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003003 int mem_base;
3004 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003005 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003006 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003007 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003008 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003009
Daniel Veillarda03e3652004-11-02 18:45:30 +00003010 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3011 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003013 URI = gen_const_xmlChar_ptr(n_URI, 0);
3014 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003015
William M. Brackf13f77f2004-11-12 16:03:48 +00003016 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003017 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003018 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003019 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3020 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003021 xmlResetLastError();
3022 if (mem_base != xmlMemBlocks()) {
3023 printf("Leak of %d blocks found in htmlNewDoc",
3024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003025 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 printf(" %d", n_URI);
3027 printf(" %d", n_ExternalID);
3028 printf("\n");
3029 }
3030 }
3031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003032 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003033#endif
3034
Daniel Veillard42595322004-11-08 10:52:06 +00003035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003036}
3037
3038
3039static int
3040test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003042
William M. Brack21e4ef22005-01-02 09:53:13 +00003043#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003044 int mem_base;
3045 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003046 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003047 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003048 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003049 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003050
Daniel Veillarda03e3652004-11-02 18:45:30 +00003051 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3052 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003054 URI = gen_const_xmlChar_ptr(n_URI, 0);
3055 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003056
William M. Brackf13f77f2004-11-12 16:03:48 +00003057 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003058 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003059 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003060 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3061 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003062 xmlResetLastError();
3063 if (mem_base != xmlMemBlocks()) {
3064 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003066 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003067 printf(" %d", n_URI);
3068 printf(" %d", n_ExternalID);
3069 printf("\n");
3070 }
3071 }
3072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003073 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003074#endif
3075
Daniel Veillard42595322004-11-08 10:52:06 +00003076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003077}
3078
3079
3080static int
3081test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003083
William M. Brack21e4ef22005-01-02 09:53:13 +00003084#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003085 int mem_base;
3086 int ret_val;
3087 xmlBufferPtr buf; /* the HTML buffer output */
3088 int n_buf;
3089 xmlDocPtr doc; /* the document */
3090 int n_doc;
3091 xmlNodePtr cur; /* the current node */
3092 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003093
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003094 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3095 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3096 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003098 buf = gen_xmlBufferPtr(n_buf, 0);
3099 doc = gen_xmlDocPtr(n_doc, 1);
3100 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003101
3102 ret_val = htmlNodeDump(buf, doc, cur);
3103 desret_int(ret_val);
3104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003105 des_xmlBufferPtr(n_buf, buf, 0);
3106 des_xmlDocPtr(n_doc, doc, 1);
3107 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003108 xmlResetLastError();
3109 if (mem_base != xmlMemBlocks()) {
3110 printf("Leak of %d blocks found in htmlNodeDump",
3111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003112 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003113 printf(" %d", n_buf);
3114 printf(" %d", n_doc);
3115 printf(" %d", n_cur);
3116 printf("\n");
3117 }
3118 }
3119 }
3120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003121 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003122#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003123
Daniel Veillard42595322004-11-08 10:52:06 +00003124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003125}
3126
3127
3128static int
3129test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003131
William M. Brack21e4ef22005-01-02 09:53:13 +00003132#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003133 int mem_base;
3134 FILE * out; /* the FILE pointer */
3135 int n_out;
3136 xmlDocPtr doc; /* the document */
3137 int n_doc;
3138 xmlNodePtr cur; /* the current node */
3139 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003140
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003141 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3142 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3143 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3144 mem_base = xmlMemBlocks();
3145 out = gen_FILE_ptr(n_out, 0);
3146 doc = gen_xmlDocPtr(n_doc, 1);
3147 cur = gen_xmlNodePtr(n_cur, 2);
3148
3149 htmlNodeDumpFile(out, doc, cur);
3150 call_tests++;
3151 des_FILE_ptr(n_out, out, 0);
3152 des_xmlDocPtr(n_doc, doc, 1);
3153 des_xmlNodePtr(n_cur, cur, 2);
3154 xmlResetLastError();
3155 if (mem_base != xmlMemBlocks()) {
3156 printf("Leak of %d blocks found in htmlNodeDumpFile",
3157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003158 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003159 printf(" %d", n_out);
3160 printf(" %d", n_doc);
3161 printf(" %d", n_cur);
3162 printf("\n");
3163 }
3164 }
3165 }
3166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003167 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003168#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003169
Daniel Veillard42595322004-11-08 10:52:06 +00003170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003171}
3172
3173
3174static int
3175test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003177
William M. Brack21e4ef22005-01-02 09:53:13 +00003178#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003179 int mem_base;
3180 int ret_val;
3181 FILE * out; /* the FILE pointer */
3182 int n_out;
3183 xmlDocPtr doc; /* the document */
3184 int n_doc;
3185 xmlNodePtr cur; /* the current node */
3186 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003187 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003188 int n_encoding;
3189 int format; /* should formatting spaces been added */
3190 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003191
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003192 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3193 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3194 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3195 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3196 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3197 mem_base = xmlMemBlocks();
3198 out = gen_FILE_ptr(n_out, 0);
3199 doc = gen_xmlDocPtr(n_doc, 1);
3200 cur = gen_xmlNodePtr(n_cur, 2);
3201 encoding = gen_const_char_ptr(n_encoding, 3);
3202 format = gen_int(n_format, 4);
3203
William M. Brackf13f77f2004-11-12 16:03:48 +00003204 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003205 desret_int(ret_val);
3206 call_tests++;
3207 des_FILE_ptr(n_out, out, 0);
3208 des_xmlDocPtr(n_doc, doc, 1);
3209 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003210 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003211 des_int(n_format, format, 4);
3212 xmlResetLastError();
3213 if (mem_base != xmlMemBlocks()) {
3214 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003216 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003217 printf(" %d", n_out);
3218 printf(" %d", n_doc);
3219 printf(" %d", n_cur);
3220 printf(" %d", n_encoding);
3221 printf(" %d", n_format);
3222 printf("\n");
3223 }
3224 }
3225 }
3226 }
3227 }
3228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003229 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003230#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003231
Daniel Veillard42595322004-11-08 10:52:06 +00003232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003233}
3234
3235
3236static int
3237test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003239
William M. Brack21e4ef22005-01-02 09:53:13 +00003240#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003241 int mem_base;
3242 xmlOutputBufferPtr buf; /* the HTML buffer output */
3243 int n_buf;
3244 xmlDocPtr doc; /* the document */
3245 int n_doc;
3246 xmlNodePtr cur; /* the current node */
3247 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003248 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003249 int n_encoding;
3250 int format; /* should formatting spaces been added */
3251 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003252
Daniel Veillard3d97e662004-11-04 10:49:00 +00003253 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3254 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3255 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3256 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3257 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3258 mem_base = xmlMemBlocks();
3259 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3260 doc = gen_xmlDocPtr(n_doc, 1);
3261 cur = gen_xmlNodePtr(n_cur, 2);
3262 encoding = gen_const_char_ptr(n_encoding, 3);
3263 format = gen_int(n_format, 4);
3264
William M. Brackf13f77f2004-11-12 16:03:48 +00003265 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003266 call_tests++;
3267 des_xmlOutputBufferPtr(n_buf, buf, 0);
3268 des_xmlDocPtr(n_doc, doc, 1);
3269 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003270 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003271 des_int(n_format, format, 4);
3272 xmlResetLastError();
3273 if (mem_base != xmlMemBlocks()) {
3274 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003276 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003277 printf(" %d", n_buf);
3278 printf(" %d", n_doc);
3279 printf(" %d", n_cur);
3280 printf(" %d", n_encoding);
3281 printf(" %d", n_format);
3282 printf("\n");
3283 }
3284 }
3285 }
3286 }
3287 }
3288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003289 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003290#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003291
Daniel Veillard42595322004-11-08 10:52:06 +00003292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003293}
3294
3295
3296static int
3297test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003299
William M. Brack21e4ef22005-01-02 09:53:13 +00003300#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003301 int mem_base;
3302 xmlOutputBufferPtr buf; /* the HTML buffer output */
3303 int n_buf;
3304 xmlDocPtr doc; /* the document */
3305 int n_doc;
3306 xmlNodePtr cur; /* the current node */
3307 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003308 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003309 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003310
Daniel Veillard3d97e662004-11-04 10:49:00 +00003311 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3312 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3313 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3314 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3315 mem_base = xmlMemBlocks();
3316 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3317 doc = gen_xmlDocPtr(n_doc, 1);
3318 cur = gen_xmlNodePtr(n_cur, 2);
3319 encoding = gen_const_char_ptr(n_encoding, 3);
3320
William M. Brackf13f77f2004-11-12 16:03:48 +00003321 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003322 call_tests++;
3323 des_xmlOutputBufferPtr(n_buf, buf, 0);
3324 des_xmlDocPtr(n_doc, doc, 1);
3325 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003326 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003327 xmlResetLastError();
3328 if (mem_base != xmlMemBlocks()) {
3329 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003331 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003332 printf(" %d", n_buf);
3333 printf(" %d", n_doc);
3334 printf(" %d", n_cur);
3335 printf(" %d", n_encoding);
3336 printf("\n");
3337 }
3338 }
3339 }
3340 }
3341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003342 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003343#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003344
Daniel Veillard42595322004-11-08 10:52:06 +00003345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003346}
3347
3348
3349static int
3350test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003352
William M. Brack21e4ef22005-01-02 09:53:13 +00003353#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354 int mem_base;
3355 int ret_val;
3356 const char * filename; /* the filename (or URL) */
3357 int n_filename;
3358 xmlDocPtr cur; /* the document */
3359 int n_cur;
3360
3361 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3362 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003364 filename = gen_fileoutput(n_filename, 0);
3365 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003366
3367 ret_val = htmlSaveFile(filename, cur);
3368 desret_int(ret_val);
3369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003370 des_fileoutput(n_filename, filename, 0);
3371 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003372 xmlResetLastError();
3373 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003374 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003376 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003377 printf(" %d", n_filename);
3378 printf(" %d", n_cur);
3379 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003380 }
3381 }
3382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003383 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003384#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003385
Daniel Veillard42595322004-11-08 10:52:06 +00003386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003387}
3388
3389
3390static int
3391test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003393
William M. Brack21e4ef22005-01-02 09:53:13 +00003394#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003395 int mem_base;
3396 int ret_val;
3397 const char * filename; /* the filename */
3398 int n_filename;
3399 xmlDocPtr cur; /* the document */
3400 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003401 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003402 int n_encoding;
3403
3404 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3405 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3406 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3407 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003408 filename = gen_fileoutput(n_filename, 0);
3409 cur = gen_xmlDocPtr(n_cur, 1);
3410 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003411
William M. Brackf13f77f2004-11-12 16:03:48 +00003412 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003413 desret_int(ret_val);
3414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003415 des_fileoutput(n_filename, filename, 0);
3416 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003417 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003418 xmlResetLastError();
3419 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003420 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003422 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003423 printf(" %d", n_filename);
3424 printf(" %d", n_cur);
3425 printf(" %d", n_encoding);
3426 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003427 }
3428 }
3429 }
3430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003431 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003432#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003433
Daniel Veillard42595322004-11-08 10:52:06 +00003434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003435}
3436
3437
3438static int
3439test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003441
William M. Brack21e4ef22005-01-02 09:53:13 +00003442#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003443 int mem_base;
3444 int ret_val;
3445 const char * filename; /* the filename */
3446 int n_filename;
3447 xmlDocPtr cur; /* the document */
3448 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003449 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450 int n_encoding;
3451 int format; /* should formatting spaces been added */
3452 int n_format;
3453
3454 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3455 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3456 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3457 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3458 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003459 filename = gen_fileoutput(n_filename, 0);
3460 cur = gen_xmlDocPtr(n_cur, 1);
3461 encoding = gen_const_char_ptr(n_encoding, 2);
3462 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003463
William M. Brackf13f77f2004-11-12 16:03:48 +00003464 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003465 desret_int(ret_val);
3466 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003467 des_fileoutput(n_filename, filename, 0);
3468 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003469 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003470 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003471 xmlResetLastError();
3472 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003473 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003475 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003476 printf(" %d", n_filename);
3477 printf(" %d", n_cur);
3478 printf(" %d", n_encoding);
3479 printf(" %d", n_format);
3480 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003481 }
3482 }
3483 }
3484 }
3485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003486 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003487#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003488
Daniel Veillard42595322004-11-08 10:52:06 +00003489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003490}
3491
3492
3493static int
3494test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003496
William M. Brack21e4ef22005-01-02 09:53:13 +00003497#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003498 int mem_base;
3499 int ret_val;
3500 htmlDocPtr doc; /* the document */
3501 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003502 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003503 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003504
Daniel Veillarda521d282004-11-09 14:59:59 +00003505 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003506 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3507 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003508 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003509 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003510
William M. Brackf13f77f2004-11-12 16:03:48 +00003511 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003512 desret_int(ret_val);
3513 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003514 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003515 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003516 xmlResetLastError();
3517 if (mem_base != xmlMemBlocks()) {
3518 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003521 printf(" %d", n_doc);
3522 printf(" %d", n_encoding);
3523 printf("\n");
3524 }
3525 }
3526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003527 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003528#endif
3529
Daniel Veillard42595322004-11-08 10:52:06 +00003530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003531}
3532
3533static int
3534test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003536
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003537 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003538 test_ret += test_htmlDocContentDumpFormatOutput();
3539 test_ret += test_htmlDocContentDumpOutput();
3540 test_ret += test_htmlDocDump();
3541 test_ret += test_htmlDocDumpMemory();
3542 test_ret += test_htmlGetMetaEncoding();
3543 test_ret += test_htmlIsBooleanAttr();
3544 test_ret += test_htmlNewDoc();
3545 test_ret += test_htmlNewDocNoDtD();
3546 test_ret += test_htmlNodeDump();
3547 test_ret += test_htmlNodeDumpFile();
3548 test_ret += test_htmlNodeDumpFileFormat();
3549 test_ret += test_htmlNodeDumpFormatOutput();
3550 test_ret += test_htmlNodeDumpOutput();
3551 test_ret += test_htmlSaveFile();
3552 test_ret += test_htmlSaveFileEnc();
3553 test_ret += test_htmlSaveFileFormat();
3554 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003555
Daniel Veillard42595322004-11-08 10:52:06 +00003556 if (test_ret != 0)
3557 printf("Module HTMLtree: %d errors\n", test_ret);
3558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003559}
3560
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003561static int
3562test_docbDefaultSAXHandlerInit(void) {
3563 int test_ret = 0;
3564
William M. Brack21e4ef22005-01-02 09:53:13 +00003565#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003566#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003567 int mem_base;
3568
3569 mem_base = xmlMemBlocks();
3570
3571 docbDefaultSAXHandlerInit();
3572 call_tests++;
3573 xmlResetLastError();
3574 if (mem_base != xmlMemBlocks()) {
3575 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3576 xmlMemBlocks() - mem_base);
3577 test_ret++;
3578 printf("\n");
3579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003580 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003581#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003582#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003583
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003584 return(test_ret);
3585}
3586
3587
3588static int
3589test_htmlDefaultSAXHandlerInit(void) {
3590 int test_ret = 0;
3591
William M. Brack21e4ef22005-01-02 09:53:13 +00003592#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003593#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003594 int mem_base;
3595
3596 mem_base = xmlMemBlocks();
3597
3598 htmlDefaultSAXHandlerInit();
3599 call_tests++;
3600 xmlResetLastError();
3601 if (mem_base != xmlMemBlocks()) {
3602 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3603 xmlMemBlocks() - mem_base);
3604 test_ret++;
3605 printf("\n");
3606 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003607 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003608#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003609#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003611 return(test_ret);
3612}
3613
3614
3615static int
3616test_xmlDefaultSAXHandlerInit(void) {
3617 int test_ret = 0;
3618
3619 int mem_base;
3620
3621 mem_base = xmlMemBlocks();
3622
3623 xmlDefaultSAXHandlerInit();
3624 call_tests++;
3625 xmlResetLastError();
3626 if (mem_base != xmlMemBlocks()) {
3627 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3628 xmlMemBlocks() - mem_base);
3629 test_ret++;
3630 printf("\n");
3631 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003632 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003633
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003634 return(test_ret);
3635}
3636
3637
3638#define gen_nb_xmlEnumerationPtr 1
3639static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3640 return(NULL);
3641}
3642static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3643}
3644
3645static int
3646test_xmlSAX2AttributeDecl(void) {
3647 int test_ret = 0;
3648
3649 int mem_base;
3650 void * ctx; /* the user data (XML parser context) */
3651 int n_ctx;
3652 xmlChar * elem; /* the name of the element */
3653 int n_elem;
3654 xmlChar * fullname; /* the attribute name */
3655 int n_fullname;
3656 int type; /* the attribute type */
3657 int n_type;
3658 int def; /* the type of default value */
3659 int n_def;
3660 xmlChar * defaultValue; /* the attribute default value */
3661 int n_defaultValue;
3662 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3663 int n_tree;
3664
3665 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3666 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3667 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3668 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3669 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3670 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3671 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3672 mem_base = xmlMemBlocks();
3673 ctx = gen_void_ptr(n_ctx, 0);
3674 elem = gen_const_xmlChar_ptr(n_elem, 1);
3675 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3676 type = gen_int(n_type, 3);
3677 def = gen_int(n_def, 4);
3678 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3679 tree = gen_xmlEnumerationPtr(n_tree, 6);
3680
William M. Brackf13f77f2004-11-12 16:03:48 +00003681 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003682 call_tests++;
3683 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003684 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3685 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003686 des_int(n_type, type, 3);
3687 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003688 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003689 des_xmlEnumerationPtr(n_tree, tree, 6);
3690 xmlResetLastError();
3691 if (mem_base != xmlMemBlocks()) {
3692 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3693 xmlMemBlocks() - mem_base);
3694 test_ret++;
3695 printf(" %d", n_ctx);
3696 printf(" %d", n_elem);
3697 printf(" %d", n_fullname);
3698 printf(" %d", n_type);
3699 printf(" %d", n_def);
3700 printf(" %d", n_defaultValue);
3701 printf(" %d", n_tree);
3702 printf("\n");
3703 }
3704 }
3705 }
3706 }
3707 }
3708 }
3709 }
3710 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003712
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003713 return(test_ret);
3714}
3715
3716
3717static int
3718test_xmlSAX2CDataBlock(void) {
3719 int test_ret = 0;
3720
3721 int mem_base;
3722 void * ctx; /* the user data (XML parser context) */
3723 int n_ctx;
3724 xmlChar * value; /* The pcdata content */
3725 int n_value;
3726 int len; /* the block length */
3727 int n_len;
3728
3729 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3730 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3731 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3732 mem_base = xmlMemBlocks();
3733 ctx = gen_void_ptr(n_ctx, 0);
3734 value = gen_const_xmlChar_ptr(n_value, 1);
3735 len = gen_int(n_len, 2);
3736
William M. Brackf13f77f2004-11-12 16:03:48 +00003737 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003738 call_tests++;
3739 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003740 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003741 des_int(n_len, len, 2);
3742 xmlResetLastError();
3743 if (mem_base != xmlMemBlocks()) {
3744 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3745 xmlMemBlocks() - mem_base);
3746 test_ret++;
3747 printf(" %d", n_ctx);
3748 printf(" %d", n_value);
3749 printf(" %d", n_len);
3750 printf("\n");
3751 }
3752 }
3753 }
3754 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003756
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003757 return(test_ret);
3758}
3759
3760
3761static int
3762test_xmlSAX2Characters(void) {
3763 int test_ret = 0;
3764
3765 int mem_base;
3766 void * ctx; /* the user data (XML parser context) */
3767 int n_ctx;
3768 xmlChar * ch; /* a xmlChar string */
3769 int n_ch;
3770 int len; /* the number of xmlChar */
3771 int n_len;
3772
3773 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3774 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3775 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3776 mem_base = xmlMemBlocks();
3777 ctx = gen_void_ptr(n_ctx, 0);
3778 ch = gen_const_xmlChar_ptr(n_ch, 1);
3779 len = gen_int(n_len, 2);
3780
William M. Brackf13f77f2004-11-12 16:03:48 +00003781 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003782 call_tests++;
3783 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003784 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003785 des_int(n_len, len, 2);
3786 xmlResetLastError();
3787 if (mem_base != xmlMemBlocks()) {
3788 printf("Leak of %d blocks found in xmlSAX2Characters",
3789 xmlMemBlocks() - mem_base);
3790 test_ret++;
3791 printf(" %d", n_ctx);
3792 printf(" %d", n_ch);
3793 printf(" %d", n_len);
3794 printf("\n");
3795 }
3796 }
3797 }
3798 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003800
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003801 return(test_ret);
3802}
3803
3804
3805static int
3806test_xmlSAX2Comment(void) {
3807 int test_ret = 0;
3808
3809 int mem_base;
3810 void * ctx; /* the user data (XML parser context) */
3811 int n_ctx;
3812 xmlChar * value; /* the xmlSAX2Comment content */
3813 int n_value;
3814
3815 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3816 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3817 mem_base = xmlMemBlocks();
3818 ctx = gen_void_ptr(n_ctx, 0);
3819 value = gen_const_xmlChar_ptr(n_value, 1);
3820
William M. Brackf13f77f2004-11-12 16:03:48 +00003821 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003822 call_tests++;
3823 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003824 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003825 xmlResetLastError();
3826 if (mem_base != xmlMemBlocks()) {
3827 printf("Leak of %d blocks found in xmlSAX2Comment",
3828 xmlMemBlocks() - mem_base);
3829 test_ret++;
3830 printf(" %d", n_ctx);
3831 printf(" %d", n_value);
3832 printf("\n");
3833 }
3834 }
3835 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003836 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003837
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003838 return(test_ret);
3839}
3840
3841
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003842static int
3843test_xmlSAX2ElementDecl(void) {
3844 int test_ret = 0;
3845
3846 int mem_base;
3847 void * ctx; /* the user data (XML parser context) */
3848 int n_ctx;
3849 xmlChar * name; /* the element name */
3850 int n_name;
3851 int type; /* the element type */
3852 int n_type;
3853 xmlElementContentPtr content; /* the element value tree */
3854 int n_content;
3855
3856 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3857 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3858 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3859 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3860 mem_base = xmlMemBlocks();
3861 ctx = gen_void_ptr(n_ctx, 0);
3862 name = gen_const_xmlChar_ptr(n_name, 1);
3863 type = gen_int(n_type, 2);
3864 content = gen_xmlElementContentPtr(n_content, 3);
3865
William M. Brackf13f77f2004-11-12 16:03:48 +00003866 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003867 call_tests++;
3868 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003869 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003870 des_int(n_type, type, 2);
3871 des_xmlElementContentPtr(n_content, content, 3);
3872 xmlResetLastError();
3873 if (mem_base != xmlMemBlocks()) {
3874 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3875 xmlMemBlocks() - mem_base);
3876 test_ret++;
3877 printf(" %d", n_ctx);
3878 printf(" %d", n_name);
3879 printf(" %d", n_type);
3880 printf(" %d", n_content);
3881 printf("\n");
3882 }
3883 }
3884 }
3885 }
3886 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003887 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003888
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003889 return(test_ret);
3890}
3891
3892
3893static int
3894test_xmlSAX2EndDocument(void) {
3895 int test_ret = 0;
3896
3897 int mem_base;
3898 void * ctx; /* the user data (XML parser context) */
3899 int n_ctx;
3900
3901 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3902 mem_base = xmlMemBlocks();
3903 ctx = gen_void_ptr(n_ctx, 0);
3904
3905 xmlSAX2EndDocument(ctx);
3906 call_tests++;
3907 des_void_ptr(n_ctx, ctx, 0);
3908 xmlResetLastError();
3909 if (mem_base != xmlMemBlocks()) {
3910 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3911 xmlMemBlocks() - mem_base);
3912 test_ret++;
3913 printf(" %d", n_ctx);
3914 printf("\n");
3915 }
3916 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003917 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003918
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003919 return(test_ret);
3920}
3921
3922
3923static int
3924test_xmlSAX2EndElement(void) {
3925 int test_ret = 0;
3926
William M. Brack21e4ef22005-01-02 09:53:13 +00003927#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003928#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003929 int mem_base;
3930 void * ctx; /* the user data (XML parser context) */
3931 int n_ctx;
3932 xmlChar * name; /* The element name */
3933 int n_name;
3934
3935 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3936 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3937 mem_base = xmlMemBlocks();
3938 ctx = gen_void_ptr(n_ctx, 0);
3939 name = gen_const_xmlChar_ptr(n_name, 1);
3940
William M. Brackf13f77f2004-11-12 16:03:48 +00003941 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003942 call_tests++;
3943 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003944 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003945 xmlResetLastError();
3946 if (mem_base != xmlMemBlocks()) {
3947 printf("Leak of %d blocks found in xmlSAX2EndElement",
3948 xmlMemBlocks() - mem_base);
3949 test_ret++;
3950 printf(" %d", n_ctx);
3951 printf(" %d", n_name);
3952 printf("\n");
3953 }
3954 }
3955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003956 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003957#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003958#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003959
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003960 return(test_ret);
3961}
3962
3963
3964static int
3965test_xmlSAX2EndElementNs(void) {
3966 int test_ret = 0;
3967
3968 int mem_base;
3969 void * ctx; /* the user data (XML parser context) */
3970 int n_ctx;
3971 xmlChar * localname; /* the local name of the element */
3972 int n_localname;
3973 xmlChar * prefix; /* the element namespace prefix if available */
3974 int n_prefix;
3975 xmlChar * URI; /* the element namespace name if available */
3976 int n_URI;
3977
3978 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3979 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3980 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3981 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3982 mem_base = xmlMemBlocks();
3983 ctx = gen_void_ptr(n_ctx, 0);
3984 localname = gen_const_xmlChar_ptr(n_localname, 1);
3985 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3986 URI = gen_const_xmlChar_ptr(n_URI, 3);
3987
William M. Brackf13f77f2004-11-12 16:03:48 +00003988 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003989 call_tests++;
3990 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003991 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3992 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3993 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003994 xmlResetLastError();
3995 if (mem_base != xmlMemBlocks()) {
3996 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3997 xmlMemBlocks() - mem_base);
3998 test_ret++;
3999 printf(" %d", n_ctx);
4000 printf(" %d", n_localname);
4001 printf(" %d", n_prefix);
4002 printf(" %d", n_URI);
4003 printf("\n");
4004 }
4005 }
4006 }
4007 }
4008 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004009 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004010
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004011 return(test_ret);
4012}
4013
4014
4015static int
4016test_xmlSAX2EntityDecl(void) {
4017 int test_ret = 0;
4018
4019 int mem_base;
4020 void * ctx; /* the user data (XML parser context) */
4021 int n_ctx;
4022 xmlChar * name; /* the entity name */
4023 int n_name;
4024 int type; /* the entity type */
4025 int n_type;
4026 xmlChar * publicId; /* The public ID of the entity */
4027 int n_publicId;
4028 xmlChar * systemId; /* The system ID of the entity */
4029 int n_systemId;
4030 xmlChar * content; /* the entity value (without processing). */
4031 int n_content;
4032
4033 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4034 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4035 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4036 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4037 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4038 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4039 mem_base = xmlMemBlocks();
4040 ctx = gen_void_ptr(n_ctx, 0);
4041 name = gen_const_xmlChar_ptr(n_name, 1);
4042 type = gen_int(n_type, 2);
4043 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4044 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4045 content = gen_xmlChar_ptr(n_content, 5);
4046
William M. Brackf13f77f2004-11-12 16:03:48 +00004047 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004048 call_tests++;
4049 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004050 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004051 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004052 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4053 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004054 des_xmlChar_ptr(n_content, content, 5);
4055 xmlResetLastError();
4056 if (mem_base != xmlMemBlocks()) {
4057 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4058 xmlMemBlocks() - mem_base);
4059 test_ret++;
4060 printf(" %d", n_ctx);
4061 printf(" %d", n_name);
4062 printf(" %d", n_type);
4063 printf(" %d", n_publicId);
4064 printf(" %d", n_systemId);
4065 printf(" %d", n_content);
4066 printf("\n");
4067 }
4068 }
4069 }
4070 }
4071 }
4072 }
4073 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004074 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004075
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004076 return(test_ret);
4077}
4078
4079
4080static int
4081test_xmlSAX2ExternalSubset(void) {
4082 int test_ret = 0;
4083
4084 int mem_base;
4085 void * ctx; /* the user data (XML parser context) */
4086 int n_ctx;
4087 xmlChar * name; /* the root element name */
4088 int n_name;
4089 xmlChar * ExternalID; /* the external ID */
4090 int n_ExternalID;
4091 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4092 int n_SystemID;
4093
4094 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4095 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4096 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4097 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4098 mem_base = xmlMemBlocks();
4099 ctx = gen_void_ptr(n_ctx, 0);
4100 name = gen_const_xmlChar_ptr(n_name, 1);
4101 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4102 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4103
William M. Brackf13f77f2004-11-12 16:03:48 +00004104 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004105 call_tests++;
4106 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004107 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4108 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4109 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004110 xmlResetLastError();
4111 if (mem_base != xmlMemBlocks()) {
4112 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4113 xmlMemBlocks() - mem_base);
4114 test_ret++;
4115 printf(" %d", n_ctx);
4116 printf(" %d", n_name);
4117 printf(" %d", n_ExternalID);
4118 printf(" %d", n_SystemID);
4119 printf("\n");
4120 }
4121 }
4122 }
4123 }
4124 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004125 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004126
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004127 return(test_ret);
4128}
4129
4130
4131static int
4132test_xmlSAX2GetColumnNumber(void) {
4133 int test_ret = 0;
4134
4135 int mem_base;
4136 int ret_val;
4137 void * ctx; /* the user data (XML parser context) */
4138 int n_ctx;
4139
4140 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4141 mem_base = xmlMemBlocks();
4142 ctx = gen_void_ptr(n_ctx, 0);
4143
4144 ret_val = xmlSAX2GetColumnNumber(ctx);
4145 desret_int(ret_val);
4146 call_tests++;
4147 des_void_ptr(n_ctx, ctx, 0);
4148 xmlResetLastError();
4149 if (mem_base != xmlMemBlocks()) {
4150 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4151 xmlMemBlocks() - mem_base);
4152 test_ret++;
4153 printf(" %d", n_ctx);
4154 printf("\n");
4155 }
4156 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004158
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004159 return(test_ret);
4160}
4161
4162
4163static int
4164test_xmlSAX2GetEntity(void) {
4165 int test_ret = 0;
4166
4167 int mem_base;
4168 xmlEntityPtr ret_val;
4169 void * ctx; /* the user data (XML parser context) */
4170 int n_ctx;
4171 xmlChar * name; /* The entity name */
4172 int n_name;
4173
4174 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4175 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4176 mem_base = xmlMemBlocks();
4177 ctx = gen_void_ptr(n_ctx, 0);
4178 name = gen_const_xmlChar_ptr(n_name, 1);
4179
William M. Brackf13f77f2004-11-12 16:03:48 +00004180 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004181 desret_xmlEntityPtr(ret_val);
4182 call_tests++;
4183 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004184 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004185 xmlResetLastError();
4186 if (mem_base != xmlMemBlocks()) {
4187 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4188 xmlMemBlocks() - mem_base);
4189 test_ret++;
4190 printf(" %d", n_ctx);
4191 printf(" %d", n_name);
4192 printf("\n");
4193 }
4194 }
4195 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004197
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004198 return(test_ret);
4199}
4200
4201
4202static int
4203test_xmlSAX2GetLineNumber(void) {
4204 int test_ret = 0;
4205
4206 int mem_base;
4207 int ret_val;
4208 void * ctx; /* the user data (XML parser context) */
4209 int n_ctx;
4210
4211 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4212 mem_base = xmlMemBlocks();
4213 ctx = gen_void_ptr(n_ctx, 0);
4214
4215 ret_val = xmlSAX2GetLineNumber(ctx);
4216 desret_int(ret_val);
4217 call_tests++;
4218 des_void_ptr(n_ctx, ctx, 0);
4219 xmlResetLastError();
4220 if (mem_base != xmlMemBlocks()) {
4221 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4222 xmlMemBlocks() - mem_base);
4223 test_ret++;
4224 printf(" %d", n_ctx);
4225 printf("\n");
4226 }
4227 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004228 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004229
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004230 return(test_ret);
4231}
4232
4233
4234static int
4235test_xmlSAX2GetParameterEntity(void) {
4236 int test_ret = 0;
4237
4238 int mem_base;
4239 xmlEntityPtr ret_val;
4240 void * ctx; /* the user data (XML parser context) */
4241 int n_ctx;
4242 xmlChar * name; /* The entity name */
4243 int n_name;
4244
4245 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4246 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4247 mem_base = xmlMemBlocks();
4248 ctx = gen_void_ptr(n_ctx, 0);
4249 name = gen_const_xmlChar_ptr(n_name, 1);
4250
William M. Brackf13f77f2004-11-12 16:03:48 +00004251 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004252 desret_xmlEntityPtr(ret_val);
4253 call_tests++;
4254 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004255 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004256 xmlResetLastError();
4257 if (mem_base != xmlMemBlocks()) {
4258 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4259 xmlMemBlocks() - mem_base);
4260 test_ret++;
4261 printf(" %d", n_ctx);
4262 printf(" %d", n_name);
4263 printf("\n");
4264 }
4265 }
4266 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004267 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004268
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004269 return(test_ret);
4270}
4271
4272
4273static int
4274test_xmlSAX2GetPublicId(void) {
4275 int test_ret = 0;
4276
4277 int mem_base;
4278 const xmlChar * ret_val;
4279 void * ctx; /* the user data (XML parser context) */
4280 int n_ctx;
4281
4282 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4283 mem_base = xmlMemBlocks();
4284 ctx = gen_void_ptr(n_ctx, 0);
4285
4286 ret_val = xmlSAX2GetPublicId(ctx);
4287 desret_const_xmlChar_ptr(ret_val);
4288 call_tests++;
4289 des_void_ptr(n_ctx, ctx, 0);
4290 xmlResetLastError();
4291 if (mem_base != xmlMemBlocks()) {
4292 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4293 xmlMemBlocks() - mem_base);
4294 test_ret++;
4295 printf(" %d", n_ctx);
4296 printf("\n");
4297 }
4298 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004300
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004301 return(test_ret);
4302}
4303
4304
4305static int
4306test_xmlSAX2GetSystemId(void) {
4307 int test_ret = 0;
4308
4309 int mem_base;
4310 const xmlChar * ret_val;
4311 void * ctx; /* the user data (XML parser context) */
4312 int n_ctx;
4313
4314 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4315 mem_base = xmlMemBlocks();
4316 ctx = gen_void_ptr(n_ctx, 0);
4317
4318 ret_val = xmlSAX2GetSystemId(ctx);
4319 desret_const_xmlChar_ptr(ret_val);
4320 call_tests++;
4321 des_void_ptr(n_ctx, ctx, 0);
4322 xmlResetLastError();
4323 if (mem_base != xmlMemBlocks()) {
4324 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4325 xmlMemBlocks() - mem_base);
4326 test_ret++;
4327 printf(" %d", n_ctx);
4328 printf("\n");
4329 }
4330 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004332
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004333 return(test_ret);
4334}
4335
4336
4337static int
4338test_xmlSAX2HasExternalSubset(void) {
4339 int test_ret = 0;
4340
4341 int mem_base;
4342 int ret_val;
4343 void * ctx; /* the user data (XML parser context) */
4344 int n_ctx;
4345
4346 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4347 mem_base = xmlMemBlocks();
4348 ctx = gen_void_ptr(n_ctx, 0);
4349
4350 ret_val = xmlSAX2HasExternalSubset(ctx);
4351 desret_int(ret_val);
4352 call_tests++;
4353 des_void_ptr(n_ctx, ctx, 0);
4354 xmlResetLastError();
4355 if (mem_base != xmlMemBlocks()) {
4356 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4357 xmlMemBlocks() - mem_base);
4358 test_ret++;
4359 printf(" %d", n_ctx);
4360 printf("\n");
4361 }
4362 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004364
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004365 return(test_ret);
4366}
4367
4368
4369static int
4370test_xmlSAX2HasInternalSubset(void) {
4371 int test_ret = 0;
4372
4373 int mem_base;
4374 int ret_val;
4375 void * ctx; /* the user data (XML parser context) */
4376 int n_ctx;
4377
4378 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4379 mem_base = xmlMemBlocks();
4380 ctx = gen_void_ptr(n_ctx, 0);
4381
4382 ret_val = xmlSAX2HasInternalSubset(ctx);
4383 desret_int(ret_val);
4384 call_tests++;
4385 des_void_ptr(n_ctx, ctx, 0);
4386 xmlResetLastError();
4387 if (mem_base != xmlMemBlocks()) {
4388 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4389 xmlMemBlocks() - mem_base);
4390 test_ret++;
4391 printf(" %d", n_ctx);
4392 printf("\n");
4393 }
4394 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004396
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004397 return(test_ret);
4398}
4399
4400
4401static int
4402test_xmlSAX2IgnorableWhitespace(void) {
4403 int test_ret = 0;
4404
4405 int mem_base;
4406 void * ctx; /* the user data (XML parser context) */
4407 int n_ctx;
4408 xmlChar * ch; /* a xmlChar string */
4409 int n_ch;
4410 int len; /* the number of xmlChar */
4411 int n_len;
4412
4413 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4414 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4415 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4416 mem_base = xmlMemBlocks();
4417 ctx = gen_void_ptr(n_ctx, 0);
4418 ch = gen_const_xmlChar_ptr(n_ch, 1);
4419 len = gen_int(n_len, 2);
4420
William M. Brackf13f77f2004-11-12 16:03:48 +00004421 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004422 call_tests++;
4423 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004424 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004425 des_int(n_len, len, 2);
4426 xmlResetLastError();
4427 if (mem_base != xmlMemBlocks()) {
4428 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4429 xmlMemBlocks() - mem_base);
4430 test_ret++;
4431 printf(" %d", n_ctx);
4432 printf(" %d", n_ch);
4433 printf(" %d", n_len);
4434 printf("\n");
4435 }
4436 }
4437 }
4438 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004440
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004441 return(test_ret);
4442}
4443
4444
4445#define gen_nb_xmlSAXHandler_ptr 1
4446static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4447 return(NULL);
4448}
4449static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4450}
4451
4452static int
4453test_xmlSAX2InitDefaultSAXHandler(void) {
4454 int test_ret = 0;
4455
4456 int mem_base;
4457 xmlSAXHandler * hdlr; /* the SAX handler */
4458 int n_hdlr;
4459 int warning; /* flag if non-zero sets the handler warning procedure */
4460 int n_warning;
4461
4462 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4463 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4464 mem_base = xmlMemBlocks();
4465 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4466 warning = gen_int(n_warning, 1);
4467
4468 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4469 call_tests++;
4470 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4471 des_int(n_warning, warning, 1);
4472 xmlResetLastError();
4473 if (mem_base != xmlMemBlocks()) {
4474 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4475 xmlMemBlocks() - mem_base);
4476 test_ret++;
4477 printf(" %d", n_hdlr);
4478 printf(" %d", n_warning);
4479 printf("\n");
4480 }
4481 }
4482 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004484
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004485 return(test_ret);
4486}
4487
4488
4489static int
4490test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4491 int test_ret = 0;
4492
William M. Brack21e4ef22005-01-02 09:53:13 +00004493#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004494 int mem_base;
4495 xmlSAXHandler * hdlr; /* the SAX handler */
4496 int n_hdlr;
4497
4498 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4499 mem_base = xmlMemBlocks();
4500 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4501
4502 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4503 call_tests++;
4504 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4505 xmlResetLastError();
4506 if (mem_base != xmlMemBlocks()) {
4507 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4508 xmlMemBlocks() - mem_base);
4509 test_ret++;
4510 printf(" %d", n_hdlr);
4511 printf("\n");
4512 }
4513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004514 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004515#endif
4516
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004517 return(test_ret);
4518}
4519
4520
4521static int
4522test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4523 int test_ret = 0;
4524
William M. Brack21e4ef22005-01-02 09:53:13 +00004525#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526 int mem_base;
4527 xmlSAXHandler * hdlr; /* the SAX handler */
4528 int n_hdlr;
4529
4530 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4531 mem_base = xmlMemBlocks();
4532 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4533
4534 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4535 call_tests++;
4536 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4537 xmlResetLastError();
4538 if (mem_base != xmlMemBlocks()) {
4539 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4540 xmlMemBlocks() - mem_base);
4541 test_ret++;
4542 printf(" %d", n_hdlr);
4543 printf("\n");
4544 }
4545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004546 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004547#endif
4548
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004549 return(test_ret);
4550}
4551
4552
4553static int
4554test_xmlSAX2InternalSubset(void) {
4555 int test_ret = 0;
4556
4557 int mem_base;
4558 void * ctx; /* the user data (XML parser context) */
4559 int n_ctx;
4560 xmlChar * name; /* the root element name */
4561 int n_name;
4562 xmlChar * ExternalID; /* the external ID */
4563 int n_ExternalID;
4564 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4565 int n_SystemID;
4566
4567 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4568 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4569 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4570 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4571 mem_base = xmlMemBlocks();
4572 ctx = gen_void_ptr(n_ctx, 0);
4573 name = gen_const_xmlChar_ptr(n_name, 1);
4574 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4575 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4576
William M. Brackf13f77f2004-11-12 16:03:48 +00004577 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004578 call_tests++;
4579 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004580 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4581 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4582 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004583 xmlResetLastError();
4584 if (mem_base != xmlMemBlocks()) {
4585 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4586 xmlMemBlocks() - mem_base);
4587 test_ret++;
4588 printf(" %d", n_ctx);
4589 printf(" %d", n_name);
4590 printf(" %d", n_ExternalID);
4591 printf(" %d", n_SystemID);
4592 printf("\n");
4593 }
4594 }
4595 }
4596 }
4597 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004599
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004600 return(test_ret);
4601}
4602
4603
4604static int
4605test_xmlSAX2IsStandalone(void) {
4606 int test_ret = 0;
4607
4608 int mem_base;
4609 int ret_val;
4610 void * ctx; /* the user data (XML parser context) */
4611 int n_ctx;
4612
4613 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4614 mem_base = xmlMemBlocks();
4615 ctx = gen_void_ptr(n_ctx, 0);
4616
4617 ret_val = xmlSAX2IsStandalone(ctx);
4618 desret_int(ret_val);
4619 call_tests++;
4620 des_void_ptr(n_ctx, ctx, 0);
4621 xmlResetLastError();
4622 if (mem_base != xmlMemBlocks()) {
4623 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4624 xmlMemBlocks() - mem_base);
4625 test_ret++;
4626 printf(" %d", n_ctx);
4627 printf("\n");
4628 }
4629 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004630 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004631
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004632 return(test_ret);
4633}
4634
4635
4636static int
4637test_xmlSAX2NotationDecl(void) {
4638 int test_ret = 0;
4639
4640 int mem_base;
4641 void * ctx; /* the user data (XML parser context) */
4642 int n_ctx;
4643 xmlChar * name; /* The name of the notation */
4644 int n_name;
4645 xmlChar * publicId; /* The public ID of the entity */
4646 int n_publicId;
4647 xmlChar * systemId; /* The system ID of the entity */
4648 int n_systemId;
4649
4650 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4651 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4652 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4653 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4654 mem_base = xmlMemBlocks();
4655 ctx = gen_void_ptr(n_ctx, 0);
4656 name = gen_const_xmlChar_ptr(n_name, 1);
4657 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4658 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4659
William M. Brackf13f77f2004-11-12 16:03:48 +00004660 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004661 call_tests++;
4662 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004663 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4664 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4665 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004666 xmlResetLastError();
4667 if (mem_base != xmlMemBlocks()) {
4668 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4669 xmlMemBlocks() - mem_base);
4670 test_ret++;
4671 printf(" %d", n_ctx);
4672 printf(" %d", n_name);
4673 printf(" %d", n_publicId);
4674 printf(" %d", n_systemId);
4675 printf("\n");
4676 }
4677 }
4678 }
4679 }
4680 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004681 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004682
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004683 return(test_ret);
4684}
4685
4686
4687static int
4688test_xmlSAX2ProcessingInstruction(void) {
4689 int test_ret = 0;
4690
4691 int mem_base;
4692 void * ctx; /* the user data (XML parser context) */
4693 int n_ctx;
4694 xmlChar * target; /* the target name */
4695 int n_target;
4696 xmlChar * data; /* the PI data's */
4697 int n_data;
4698
4699 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4700 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4701 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4702 mem_base = xmlMemBlocks();
4703 ctx = gen_void_ptr(n_ctx, 0);
4704 target = gen_const_xmlChar_ptr(n_target, 1);
4705 data = gen_const_xmlChar_ptr(n_data, 2);
4706
William M. Brackf13f77f2004-11-12 16:03:48 +00004707 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004708 call_tests++;
4709 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004710 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4711 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004712 xmlResetLastError();
4713 if (mem_base != xmlMemBlocks()) {
4714 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4715 xmlMemBlocks() - mem_base);
4716 test_ret++;
4717 printf(" %d", n_ctx);
4718 printf(" %d", n_target);
4719 printf(" %d", n_data);
4720 printf("\n");
4721 }
4722 }
4723 }
4724 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004726
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004727 return(test_ret);
4728}
4729
4730
4731static int
4732test_xmlSAX2Reference(void) {
4733 int test_ret = 0;
4734
4735 int mem_base;
4736 void * ctx; /* the user data (XML parser context) */
4737 int n_ctx;
4738 xmlChar * name; /* The entity name */
4739 int n_name;
4740
4741 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4743 mem_base = xmlMemBlocks();
4744 ctx = gen_void_ptr(n_ctx, 0);
4745 name = gen_const_xmlChar_ptr(n_name, 1);
4746
William M. Brackf13f77f2004-11-12 16:03:48 +00004747 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004748 call_tests++;
4749 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004750 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004751 xmlResetLastError();
4752 if (mem_base != xmlMemBlocks()) {
4753 printf("Leak of %d blocks found in xmlSAX2Reference",
4754 xmlMemBlocks() - mem_base);
4755 test_ret++;
4756 printf(" %d", n_ctx);
4757 printf(" %d", n_name);
4758 printf("\n");
4759 }
4760 }
4761 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004762 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004763
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004764 return(test_ret);
4765}
4766
4767
4768static int
4769test_xmlSAX2ResolveEntity(void) {
4770 int test_ret = 0;
4771
4772 int mem_base;
4773 xmlParserInputPtr ret_val;
4774 void * ctx; /* the user data (XML parser context) */
4775 int n_ctx;
4776 xmlChar * publicId; /* The public ID of the entity */
4777 int n_publicId;
4778 xmlChar * systemId; /* The system ID of the entity */
4779 int n_systemId;
4780
4781 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4782 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4783 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4784 mem_base = xmlMemBlocks();
4785 ctx = gen_void_ptr(n_ctx, 0);
4786 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4787 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4788
William M. Brackf13f77f2004-11-12 16:03:48 +00004789 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004790 desret_xmlParserInputPtr(ret_val);
4791 call_tests++;
4792 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004793 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4794 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004795 xmlResetLastError();
4796 if (mem_base != xmlMemBlocks()) {
4797 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4798 xmlMemBlocks() - mem_base);
4799 test_ret++;
4800 printf(" %d", n_ctx);
4801 printf(" %d", n_publicId);
4802 printf(" %d", n_systemId);
4803 printf("\n");
4804 }
4805 }
4806 }
4807 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004808 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004809
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004810 return(test_ret);
4811}
4812
4813
4814#define gen_nb_xmlSAXLocatorPtr 1
4815static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4816 return(NULL);
4817}
4818static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4819}
4820
4821static int
4822test_xmlSAX2SetDocumentLocator(void) {
4823 int test_ret = 0;
4824
4825 int mem_base;
4826 void * ctx; /* the user data (XML parser context) */
4827 int n_ctx;
4828 xmlSAXLocatorPtr loc; /* A SAX Locator */
4829 int n_loc;
4830
4831 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4832 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4833 mem_base = xmlMemBlocks();
4834 ctx = gen_void_ptr(n_ctx, 0);
4835 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4836
4837 xmlSAX2SetDocumentLocator(ctx, loc);
4838 call_tests++;
4839 des_void_ptr(n_ctx, ctx, 0);
4840 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4841 xmlResetLastError();
4842 if (mem_base != xmlMemBlocks()) {
4843 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4844 xmlMemBlocks() - mem_base);
4845 test_ret++;
4846 printf(" %d", n_ctx);
4847 printf(" %d", n_loc);
4848 printf("\n");
4849 }
4850 }
4851 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004852 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004853
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004854 return(test_ret);
4855}
4856
4857
4858static int
4859test_xmlSAX2StartDocument(void) {
4860 int test_ret = 0;
4861
4862 int mem_base;
4863 void * ctx; /* the user data (XML parser context) */
4864 int n_ctx;
4865
4866 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4867 mem_base = xmlMemBlocks();
4868 ctx = gen_void_ptr(n_ctx, 0);
4869
4870 xmlSAX2StartDocument(ctx);
4871 call_tests++;
4872 des_void_ptr(n_ctx, ctx, 0);
4873 xmlResetLastError();
4874 if (mem_base != xmlMemBlocks()) {
4875 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4876 xmlMemBlocks() - mem_base);
4877 test_ret++;
4878 printf(" %d", n_ctx);
4879 printf("\n");
4880 }
4881 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004882 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004883
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004884 return(test_ret);
4885}
4886
4887
4888static int
4889test_xmlSAX2StartElement(void) {
4890 int test_ret = 0;
4891
William M. Brack21e4ef22005-01-02 09:53:13 +00004892#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004893#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004894 int mem_base;
4895 void * ctx; /* the user data (XML parser context) */
4896 int n_ctx;
4897 xmlChar * fullname; /* The element name, including namespace prefix */
4898 int n_fullname;
4899 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4900 int n_atts;
4901
4902 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4903 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4904 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4905 mem_base = xmlMemBlocks();
4906 ctx = gen_void_ptr(n_ctx, 0);
4907 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4908 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4909
William M. Brackf13f77f2004-11-12 16:03:48 +00004910 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004911 call_tests++;
4912 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004913 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4914 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004915 xmlResetLastError();
4916 if (mem_base != xmlMemBlocks()) {
4917 printf("Leak of %d blocks found in xmlSAX2StartElement",
4918 xmlMemBlocks() - mem_base);
4919 test_ret++;
4920 printf(" %d", n_ctx);
4921 printf(" %d", n_fullname);
4922 printf(" %d", n_atts);
4923 printf("\n");
4924 }
4925 }
4926 }
4927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004928 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004929#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004930#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004932 return(test_ret);
4933}
4934
4935
4936static int
4937test_xmlSAX2StartElementNs(void) {
4938 int test_ret = 0;
4939
4940 int mem_base;
4941 void * ctx; /* the user data (XML parser context) */
4942 int n_ctx;
4943 xmlChar * localname; /* the local name of the element */
4944 int n_localname;
4945 xmlChar * prefix; /* the element namespace prefix if available */
4946 int n_prefix;
4947 xmlChar * URI; /* the element namespace name if available */
4948 int n_URI;
4949 int nb_namespaces; /* number of namespace definitions on that node */
4950 int n_nb_namespaces;
4951 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4952 int n_namespaces;
4953 int nb_attributes; /* the number of attributes on that node */
4954 int n_nb_attributes;
4955 int nb_defaulted; /* the number of defaulted attributes. */
4956 int n_nb_defaulted;
4957 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4958 int n_attributes;
4959
4960 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4961 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4962 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4963 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4964 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4965 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4966 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4967 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4968 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4969 mem_base = xmlMemBlocks();
4970 ctx = gen_void_ptr(n_ctx, 0);
4971 localname = gen_const_xmlChar_ptr(n_localname, 1);
4972 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4973 URI = gen_const_xmlChar_ptr(n_URI, 3);
4974 nb_namespaces = gen_int(n_nb_namespaces, 4);
4975 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4976 nb_attributes = gen_int(n_nb_attributes, 6);
4977 nb_defaulted = gen_int(n_nb_defaulted, 7);
4978 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4979
William M. Brackf13f77f2004-11-12 16:03:48 +00004980 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004981 call_tests++;
4982 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004983 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4984 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4985 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004986 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004987 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004988 des_int(n_nb_attributes, nb_attributes, 6);
4989 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004990 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004991 xmlResetLastError();
4992 if (mem_base != xmlMemBlocks()) {
4993 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4994 xmlMemBlocks() - mem_base);
4995 test_ret++;
4996 printf(" %d", n_ctx);
4997 printf(" %d", n_localname);
4998 printf(" %d", n_prefix);
4999 printf(" %d", n_URI);
5000 printf(" %d", n_nb_namespaces);
5001 printf(" %d", n_namespaces);
5002 printf(" %d", n_nb_attributes);
5003 printf(" %d", n_nb_defaulted);
5004 printf(" %d", n_attributes);
5005 printf("\n");
5006 }
5007 }
5008 }
5009 }
5010 }
5011 }
5012 }
5013 }
5014 }
5015 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005016 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005017
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005018 return(test_ret);
5019}
5020
5021
5022static int
5023test_xmlSAX2UnparsedEntityDecl(void) {
5024 int test_ret = 0;
5025
5026 int mem_base;
5027 void * ctx; /* the user data (XML parser context) */
5028 int n_ctx;
5029 xmlChar * name; /* The name of the entity */
5030 int n_name;
5031 xmlChar * publicId; /* The public ID of the entity */
5032 int n_publicId;
5033 xmlChar * systemId; /* The system ID of the entity */
5034 int n_systemId;
5035 xmlChar * notationName; /* the name of the notation */
5036 int n_notationName;
5037
5038 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5039 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5040 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5041 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5042 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5043 mem_base = xmlMemBlocks();
5044 ctx = gen_void_ptr(n_ctx, 0);
5045 name = gen_const_xmlChar_ptr(n_name, 1);
5046 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5047 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5048 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5049
William M. Brackf13f77f2004-11-12 16:03:48 +00005050 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005051 call_tests++;
5052 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005053 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5054 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5055 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5056 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005057 xmlResetLastError();
5058 if (mem_base != xmlMemBlocks()) {
5059 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5060 xmlMemBlocks() - mem_base);
5061 test_ret++;
5062 printf(" %d", n_ctx);
5063 printf(" %d", n_name);
5064 printf(" %d", n_publicId);
5065 printf(" %d", n_systemId);
5066 printf(" %d", n_notationName);
5067 printf("\n");
5068 }
5069 }
5070 }
5071 }
5072 }
5073 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005074 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005075
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005076 return(test_ret);
5077}
5078
5079
5080static int
5081test_xmlSAXDefaultVersion(void) {
5082 int test_ret = 0;
5083
William M. Brack21e4ef22005-01-02 09:53:13 +00005084#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005085#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005086 int mem_base;
5087 int ret_val;
5088 int version; /* the version, 1 or 2 */
5089 int n_version;
5090
5091 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5092 mem_base = xmlMemBlocks();
5093 version = gen_int(n_version, 0);
5094
5095 ret_val = xmlSAXDefaultVersion(version);
5096 desret_int(ret_val);
5097 call_tests++;
5098 des_int(n_version, version, 0);
5099 xmlResetLastError();
5100 if (mem_base != xmlMemBlocks()) {
5101 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5102 xmlMemBlocks() - mem_base);
5103 test_ret++;
5104 printf(" %d", n_version);
5105 printf("\n");
5106 }
5107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005108 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005109#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005110#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005111
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005112 return(test_ret);
5113}
5114
5115
5116static int
5117test_xmlSAXVersion(void) {
5118 int test_ret = 0;
5119
5120 int mem_base;
5121 int ret_val;
5122 xmlSAXHandler * hdlr; /* the SAX handler */
5123 int n_hdlr;
5124 int version; /* the version, 1 or 2 */
5125 int n_version;
5126
5127 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5128 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5129 mem_base = xmlMemBlocks();
5130 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5131 version = gen_int(n_version, 1);
5132
5133 ret_val = xmlSAXVersion(hdlr, version);
5134 desret_int(ret_val);
5135 call_tests++;
5136 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5137 des_int(n_version, version, 1);
5138 xmlResetLastError();
5139 if (mem_base != xmlMemBlocks()) {
5140 printf("Leak of %d blocks found in xmlSAXVersion",
5141 xmlMemBlocks() - mem_base);
5142 test_ret++;
5143 printf(" %d", n_hdlr);
5144 printf(" %d", n_version);
5145 printf("\n");
5146 }
5147 }
5148 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005149 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005150
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005151 return(test_ret);
5152}
5153
5154static int
5155test_SAX2(void) {
5156 int test_ret = 0;
5157
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005158 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005159 test_ret += test_docbDefaultSAXHandlerInit();
5160 test_ret += test_htmlDefaultSAXHandlerInit();
5161 test_ret += test_xmlDefaultSAXHandlerInit();
5162 test_ret += test_xmlSAX2AttributeDecl();
5163 test_ret += test_xmlSAX2CDataBlock();
5164 test_ret += test_xmlSAX2Characters();
5165 test_ret += test_xmlSAX2Comment();
5166 test_ret += test_xmlSAX2ElementDecl();
5167 test_ret += test_xmlSAX2EndDocument();
5168 test_ret += test_xmlSAX2EndElement();
5169 test_ret += test_xmlSAX2EndElementNs();
5170 test_ret += test_xmlSAX2EntityDecl();
5171 test_ret += test_xmlSAX2ExternalSubset();
5172 test_ret += test_xmlSAX2GetColumnNumber();
5173 test_ret += test_xmlSAX2GetEntity();
5174 test_ret += test_xmlSAX2GetLineNumber();
5175 test_ret += test_xmlSAX2GetParameterEntity();
5176 test_ret += test_xmlSAX2GetPublicId();
5177 test_ret += test_xmlSAX2GetSystemId();
5178 test_ret += test_xmlSAX2HasExternalSubset();
5179 test_ret += test_xmlSAX2HasInternalSubset();
5180 test_ret += test_xmlSAX2IgnorableWhitespace();
5181 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5182 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5183 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5184 test_ret += test_xmlSAX2InternalSubset();
5185 test_ret += test_xmlSAX2IsStandalone();
5186 test_ret += test_xmlSAX2NotationDecl();
5187 test_ret += test_xmlSAX2ProcessingInstruction();
5188 test_ret += test_xmlSAX2Reference();
5189 test_ret += test_xmlSAX2ResolveEntity();
5190 test_ret += test_xmlSAX2SetDocumentLocator();
5191 test_ret += test_xmlSAX2StartDocument();
5192 test_ret += test_xmlSAX2StartElement();
5193 test_ret += test_xmlSAX2StartElementNs();
5194 test_ret += test_xmlSAX2UnparsedEntityDecl();
5195 test_ret += test_xmlSAXDefaultVersion();
5196 test_ret += test_xmlSAXVersion();
5197
5198 if (test_ret != 0)
5199 printf("Module SAX2: %d errors\n", test_ret);
5200 return(test_ret);
5201}
5202
Daniel Veillarda82b1822004-11-08 16:24:57 +00005203static int
5204test_xmlC14NDocDumpMemory(void) {
5205 int test_ret = 0;
5206
William M. Brack21e4ef22005-01-02 09:53:13 +00005207#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005208 int mem_base;
5209 int ret_val;
5210 xmlDocPtr doc; /* the XML document for canonization */
5211 int n_doc;
5212 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5213 int n_nodes;
5214 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5215 int n_exclusive;
5216 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) */
5217 int n_inclusive_ns_prefixes;
5218 int with_comments; /* include comments in the result (!=0) or not (==0) */
5219 int n_with_comments;
5220 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 */
5221 int n_doc_txt_ptr;
5222
5223 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5224 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5225 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5226 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5227 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5228 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5229 mem_base = xmlMemBlocks();
5230 doc = gen_xmlDocPtr(n_doc, 0);
5231 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5232 exclusive = gen_int(n_exclusive, 2);
5233 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5234 with_comments = gen_int(n_with_comments, 4);
5235 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5236
5237 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5238 desret_int(ret_val);
5239 call_tests++;
5240 des_xmlDocPtr(n_doc, doc, 0);
5241 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5242 des_int(n_exclusive, exclusive, 2);
5243 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5244 des_int(n_with_comments, with_comments, 4);
5245 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5246 xmlResetLastError();
5247 if (mem_base != xmlMemBlocks()) {
5248 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5249 xmlMemBlocks() - mem_base);
5250 test_ret++;
5251 printf(" %d", n_doc);
5252 printf(" %d", n_nodes);
5253 printf(" %d", n_exclusive);
5254 printf(" %d", n_inclusive_ns_prefixes);
5255 printf(" %d", n_with_comments);
5256 printf(" %d", n_doc_txt_ptr);
5257 printf("\n");
5258 }
5259 }
5260 }
5261 }
5262 }
5263 }
5264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005265 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005266#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005267
Daniel Veillarda82b1822004-11-08 16:24:57 +00005268 return(test_ret);
5269}
5270
5271
5272static int
5273test_xmlC14NDocSave(void) {
5274 int test_ret = 0;
5275
William M. Brack21e4ef22005-01-02 09:53:13 +00005276#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005277 int mem_base;
5278 int ret_val;
5279 xmlDocPtr doc; /* the XML document for canonization */
5280 int n_doc;
5281 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5282 int n_nodes;
5283 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5284 int n_exclusive;
5285 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) */
5286 int n_inclusive_ns_prefixes;
5287 int with_comments; /* include comments in the result (!=0) or not (==0) */
5288 int n_with_comments;
5289 const char * filename; /* the filename to store canonical XML image */
5290 int n_filename;
5291 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5292 int n_compression;
5293
5294 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5295 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5296 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5297 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5298 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5299 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5300 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5301 mem_base = xmlMemBlocks();
5302 doc = gen_xmlDocPtr(n_doc, 0);
5303 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5304 exclusive = gen_int(n_exclusive, 2);
5305 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5306 with_comments = gen_int(n_with_comments, 4);
5307 filename = gen_fileoutput(n_filename, 5);
5308 compression = gen_int(n_compression, 6);
5309
5310 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5311 desret_int(ret_val);
5312 call_tests++;
5313 des_xmlDocPtr(n_doc, doc, 0);
5314 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5315 des_int(n_exclusive, exclusive, 2);
5316 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5317 des_int(n_with_comments, with_comments, 4);
5318 des_fileoutput(n_filename, filename, 5);
5319 des_int(n_compression, compression, 6);
5320 xmlResetLastError();
5321 if (mem_base != xmlMemBlocks()) {
5322 printf("Leak of %d blocks found in xmlC14NDocSave",
5323 xmlMemBlocks() - mem_base);
5324 test_ret++;
5325 printf(" %d", n_doc);
5326 printf(" %d", n_nodes);
5327 printf(" %d", n_exclusive);
5328 printf(" %d", n_inclusive_ns_prefixes);
5329 printf(" %d", n_with_comments);
5330 printf(" %d", n_filename);
5331 printf(" %d", n_compression);
5332 printf("\n");
5333 }
5334 }
5335 }
5336 }
5337 }
5338 }
5339 }
5340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005341 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005342#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005343
Daniel Veillarda82b1822004-11-08 16:24:57 +00005344 return(test_ret);
5345}
5346
5347
5348static int
5349test_xmlC14NDocSaveTo(void) {
5350 int test_ret = 0;
5351
William M. Brack21e4ef22005-01-02 09:53:13 +00005352#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005353 int mem_base;
5354 int ret_val;
5355 xmlDocPtr doc; /* the XML document for canonization */
5356 int n_doc;
5357 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5358 int n_nodes;
5359 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5360 int n_exclusive;
5361 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) */
5362 int n_inclusive_ns_prefixes;
5363 int with_comments; /* include comments in the result (!=0) or not (==0) */
5364 int n_with_comments;
5365 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5366 int n_buf;
5367
5368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5369 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5370 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5371 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5372 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5373 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5374 mem_base = xmlMemBlocks();
5375 doc = gen_xmlDocPtr(n_doc, 0);
5376 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5377 exclusive = gen_int(n_exclusive, 2);
5378 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5379 with_comments = gen_int(n_with_comments, 4);
5380 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5381
5382 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5383 desret_int(ret_val);
5384 call_tests++;
5385 des_xmlDocPtr(n_doc, doc, 0);
5386 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5387 des_int(n_exclusive, exclusive, 2);
5388 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5389 des_int(n_with_comments, with_comments, 4);
5390 des_xmlOutputBufferPtr(n_buf, buf, 5);
5391 xmlResetLastError();
5392 if (mem_base != xmlMemBlocks()) {
5393 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5394 xmlMemBlocks() - mem_base);
5395 test_ret++;
5396 printf(" %d", n_doc);
5397 printf(" %d", n_nodes);
5398 printf(" %d", n_exclusive);
5399 printf(" %d", n_inclusive_ns_prefixes);
5400 printf(" %d", n_with_comments);
5401 printf(" %d", n_buf);
5402 printf("\n");
5403 }
5404 }
5405 }
5406 }
5407 }
5408 }
5409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005410 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005411#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005412
Daniel Veillarda82b1822004-11-08 16:24:57 +00005413 return(test_ret);
5414}
5415
5416
5417static int
5418test_xmlC14NExecute(void) {
5419 int test_ret = 0;
5420
5421
5422 /* missing type support */
5423 return(test_ret);
5424}
5425
5426static int
5427test_c14n(void) {
5428 int test_ret = 0;
5429
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005430 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005431 test_ret += test_xmlC14NDocDumpMemory();
5432 test_ret += test_xmlC14NDocSave();
5433 test_ret += test_xmlC14NDocSaveTo();
5434 test_ret += test_xmlC14NExecute();
5435
5436 if (test_ret != 0)
5437 printf("Module c14n: %d errors\n", test_ret);
5438 return(test_ret);
5439}
Daniel Veillarda521d282004-11-09 14:59:59 +00005440#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005441
Daniel Veillardce682bc2004-11-05 17:22:25 +00005442#define gen_nb_xmlCatalogPtr 1
5443static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5444 return(NULL);
5445}
5446static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5447}
Daniel Veillarda521d282004-11-09 14:59:59 +00005448#endif
5449
Daniel Veillardce682bc2004-11-05 17:22:25 +00005450
Daniel Veillardd93f6252004-11-02 15:53:51 +00005451static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005452test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005454
William M. Brack21e4ef22005-01-02 09:53:13 +00005455#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005456 int mem_base;
5457 int ret_val;
5458 xmlCatalogPtr catal; /* a Catalog */
5459 int n_catal;
5460 xmlChar * type; /* the type of record to add to the catalog */
5461 int n_type;
5462 xmlChar * orig; /* the system, public or prefix to match */
5463 int n_orig;
5464 xmlChar * replace; /* the replacement value for the match */
5465 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005466
Daniel Veillardce682bc2004-11-05 17:22:25 +00005467 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5468 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5469 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5470 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5471 mem_base = xmlMemBlocks();
5472 catal = gen_xmlCatalogPtr(n_catal, 0);
5473 type = gen_const_xmlChar_ptr(n_type, 1);
5474 orig = gen_const_xmlChar_ptr(n_orig, 2);
5475 replace = gen_const_xmlChar_ptr(n_replace, 3);
5476
William M. Brackf13f77f2004-11-12 16:03:48 +00005477 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005478 desret_int(ret_val);
5479 call_tests++;
5480 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005481 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5482 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5483 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005484 xmlResetLastError();
5485 if (mem_base != xmlMemBlocks()) {
5486 printf("Leak of %d blocks found in xmlACatalogAdd",
5487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005488 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005489 printf(" %d", n_catal);
5490 printf(" %d", n_type);
5491 printf(" %d", n_orig);
5492 printf(" %d", n_replace);
5493 printf("\n");
5494 }
5495 }
5496 }
5497 }
5498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005499 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005500#endif
5501
Daniel Veillard42595322004-11-08 10:52:06 +00005502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005503}
5504
5505
5506static int
5507test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005509
William M. Brack21e4ef22005-01-02 09:53:13 +00005510#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 int mem_base;
5512 xmlCatalogPtr catal; /* a Catalog */
5513 int n_catal;
5514 FILE * out; /* the file. */
5515 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005516
Daniel Veillardce682bc2004-11-05 17:22:25 +00005517 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5518 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5519 mem_base = xmlMemBlocks();
5520 catal = gen_xmlCatalogPtr(n_catal, 0);
5521 out = gen_FILE_ptr(n_out, 1);
5522
5523 xmlACatalogDump(catal, out);
5524 call_tests++;
5525 des_xmlCatalogPtr(n_catal, catal, 0);
5526 des_FILE_ptr(n_out, out, 1);
5527 xmlResetLastError();
5528 if (mem_base != xmlMemBlocks()) {
5529 printf("Leak of %d blocks found in xmlACatalogDump",
5530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005531 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005532 printf(" %d", n_catal);
5533 printf(" %d", n_out);
5534 printf("\n");
5535 }
5536 }
5537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005538 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005539#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005540
Daniel Veillard42595322004-11-08 10:52:06 +00005541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005542}
5543
5544
5545static int
5546test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005548
William M. Brack21e4ef22005-01-02 09:53:13 +00005549#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005550 int mem_base;
5551 int ret_val;
5552 xmlCatalogPtr catal; /* a Catalog */
5553 int n_catal;
5554 xmlChar * value; /* the value to remove */
5555 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005556
Daniel Veillardce682bc2004-11-05 17:22:25 +00005557 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5558 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5559 mem_base = xmlMemBlocks();
5560 catal = gen_xmlCatalogPtr(n_catal, 0);
5561 value = gen_const_xmlChar_ptr(n_value, 1);
5562
William M. Brackf13f77f2004-11-12 16:03:48 +00005563 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005564 desret_int(ret_val);
5565 call_tests++;
5566 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005567 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005568 xmlResetLastError();
5569 if (mem_base != xmlMemBlocks()) {
5570 printf("Leak of %d blocks found in xmlACatalogRemove",
5571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005573 printf(" %d", n_catal);
5574 printf(" %d", n_value);
5575 printf("\n");
5576 }
5577 }
5578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005579 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005580#endif
5581
Daniel Veillard42595322004-11-08 10:52:06 +00005582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005583}
5584
5585
5586static int
5587test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005589
William M. Brack21e4ef22005-01-02 09:53:13 +00005590#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005591 int mem_base;
5592 xmlChar * ret_val;
5593 xmlCatalogPtr catal; /* a Catalog */
5594 int n_catal;
5595 xmlChar * pubID; /* the public ID string */
5596 int n_pubID;
5597 xmlChar * sysID; /* the system ID string */
5598 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005599
Daniel Veillardce682bc2004-11-05 17:22:25 +00005600 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5601 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5602 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5603 mem_base = xmlMemBlocks();
5604 catal = gen_xmlCatalogPtr(n_catal, 0);
5605 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5606 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5607
William M. Brackf13f77f2004-11-12 16:03:48 +00005608 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005609 desret_xmlChar_ptr(ret_val);
5610 call_tests++;
5611 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005612 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5613 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005614 xmlResetLastError();
5615 if (mem_base != xmlMemBlocks()) {
5616 printf("Leak of %d blocks found in xmlACatalogResolve",
5617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005619 printf(" %d", n_catal);
5620 printf(" %d", n_pubID);
5621 printf(" %d", n_sysID);
5622 printf("\n");
5623 }
5624 }
5625 }
5626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005627 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005628#endif
5629
Daniel Veillard42595322004-11-08 10:52:06 +00005630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005631}
5632
5633
5634static int
5635test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005637
William M. Brack21e4ef22005-01-02 09:53:13 +00005638#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005639 int mem_base;
5640 xmlChar * ret_val;
5641 xmlCatalogPtr catal; /* a Catalog */
5642 int n_catal;
5643 xmlChar * pubID; /* the public ID string */
5644 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005645
Daniel Veillardce682bc2004-11-05 17:22:25 +00005646 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5647 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5648 mem_base = xmlMemBlocks();
5649 catal = gen_xmlCatalogPtr(n_catal, 0);
5650 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5651
William M. Brackf13f77f2004-11-12 16:03:48 +00005652 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005653 desret_xmlChar_ptr(ret_val);
5654 call_tests++;
5655 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005656 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005657 xmlResetLastError();
5658 if (mem_base != xmlMemBlocks()) {
5659 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005661 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005662 printf(" %d", n_catal);
5663 printf(" %d", n_pubID);
5664 printf("\n");
5665 }
5666 }
5667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005668 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005669#endif
5670
Daniel Veillard42595322004-11-08 10:52:06 +00005671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005672}
5673
5674
5675static int
5676test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005678
William M. Brack21e4ef22005-01-02 09:53:13 +00005679#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005680 int mem_base;
5681 xmlChar * ret_val;
5682 xmlCatalogPtr catal; /* a Catalog */
5683 int n_catal;
5684 xmlChar * sysID; /* the system ID string */
5685 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005686
Daniel Veillardce682bc2004-11-05 17:22:25 +00005687 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5688 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5689 mem_base = xmlMemBlocks();
5690 catal = gen_xmlCatalogPtr(n_catal, 0);
5691 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5692
William M. Brackf13f77f2004-11-12 16:03:48 +00005693 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005694 desret_xmlChar_ptr(ret_val);
5695 call_tests++;
5696 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005697 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005698 xmlResetLastError();
5699 if (mem_base != xmlMemBlocks()) {
5700 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005702 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005703 printf(" %d", n_catal);
5704 printf(" %d", n_sysID);
5705 printf("\n");
5706 }
5707 }
5708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005709 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005710#endif
5711
Daniel Veillard42595322004-11-08 10:52:06 +00005712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005713}
5714
5715
5716static int
5717test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005719
William M. Brack21e4ef22005-01-02 09:53:13 +00005720#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005721 int mem_base;
5722 xmlChar * ret_val;
5723 xmlCatalogPtr catal; /* a Catalog */
5724 int n_catal;
5725 xmlChar * URI; /* the URI */
5726 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005727
Daniel Veillardce682bc2004-11-05 17:22:25 +00005728 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5729 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5730 mem_base = xmlMemBlocks();
5731 catal = gen_xmlCatalogPtr(n_catal, 0);
5732 URI = gen_const_xmlChar_ptr(n_URI, 1);
5733
William M. Brackf13f77f2004-11-12 16:03:48 +00005734 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005735 desret_xmlChar_ptr(ret_val);
5736 call_tests++;
5737 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005738 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005739 xmlResetLastError();
5740 if (mem_base != xmlMemBlocks()) {
5741 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005743 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005744 printf(" %d", n_catal);
5745 printf(" %d", n_URI);
5746 printf("\n");
5747 }
5748 }
5749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005750 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005751#endif
5752
Daniel Veillard42595322004-11-08 10:52:06 +00005753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005754}
5755
5756
5757static int
5758test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005760
William M. Brack21e4ef22005-01-02 09:53:13 +00005761#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005762 int mem_base;
5763 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005764 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005765 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005766 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005767 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005768 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005769 int n_replace;
5770
5771 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5772 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5773 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005775 type = gen_const_xmlChar_ptr(n_type, 0);
5776 orig = gen_const_xmlChar_ptr(n_orig, 1);
5777 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778
William M. Brackf13f77f2004-11-12 16:03:48 +00005779 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005780 desret_int(ret_val);
5781 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005782 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5783 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5784 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005785 xmlResetLastError();
5786 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005787 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005789 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005790 printf(" %d", n_type);
5791 printf(" %d", n_orig);
5792 printf(" %d", n_replace);
5793 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005794 }
5795 }
5796 }
5797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005798 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005799#endif
5800
Daniel Veillard42595322004-11-08 10:52:06 +00005801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005802}
5803
5804
5805static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005806test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005808
William M. Brack21e4ef22005-01-02 09:53:13 +00005809#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005810
Daniel Veillardd93f6252004-11-02 15:53:51 +00005811
5812 xmlCatalogCleanup();
5813 call_tests++;
5814 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005815 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005816#endif
5817
Daniel Veillard42595322004-11-08 10:52:06 +00005818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005819}
5820
5821
5822static int
5823test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005825
William M. Brack21e4ef22005-01-02 09:53:13 +00005826#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005827 int ret_val;
5828
5829
5830 ret_val = xmlCatalogConvert();
5831 desret_int(ret_val);
5832 call_tests++;
5833 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005834 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005835#endif
5836
Daniel Veillard42595322004-11-08 10:52:06 +00005837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005838}
5839
5840
5841static int
5842test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844
William M. Brack21e4ef22005-01-02 09:53:13 +00005845#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005846 int mem_base;
5847 FILE * out; /* the file. */
5848 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005849
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005850 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5851 mem_base = xmlMemBlocks();
5852 out = gen_FILE_ptr(n_out, 0);
5853
5854 xmlCatalogDump(out);
5855 call_tests++;
5856 des_FILE_ptr(n_out, out, 0);
5857 xmlResetLastError();
5858 if (mem_base != xmlMemBlocks()) {
5859 printf("Leak of %d blocks found in xmlCatalogDump",
5860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005861 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005862 printf(" %d", n_out);
5863 printf("\n");
5864 }
5865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005866 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005867#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005868
Daniel Veillard42595322004-11-08 10:52:06 +00005869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005870}
5871
5872
5873static int
5874test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876
William M. Brack21e4ef22005-01-02 09:53:13 +00005877#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005878 int mem_base;
5879 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880
Daniel Veillard57b25162004-11-06 14:50:18 +00005881 mem_base = xmlMemBlocks();
5882
5883 ret_val = xmlCatalogGetDefaults();
5884 desret_xmlCatalogAllow(ret_val);
5885 call_tests++;
5886 xmlResetLastError();
5887 if (mem_base != xmlMemBlocks()) {
5888 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005890 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005891 printf("\n");
5892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005893 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005894#endif
5895
Daniel Veillard42595322004-11-08 10:52:06 +00005896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005897}
5898
5899
5900static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005901test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005903
William M. Brack21e4ef22005-01-02 09:53:13 +00005904#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005905 int mem_base;
5906 int ret_val;
5907 xmlCatalogPtr catal; /* should this create an SGML catalog */
5908 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005909
Daniel Veillardce682bc2004-11-05 17:22:25 +00005910 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5911 mem_base = xmlMemBlocks();
5912 catal = gen_xmlCatalogPtr(n_catal, 0);
5913
5914 ret_val = xmlCatalogIsEmpty(catal);
5915 desret_int(ret_val);
5916 call_tests++;
5917 des_xmlCatalogPtr(n_catal, catal, 0);
5918 xmlResetLastError();
5919 if (mem_base != xmlMemBlocks()) {
5920 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005922 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005923 printf(" %d", n_catal);
5924 printf("\n");
5925 }
5926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005927 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005928#endif
5929
Daniel Veillard42595322004-11-08 10:52:06 +00005930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005931}
5932
5933
5934static int
5935test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005937
William M. Brack21e4ef22005-01-02 09:53:13 +00005938#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005939 int mem_base;
5940 xmlChar * ret_val;
5941 void * catalogs; /* a document's list of catalogs */
5942 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005943 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005944 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005945 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005946 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005947
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005948 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5949 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5950 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5951 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005952 catalogs = gen_void_ptr(n_catalogs, 0);
5953 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5954 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005955
William M. Brackf13f77f2004-11-12 16:03:48 +00005956 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005957 desret_xmlChar_ptr(ret_val);
5958 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005959 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005960 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5961 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005962 xmlResetLastError();
5963 if (mem_base != xmlMemBlocks()) {
5964 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005966 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005967 printf(" %d", n_catalogs);
5968 printf(" %d", n_pubID);
5969 printf(" %d", n_sysID);
5970 printf("\n");
5971 }
5972 }
5973 }
5974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005975 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005976#endif
5977
Daniel Veillard42595322004-11-08 10:52:06 +00005978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979}
5980
5981
5982static int
5983test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005985
William M. Brack21e4ef22005-01-02 09:53:13 +00005986#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005987 int mem_base;
5988 xmlChar * ret_val;
5989 void * catalogs; /* a document's list of catalogs */
5990 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005991 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005992 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005993
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005994 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5995 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005997 catalogs = gen_void_ptr(n_catalogs, 0);
5998 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005999
William M. Brackf13f77f2004-11-12 16:03:48 +00006000 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006001 desret_xmlChar_ptr(ret_val);
6002 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006003 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006004 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006005 xmlResetLastError();
6006 if (mem_base != xmlMemBlocks()) {
6007 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006009 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006010 printf(" %d", n_catalogs);
6011 printf(" %d", n_URI);
6012 printf("\n");
6013 }
6014 }
6015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006016 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006017#endif
6018
Daniel Veillard42595322004-11-08 10:52:06 +00006019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006020}
6021
6022
6023static int
6024test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006026
William M. Brack21e4ef22005-01-02 09:53:13 +00006027#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006028 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006029 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006030 int n_value;
6031
6032 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006033 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006034
William M. Brackf13f77f2004-11-12 16:03:48 +00006035 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006036 desret_int(ret_val);
6037 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006038 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006039 xmlResetLastError();
6040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006041 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006042#endif
6043
Daniel Veillard42595322004-11-08 10:52:06 +00006044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006045}
6046
6047
6048static int
6049test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006051
William M. Brack21e4ef22005-01-02 09:53:13 +00006052#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006053 int mem_base;
6054 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006055 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006056 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006057 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006058 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006059
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006060 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6061 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006063 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6064 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006065
William M. Brackf13f77f2004-11-12 16:03:48 +00006066 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006067 desret_xmlChar_ptr(ret_val);
6068 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006069 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6070 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 xmlResetLastError();
6072 if (mem_base != xmlMemBlocks()) {
6073 printf("Leak of %d blocks found in xmlCatalogResolve",
6074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006075 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 printf(" %d", n_pubID);
6077 printf(" %d", n_sysID);
6078 printf("\n");
6079 }
6080 }
6081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006082 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006083#endif
6084
Daniel Veillard42595322004-11-08 10:52:06 +00006085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006086}
6087
6088
6089static int
6090test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006092
William M. Brack21e4ef22005-01-02 09:53:13 +00006093#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006094 int mem_base;
6095 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006096 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006097 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006098
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006099 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006101 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006102
William M. Brackf13f77f2004-11-12 16:03:48 +00006103 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006104 desret_xmlChar_ptr(ret_val);
6105 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006106 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107 xmlResetLastError();
6108 if (mem_base != xmlMemBlocks()) {
6109 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006111 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006112 printf(" %d", n_pubID);
6113 printf("\n");
6114 }
6115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006116 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006117#endif
6118
Daniel Veillard42595322004-11-08 10:52:06 +00006119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006120}
6121
6122
6123static int
6124test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006126
William M. Brack21e4ef22005-01-02 09:53:13 +00006127#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006128 int mem_base;
6129 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006130 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006131 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006132
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006133 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6134 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006135 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006136
William M. Brackf13f77f2004-11-12 16:03:48 +00006137 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006138 desret_xmlChar_ptr(ret_val);
6139 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006140 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006141 xmlResetLastError();
6142 if (mem_base != xmlMemBlocks()) {
6143 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006145 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006146 printf(" %d", n_sysID);
6147 printf("\n");
6148 }
6149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006150 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006151#endif
6152
Daniel Veillard42595322004-11-08 10:52:06 +00006153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006154}
6155
6156
6157static int
6158test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006160
William M. Brack21e4ef22005-01-02 09:53:13 +00006161#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006162 int mem_base;
6163 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006164 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006165 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006166
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006167 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006169 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006170
William M. Brackf13f77f2004-11-12 16:03:48 +00006171 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006172 desret_xmlChar_ptr(ret_val);
6173 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006174 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006175 xmlResetLastError();
6176 if (mem_base != xmlMemBlocks()) {
6177 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006179 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006180 printf(" %d", n_URI);
6181 printf("\n");
6182 }
6183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006184 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006185#endif
6186
Daniel Veillard42595322004-11-08 10:52:06 +00006187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006188}
6189
6190
6191static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006192test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006194
William M. Brack21e4ef22005-01-02 09:53:13 +00006195#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006196 int mem_base;
6197 xmlCatalogPrefer ret_val;
6198 xmlCatalogPrefer prefer; /* the default preference for delegation */
6199 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006200
Daniel Veillard57b25162004-11-06 14:50:18 +00006201 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6202 mem_base = xmlMemBlocks();
6203 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6204
6205 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6206 desret_xmlCatalogPrefer(ret_val);
6207 call_tests++;
6208 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6209 xmlResetLastError();
6210 if (mem_base != xmlMemBlocks()) {
6211 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006213 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006214 printf(" %d", n_prefer);
6215 printf("\n");
6216 }
6217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006218 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006219#endif
6220
Daniel Veillard42595322004-11-08 10:52:06 +00006221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006222}
6223
6224
6225static int
6226test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006228
William M. Brack21e4ef22005-01-02 09:53:13 +00006229#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006230 int mem_base;
6231 xmlCatalogAllow allow; /* what catalogs should be accepted */
6232 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006233
Daniel Veillard57b25162004-11-06 14:50:18 +00006234 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6235 mem_base = xmlMemBlocks();
6236 allow = gen_xmlCatalogAllow(n_allow, 0);
6237
6238 xmlCatalogSetDefaults(allow);
6239 call_tests++;
6240 des_xmlCatalogAllow(n_allow, allow, 0);
6241 xmlResetLastError();
6242 if (mem_base != xmlMemBlocks()) {
6243 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006245 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006246 printf(" %d", n_allow);
6247 printf("\n");
6248 }
6249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006250 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006251#endif
6252
Daniel Veillard42595322004-11-08 10:52:06 +00006253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006254}
6255
6256
6257static int
6258test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006260
William M. Brack21e4ef22005-01-02 09:53:13 +00006261#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006262 int mem_base;
6263 int ret_val;
6264 xmlCatalogPtr catal; /* the catalog */
6265 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006266
Daniel Veillardce682bc2004-11-05 17:22:25 +00006267 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6268 mem_base = xmlMemBlocks();
6269 catal = gen_xmlCatalogPtr(n_catal, 0);
6270
6271 ret_val = xmlConvertSGMLCatalog(catal);
6272 desret_int(ret_val);
6273 call_tests++;
6274 des_xmlCatalogPtr(n_catal, catal, 0);
6275 xmlResetLastError();
6276 if (mem_base != xmlMemBlocks()) {
6277 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006279 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006280 printf(" %d", n_catal);
6281 printf("\n");
6282 }
6283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006284 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006285#endif
6286
Daniel Veillard42595322004-11-08 10:52:06 +00006287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288}
6289
6290
6291static int
6292test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006294
William M. Brack21e4ef22005-01-02 09:53:13 +00006295#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006296 int mem_base;
6297
6298 mem_base = xmlMemBlocks();
6299
6300 xmlInitializeCatalog();
6301 call_tests++;
6302 xmlResetLastError();
6303 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006304 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006306 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006307 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006309 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310#endif
6311
Daniel Veillard42595322004-11-08 10:52:06 +00006312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006313}
6314
6315
6316static int
6317test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006319
6320
6321 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006323}
6324
6325
6326static int
6327test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006329
William M. Brack21e4ef22005-01-02 09:53:13 +00006330#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006331 int ret_val;
6332 const char * filename; /* a file path */
6333 int n_filename;
6334
6335 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006336 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006337
6338 ret_val = xmlLoadCatalog(filename);
6339 desret_int(ret_val);
6340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006341 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 xmlResetLastError();
6343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006344 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006345#endif
6346
Daniel Veillard42595322004-11-08 10:52:06 +00006347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006348}
6349
6350
6351static int
6352test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006354
William M. Brack21e4ef22005-01-02 09:53:13 +00006355#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006356 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006357 int n_pathss;
6358
6359 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006360 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006361
William M. Brackf13f77f2004-11-12 16:03:48 +00006362 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006363 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006364 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365 xmlResetLastError();
6366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006367 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006368#endif
6369
Daniel Veillard42595322004-11-08 10:52:06 +00006370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006371}
6372
6373
6374static int
6375test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006377
6378
6379 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006381}
6382
6383
6384static int
6385test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006387
6388
6389 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006391}
6392
6393
6394static int
6395test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006397
William M. Brack21e4ef22005-01-02 09:53:13 +00006398#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006399 int mem_base;
6400 xmlDocPtr ret_val;
6401 const char * filename; /* the filename */
6402 int n_filename;
6403
6404 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006406 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006407
6408 ret_val = xmlParseCatalogFile(filename);
6409 desret_xmlDocPtr(ret_val);
6410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006411 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006412 xmlResetLastError();
6413 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006414 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006416 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006417 printf(" %d", n_filename);
6418 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006419 }
6420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006421 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006422#endif
6423
Daniel Veillard42595322004-11-08 10:52:06 +00006424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006425}
6426
6427static int
6428test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006430
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006431 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006432 test_ret += test_xmlACatalogAdd();
6433 test_ret += test_xmlACatalogDump();
6434 test_ret += test_xmlACatalogRemove();
6435 test_ret += test_xmlACatalogResolve();
6436 test_ret += test_xmlACatalogResolvePublic();
6437 test_ret += test_xmlACatalogResolveSystem();
6438 test_ret += test_xmlACatalogResolveURI();
6439 test_ret += test_xmlCatalogAdd();
6440 test_ret += test_xmlCatalogCleanup();
6441 test_ret += test_xmlCatalogConvert();
6442 test_ret += test_xmlCatalogDump();
6443 test_ret += test_xmlCatalogGetDefaults();
6444 test_ret += test_xmlCatalogIsEmpty();
6445 test_ret += test_xmlCatalogLocalResolve();
6446 test_ret += test_xmlCatalogLocalResolveURI();
6447 test_ret += test_xmlCatalogRemove();
6448 test_ret += test_xmlCatalogResolve();
6449 test_ret += test_xmlCatalogResolvePublic();
6450 test_ret += test_xmlCatalogResolveSystem();
6451 test_ret += test_xmlCatalogResolveURI();
6452 test_ret += test_xmlCatalogSetDefaultPrefer();
6453 test_ret += test_xmlCatalogSetDefaults();
6454 test_ret += test_xmlConvertSGMLCatalog();
6455 test_ret += test_xmlInitializeCatalog();
6456 test_ret += test_xmlLoadACatalog();
6457 test_ret += test_xmlLoadCatalog();
6458 test_ret += test_xmlLoadCatalogs();
6459 test_ret += test_xmlLoadSGMLSuperCatalog();
6460 test_ret += test_xmlNewCatalog();
6461 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006462
Daniel Veillard42595322004-11-08 10:52:06 +00006463 if (test_ret != 0)
6464 printf("Module catalog: %d errors\n", test_ret);
6465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006466}
6467
Daniel Veillardce682bc2004-11-05 17:22:25 +00006468#define gen_nb_const_xmlChRangeGroupPtr 1
6469static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6470 return(NULL);
6471}
6472static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6473}
6474
Daniel Veillardd93f6252004-11-02 15:53:51 +00006475static int
6476test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006478
Daniel Veillardce682bc2004-11-05 17:22:25 +00006479 int mem_base;
6480 int ret_val;
6481 unsigned int val; /* character to be validated */
6482 int n_val;
6483 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6484 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006485
Daniel Veillardce682bc2004-11-05 17:22:25 +00006486 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6487 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6488 mem_base = xmlMemBlocks();
6489 val = gen_unsigned_int(n_val, 0);
6490 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6491
William M. Brackf13f77f2004-11-12 16:03:48 +00006492 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006493 desret_int(ret_val);
6494 call_tests++;
6495 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006496 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006497 xmlResetLastError();
6498 if (mem_base != xmlMemBlocks()) {
6499 printf("Leak of %d blocks found in xmlCharInRange",
6500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006501 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006502 printf(" %d", n_val);
6503 printf(" %d", n_rptr);
6504 printf("\n");
6505 }
6506 }
6507 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006509
Daniel Veillard42595322004-11-08 10:52:06 +00006510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006511}
6512
6513
6514static int
6515test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006517
Daniel Veillard3d97e662004-11-04 10:49:00 +00006518 int mem_base;
6519 int ret_val;
6520 unsigned int ch; /* character to validate */
6521 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522
Daniel Veillard3d97e662004-11-04 10:49:00 +00006523 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6524 mem_base = xmlMemBlocks();
6525 ch = gen_unsigned_int(n_ch, 0);
6526
6527 ret_val = xmlIsBaseChar(ch);
6528 desret_int(ret_val);
6529 call_tests++;
6530 des_unsigned_int(n_ch, ch, 0);
6531 xmlResetLastError();
6532 if (mem_base != xmlMemBlocks()) {
6533 printf("Leak of %d blocks found in xmlIsBaseChar",
6534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006535 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006536 printf(" %d", n_ch);
6537 printf("\n");
6538 }
6539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006541
Daniel Veillard42595322004-11-08 10:52:06 +00006542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006543}
6544
6545
6546static int
6547test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006549
Daniel Veillard3d97e662004-11-04 10:49:00 +00006550 int mem_base;
6551 int ret_val;
6552 unsigned int ch; /* character to validate */
6553 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006554
Daniel Veillard3d97e662004-11-04 10:49:00 +00006555 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6556 mem_base = xmlMemBlocks();
6557 ch = gen_unsigned_int(n_ch, 0);
6558
6559 ret_val = xmlIsBlank(ch);
6560 desret_int(ret_val);
6561 call_tests++;
6562 des_unsigned_int(n_ch, ch, 0);
6563 xmlResetLastError();
6564 if (mem_base != xmlMemBlocks()) {
6565 printf("Leak of %d blocks found in xmlIsBlank",
6566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006567 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006568 printf(" %d", n_ch);
6569 printf("\n");
6570 }
6571 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006573
Daniel Veillard42595322004-11-08 10:52:06 +00006574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006575}
6576
6577
6578static int
6579test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006581
Daniel Veillard3d97e662004-11-04 10:49:00 +00006582 int mem_base;
6583 int ret_val;
6584 unsigned int ch; /* character to validate */
6585 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006586
Daniel Veillard3d97e662004-11-04 10:49:00 +00006587 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6588 mem_base = xmlMemBlocks();
6589 ch = gen_unsigned_int(n_ch, 0);
6590
6591 ret_val = xmlIsChar(ch);
6592 desret_int(ret_val);
6593 call_tests++;
6594 des_unsigned_int(n_ch, ch, 0);
6595 xmlResetLastError();
6596 if (mem_base != xmlMemBlocks()) {
6597 printf("Leak of %d blocks found in xmlIsChar",
6598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006599 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006600 printf(" %d", n_ch);
6601 printf("\n");
6602 }
6603 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006605
Daniel Veillard42595322004-11-08 10:52:06 +00006606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006607}
6608
6609
6610static int
6611test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006613
Daniel Veillard3d97e662004-11-04 10:49:00 +00006614 int mem_base;
6615 int ret_val;
6616 unsigned int ch; /* character to validate */
6617 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618
Daniel Veillard3d97e662004-11-04 10:49:00 +00006619 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6620 mem_base = xmlMemBlocks();
6621 ch = gen_unsigned_int(n_ch, 0);
6622
6623 ret_val = xmlIsCombining(ch);
6624 desret_int(ret_val);
6625 call_tests++;
6626 des_unsigned_int(n_ch, ch, 0);
6627 xmlResetLastError();
6628 if (mem_base != xmlMemBlocks()) {
6629 printf("Leak of %d blocks found in xmlIsCombining",
6630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006631 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006632 printf(" %d", n_ch);
6633 printf("\n");
6634 }
6635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006637
Daniel Veillard42595322004-11-08 10:52:06 +00006638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006639}
6640
6641
6642static int
6643test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006645
Daniel Veillard3d97e662004-11-04 10:49:00 +00006646 int mem_base;
6647 int ret_val;
6648 unsigned int ch; /* character to validate */
6649 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006650
Daniel Veillard3d97e662004-11-04 10:49:00 +00006651 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6652 mem_base = xmlMemBlocks();
6653 ch = gen_unsigned_int(n_ch, 0);
6654
6655 ret_val = xmlIsDigit(ch);
6656 desret_int(ret_val);
6657 call_tests++;
6658 des_unsigned_int(n_ch, ch, 0);
6659 xmlResetLastError();
6660 if (mem_base != xmlMemBlocks()) {
6661 printf("Leak of %d blocks found in xmlIsDigit",
6662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006663 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006664 printf(" %d", n_ch);
6665 printf("\n");
6666 }
6667 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006669
Daniel Veillard42595322004-11-08 10:52:06 +00006670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006671}
6672
6673
6674static int
6675test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006677
Daniel Veillard3d97e662004-11-04 10:49:00 +00006678 int mem_base;
6679 int ret_val;
6680 unsigned int ch; /* character to validate */
6681 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682
Daniel Veillard3d97e662004-11-04 10:49:00 +00006683 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6684 mem_base = xmlMemBlocks();
6685 ch = gen_unsigned_int(n_ch, 0);
6686
6687 ret_val = xmlIsExtender(ch);
6688 desret_int(ret_val);
6689 call_tests++;
6690 des_unsigned_int(n_ch, ch, 0);
6691 xmlResetLastError();
6692 if (mem_base != xmlMemBlocks()) {
6693 printf("Leak of %d blocks found in xmlIsExtender",
6694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006695 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006696 printf(" %d", n_ch);
6697 printf("\n");
6698 }
6699 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006701
Daniel Veillard42595322004-11-08 10:52:06 +00006702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006703}
6704
6705
6706static int
6707test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006709
Daniel Veillard3d97e662004-11-04 10:49:00 +00006710 int mem_base;
6711 int ret_val;
6712 unsigned int ch; /* character to validate */
6713 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006714
Daniel Veillard3d97e662004-11-04 10:49:00 +00006715 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6716 mem_base = xmlMemBlocks();
6717 ch = gen_unsigned_int(n_ch, 0);
6718
6719 ret_val = xmlIsIdeographic(ch);
6720 desret_int(ret_val);
6721 call_tests++;
6722 des_unsigned_int(n_ch, ch, 0);
6723 xmlResetLastError();
6724 if (mem_base != xmlMemBlocks()) {
6725 printf("Leak of %d blocks found in xmlIsIdeographic",
6726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006727 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006728 printf(" %d", n_ch);
6729 printf("\n");
6730 }
6731 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006733
Daniel Veillard42595322004-11-08 10:52:06 +00006734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006735}
6736
6737
6738static int
6739test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006741
Daniel Veillard3d97e662004-11-04 10:49:00 +00006742 int mem_base;
6743 int ret_val;
6744 unsigned int ch; /* character to validate */
6745 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006746
Daniel Veillard3d97e662004-11-04 10:49:00 +00006747 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6748 mem_base = xmlMemBlocks();
6749 ch = gen_unsigned_int(n_ch, 0);
6750
6751 ret_val = xmlIsPubidChar(ch);
6752 desret_int(ret_val);
6753 call_tests++;
6754 des_unsigned_int(n_ch, ch, 0);
6755 xmlResetLastError();
6756 if (mem_base != xmlMemBlocks()) {
6757 printf("Leak of %d blocks found in xmlIsPubidChar",
6758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006759 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006760 printf(" %d", n_ch);
6761 printf("\n");
6762 }
6763 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006765
Daniel Veillard42595322004-11-08 10:52:06 +00006766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006767}
6768
6769static int
6770test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006772
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006773 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006774 test_ret += test_xmlCharInRange();
6775 test_ret += test_xmlIsBaseChar();
6776 test_ret += test_xmlIsBlank();
6777 test_ret += test_xmlIsChar();
6778 test_ret += test_xmlIsCombining();
6779 test_ret += test_xmlIsDigit();
6780 test_ret += test_xmlIsExtender();
6781 test_ret += test_xmlIsIdeographic();
6782 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006783
Daniel Veillard42595322004-11-08 10:52:06 +00006784 if (test_ret != 0)
6785 printf("Module chvalid: %d errors\n", test_ret);
6786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006787}
6788
6789static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006790test_xmlBoolToText(void) {
6791 int test_ret = 0;
6792
William M. Brack21e4ef22005-01-02 09:53:13 +00006793#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006794 int mem_base;
6795 const char * ret_val;
6796 int boolval; /* a bool to turn into text */
6797 int n_boolval;
6798
6799 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6800 mem_base = xmlMemBlocks();
6801 boolval = gen_int(n_boolval, 0);
6802
6803 ret_val = xmlBoolToText(boolval);
6804 desret_const_char_ptr(ret_val);
6805 call_tests++;
6806 des_int(n_boolval, boolval, 0);
6807 xmlResetLastError();
6808 if (mem_base != xmlMemBlocks()) {
6809 printf("Leak of %d blocks found in xmlBoolToText",
6810 xmlMemBlocks() - mem_base);
6811 test_ret++;
6812 printf(" %d", n_boolval);
6813 printf("\n");
6814 }
6815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006816 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006817#endif
6818
Daniel Veillarda82b1822004-11-08 16:24:57 +00006819 return(test_ret);
6820}
6821
6822
6823static int
6824test_xmlDebugCheckDocument(void) {
6825 int test_ret = 0;
6826
William M. Brack21e4ef22005-01-02 09:53:13 +00006827#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006828 int mem_base;
6829 int ret_val;
6830 FILE * output; /* the FILE * for the output */
6831 int n_output;
6832 xmlDocPtr doc; /* the document */
6833 int n_doc;
6834
6835 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6836 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6837 mem_base = xmlMemBlocks();
6838 output = gen_debug_FILE_ptr(n_output, 0);
6839 doc = gen_xmlDocPtr(n_doc, 1);
6840
6841 ret_val = xmlDebugCheckDocument(output, doc);
6842 desret_int(ret_val);
6843 call_tests++;
6844 des_debug_FILE_ptr(n_output, output, 0);
6845 des_xmlDocPtr(n_doc, doc, 1);
6846 xmlResetLastError();
6847 if (mem_base != xmlMemBlocks()) {
6848 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6849 xmlMemBlocks() - mem_base);
6850 test_ret++;
6851 printf(" %d", n_output);
6852 printf(" %d", n_doc);
6853 printf("\n");
6854 }
6855 }
6856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006857 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006858#endif
6859
Daniel Veillarda82b1822004-11-08 16:24:57 +00006860 return(test_ret);
6861}
6862
6863
6864static int
6865test_xmlDebugDumpAttr(void) {
6866 int test_ret = 0;
6867
William M. Brack21e4ef22005-01-02 09:53:13 +00006868#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006869 int mem_base;
6870 FILE * output; /* the FILE * for the output */
6871 int n_output;
6872 xmlAttrPtr attr; /* the attribute */
6873 int n_attr;
6874 int depth; /* the indentation level. */
6875 int n_depth;
6876
6877 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6878 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6879 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6880 mem_base = xmlMemBlocks();
6881 output = gen_debug_FILE_ptr(n_output, 0);
6882 attr = gen_xmlAttrPtr(n_attr, 1);
6883 depth = gen_int(n_depth, 2);
6884
6885 xmlDebugDumpAttr(output, attr, depth);
6886 call_tests++;
6887 des_debug_FILE_ptr(n_output, output, 0);
6888 des_xmlAttrPtr(n_attr, attr, 1);
6889 des_int(n_depth, depth, 2);
6890 xmlResetLastError();
6891 if (mem_base != xmlMemBlocks()) {
6892 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6893 xmlMemBlocks() - mem_base);
6894 test_ret++;
6895 printf(" %d", n_output);
6896 printf(" %d", n_attr);
6897 printf(" %d", n_depth);
6898 printf("\n");
6899 }
6900 }
6901 }
6902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006903 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006904#endif
6905
Daniel Veillarda82b1822004-11-08 16:24:57 +00006906 return(test_ret);
6907}
6908
6909
6910static int
6911test_xmlDebugDumpAttrList(void) {
6912 int test_ret = 0;
6913
William M. Brack21e4ef22005-01-02 09:53:13 +00006914#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006915 int mem_base;
6916 FILE * output; /* the FILE * for the output */
6917 int n_output;
6918 xmlAttrPtr attr; /* the attribute list */
6919 int n_attr;
6920 int depth; /* the indentation level. */
6921 int n_depth;
6922
6923 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6924 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6925 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6926 mem_base = xmlMemBlocks();
6927 output = gen_debug_FILE_ptr(n_output, 0);
6928 attr = gen_xmlAttrPtr(n_attr, 1);
6929 depth = gen_int(n_depth, 2);
6930
6931 xmlDebugDumpAttrList(output, attr, depth);
6932 call_tests++;
6933 des_debug_FILE_ptr(n_output, output, 0);
6934 des_xmlAttrPtr(n_attr, attr, 1);
6935 des_int(n_depth, depth, 2);
6936 xmlResetLastError();
6937 if (mem_base != xmlMemBlocks()) {
6938 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6939 xmlMemBlocks() - mem_base);
6940 test_ret++;
6941 printf(" %d", n_output);
6942 printf(" %d", n_attr);
6943 printf(" %d", n_depth);
6944 printf("\n");
6945 }
6946 }
6947 }
6948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006949 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006950#endif
6951
Daniel Veillarda82b1822004-11-08 16:24:57 +00006952 return(test_ret);
6953}
6954
6955
6956static int
6957test_xmlDebugDumpDTD(void) {
6958 int test_ret = 0;
6959
William M. Brack21e4ef22005-01-02 09:53:13 +00006960#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006961 int mem_base;
6962 FILE * output; /* the FILE * for the output */
6963 int n_output;
6964 xmlDtdPtr dtd; /* the DTD */
6965 int n_dtd;
6966
6967 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6968 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6969 mem_base = xmlMemBlocks();
6970 output = gen_debug_FILE_ptr(n_output, 0);
6971 dtd = gen_xmlDtdPtr(n_dtd, 1);
6972
6973 xmlDebugDumpDTD(output, dtd);
6974 call_tests++;
6975 des_debug_FILE_ptr(n_output, output, 0);
6976 des_xmlDtdPtr(n_dtd, dtd, 1);
6977 xmlResetLastError();
6978 if (mem_base != xmlMemBlocks()) {
6979 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6980 xmlMemBlocks() - mem_base);
6981 test_ret++;
6982 printf(" %d", n_output);
6983 printf(" %d", n_dtd);
6984 printf("\n");
6985 }
6986 }
6987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006988 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006989#endif
6990
Daniel Veillarda82b1822004-11-08 16:24:57 +00006991 return(test_ret);
6992}
6993
6994
6995static int
6996test_xmlDebugDumpDocument(void) {
6997 int test_ret = 0;
6998
William M. Brack21e4ef22005-01-02 09:53:13 +00006999#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007000 int mem_base;
7001 FILE * output; /* the FILE * for the output */
7002 int n_output;
7003 xmlDocPtr doc; /* the document */
7004 int n_doc;
7005
7006 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7007 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7008 mem_base = xmlMemBlocks();
7009 output = gen_debug_FILE_ptr(n_output, 0);
7010 doc = gen_xmlDocPtr(n_doc, 1);
7011
7012 xmlDebugDumpDocument(output, doc);
7013 call_tests++;
7014 des_debug_FILE_ptr(n_output, output, 0);
7015 des_xmlDocPtr(n_doc, doc, 1);
7016 xmlResetLastError();
7017 if (mem_base != xmlMemBlocks()) {
7018 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7019 xmlMemBlocks() - mem_base);
7020 test_ret++;
7021 printf(" %d", n_output);
7022 printf(" %d", n_doc);
7023 printf("\n");
7024 }
7025 }
7026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007027 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007028#endif
7029
Daniel Veillarda82b1822004-11-08 16:24:57 +00007030 return(test_ret);
7031}
7032
7033
7034static int
7035test_xmlDebugDumpDocumentHead(void) {
7036 int test_ret = 0;
7037
William M. Brack21e4ef22005-01-02 09:53:13 +00007038#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007039 int mem_base;
7040 FILE * output; /* the FILE * for the output */
7041 int n_output;
7042 xmlDocPtr doc; /* the document */
7043 int n_doc;
7044
7045 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7046 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7047 mem_base = xmlMemBlocks();
7048 output = gen_debug_FILE_ptr(n_output, 0);
7049 doc = gen_xmlDocPtr(n_doc, 1);
7050
7051 xmlDebugDumpDocumentHead(output, doc);
7052 call_tests++;
7053 des_debug_FILE_ptr(n_output, output, 0);
7054 des_xmlDocPtr(n_doc, doc, 1);
7055 xmlResetLastError();
7056 if (mem_base != xmlMemBlocks()) {
7057 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7058 xmlMemBlocks() - mem_base);
7059 test_ret++;
7060 printf(" %d", n_output);
7061 printf(" %d", n_doc);
7062 printf("\n");
7063 }
7064 }
7065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007066 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007067#endif
7068
Daniel Veillarda82b1822004-11-08 16:24:57 +00007069 return(test_ret);
7070}
7071
7072
7073static int
7074test_xmlDebugDumpEntities(void) {
7075 int test_ret = 0;
7076
William M. Brack21e4ef22005-01-02 09:53:13 +00007077#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007078 int mem_base;
7079 FILE * output; /* the FILE * for the output */
7080 int n_output;
7081 xmlDocPtr doc; /* the document */
7082 int n_doc;
7083
7084 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7086 mem_base = xmlMemBlocks();
7087 output = gen_debug_FILE_ptr(n_output, 0);
7088 doc = gen_xmlDocPtr(n_doc, 1);
7089
7090 xmlDebugDumpEntities(output, doc);
7091 call_tests++;
7092 des_debug_FILE_ptr(n_output, output, 0);
7093 des_xmlDocPtr(n_doc, doc, 1);
7094 xmlResetLastError();
7095 if (mem_base != xmlMemBlocks()) {
7096 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7097 xmlMemBlocks() - mem_base);
7098 test_ret++;
7099 printf(" %d", n_output);
7100 printf(" %d", n_doc);
7101 printf("\n");
7102 }
7103 }
7104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007105 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007106#endif
7107
Daniel Veillarda82b1822004-11-08 16:24:57 +00007108 return(test_ret);
7109}
7110
7111
7112static int
7113test_xmlDebugDumpNode(void) {
7114 int test_ret = 0;
7115
William M. Brack21e4ef22005-01-02 09:53:13 +00007116#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007117 int mem_base;
7118 FILE * output; /* the FILE * for the output */
7119 int n_output;
7120 xmlNodePtr node; /* the node */
7121 int n_node;
7122 int depth; /* the indentation level. */
7123 int n_depth;
7124
7125 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7126 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7127 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7128 mem_base = xmlMemBlocks();
7129 output = gen_debug_FILE_ptr(n_output, 0);
7130 node = gen_xmlNodePtr(n_node, 1);
7131 depth = gen_int(n_depth, 2);
7132
7133 xmlDebugDumpNode(output, node, depth);
7134 call_tests++;
7135 des_debug_FILE_ptr(n_output, output, 0);
7136 des_xmlNodePtr(n_node, node, 1);
7137 des_int(n_depth, depth, 2);
7138 xmlResetLastError();
7139 if (mem_base != xmlMemBlocks()) {
7140 printf("Leak of %d blocks found in xmlDebugDumpNode",
7141 xmlMemBlocks() - mem_base);
7142 test_ret++;
7143 printf(" %d", n_output);
7144 printf(" %d", n_node);
7145 printf(" %d", n_depth);
7146 printf("\n");
7147 }
7148 }
7149 }
7150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007151 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007152#endif
7153
Daniel Veillarda82b1822004-11-08 16:24:57 +00007154 return(test_ret);
7155}
7156
7157
7158static int
7159test_xmlDebugDumpNodeList(void) {
7160 int test_ret = 0;
7161
William M. Brack21e4ef22005-01-02 09:53:13 +00007162#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007163 int mem_base;
7164 FILE * output; /* the FILE * for the output */
7165 int n_output;
7166 xmlNodePtr node; /* the node list */
7167 int n_node;
7168 int depth; /* the indentation level. */
7169 int n_depth;
7170
7171 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7172 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7173 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7174 mem_base = xmlMemBlocks();
7175 output = gen_debug_FILE_ptr(n_output, 0);
7176 node = gen_xmlNodePtr(n_node, 1);
7177 depth = gen_int(n_depth, 2);
7178
7179 xmlDebugDumpNodeList(output, node, depth);
7180 call_tests++;
7181 des_debug_FILE_ptr(n_output, output, 0);
7182 des_xmlNodePtr(n_node, node, 1);
7183 des_int(n_depth, depth, 2);
7184 xmlResetLastError();
7185 if (mem_base != xmlMemBlocks()) {
7186 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7187 xmlMemBlocks() - mem_base);
7188 test_ret++;
7189 printf(" %d", n_output);
7190 printf(" %d", n_node);
7191 printf(" %d", n_depth);
7192 printf("\n");
7193 }
7194 }
7195 }
7196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007197 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007198#endif
7199
Daniel Veillarda82b1822004-11-08 16:24:57 +00007200 return(test_ret);
7201}
7202
7203
7204static int
7205test_xmlDebugDumpOneNode(void) {
7206 int test_ret = 0;
7207
William M. Brack21e4ef22005-01-02 09:53:13 +00007208#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007209 int mem_base;
7210 FILE * output; /* the FILE * for the output */
7211 int n_output;
7212 xmlNodePtr node; /* the node */
7213 int n_node;
7214 int depth; /* the indentation level. */
7215 int n_depth;
7216
7217 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7218 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7219 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7220 mem_base = xmlMemBlocks();
7221 output = gen_debug_FILE_ptr(n_output, 0);
7222 node = gen_xmlNodePtr(n_node, 1);
7223 depth = gen_int(n_depth, 2);
7224
7225 xmlDebugDumpOneNode(output, node, depth);
7226 call_tests++;
7227 des_debug_FILE_ptr(n_output, output, 0);
7228 des_xmlNodePtr(n_node, node, 1);
7229 des_int(n_depth, depth, 2);
7230 xmlResetLastError();
7231 if (mem_base != xmlMemBlocks()) {
7232 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7233 xmlMemBlocks() - mem_base);
7234 test_ret++;
7235 printf(" %d", n_output);
7236 printf(" %d", n_node);
7237 printf(" %d", n_depth);
7238 printf("\n");
7239 }
7240 }
7241 }
7242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007243 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007244#endif
7245
Daniel Veillarda82b1822004-11-08 16:24:57 +00007246 return(test_ret);
7247}
7248
7249
7250static int
7251test_xmlDebugDumpString(void) {
7252 int test_ret = 0;
7253
William M. Brack21e4ef22005-01-02 09:53:13 +00007254#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007255 int mem_base;
7256 FILE * output; /* the FILE * for the output */
7257 int n_output;
7258 xmlChar * str; /* the string */
7259 int n_str;
7260
7261 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7262 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7263 mem_base = xmlMemBlocks();
7264 output = gen_debug_FILE_ptr(n_output, 0);
7265 str = gen_const_xmlChar_ptr(n_str, 1);
7266
William M. Brackf13f77f2004-11-12 16:03:48 +00007267 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007268 call_tests++;
7269 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007270 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007271 xmlResetLastError();
7272 if (mem_base != xmlMemBlocks()) {
7273 printf("Leak of %d blocks found in xmlDebugDumpString",
7274 xmlMemBlocks() - mem_base);
7275 test_ret++;
7276 printf(" %d", n_output);
7277 printf(" %d", n_str);
7278 printf("\n");
7279 }
7280 }
7281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007283#endif
7284
Daniel Veillarda82b1822004-11-08 16:24:57 +00007285 return(test_ret);
7286}
7287
7288
7289static int
7290test_xmlLsCountNode(void) {
7291 int test_ret = 0;
7292
William M. Brack21e4ef22005-01-02 09:53:13 +00007293#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007294 int mem_base;
7295 int ret_val;
7296 xmlNodePtr node; /* the node to count */
7297 int n_node;
7298
7299 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7300 mem_base = xmlMemBlocks();
7301 node = gen_xmlNodePtr(n_node, 0);
7302
7303 ret_val = xmlLsCountNode(node);
7304 desret_int(ret_val);
7305 call_tests++;
7306 des_xmlNodePtr(n_node, node, 0);
7307 xmlResetLastError();
7308 if (mem_base != xmlMemBlocks()) {
7309 printf("Leak of %d blocks found in xmlLsCountNode",
7310 xmlMemBlocks() - mem_base);
7311 test_ret++;
7312 printf(" %d", n_node);
7313 printf("\n");
7314 }
7315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007316 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007317#endif
7318
Daniel Veillarda82b1822004-11-08 16:24:57 +00007319 return(test_ret);
7320}
7321
7322
7323static int
7324test_xmlLsOneNode(void) {
7325 int test_ret = 0;
7326
William M. Brack21e4ef22005-01-02 09:53:13 +00007327#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007328 int mem_base;
7329 FILE * output; /* the FILE * for the output */
7330 int n_output;
7331 xmlNodePtr node; /* the node to dump */
7332 int n_node;
7333
7334 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7335 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7336 mem_base = xmlMemBlocks();
7337 output = gen_debug_FILE_ptr(n_output, 0);
7338 node = gen_xmlNodePtr(n_node, 1);
7339
7340 xmlLsOneNode(output, node);
7341 call_tests++;
7342 des_debug_FILE_ptr(n_output, output, 0);
7343 des_xmlNodePtr(n_node, node, 1);
7344 xmlResetLastError();
7345 if (mem_base != xmlMemBlocks()) {
7346 printf("Leak of %d blocks found in xmlLsOneNode",
7347 xmlMemBlocks() - mem_base);
7348 test_ret++;
7349 printf(" %d", n_output);
7350 printf(" %d", n_node);
7351 printf("\n");
7352 }
7353 }
7354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007355 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007356#endif
7357
Daniel Veillarda82b1822004-11-08 16:24:57 +00007358 return(test_ret);
7359}
7360
7361
7362#define gen_nb_char_ptr 1
7363static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7364 return(NULL);
7365}
7366static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7367}
7368
7369static int
7370test_xmlShell(void) {
7371 int test_ret = 0;
7372
7373
7374 /* missing type support */
7375 return(test_ret);
7376}
7377
7378
Daniel Veillarda82b1822004-11-08 16:24:57 +00007379static int
7380test_xmlShellBase(void) {
7381 int test_ret = 0;
7382
William M. Brack21e4ef22005-01-02 09:53:13 +00007383#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007384 int mem_base;
7385 int ret_val;
7386 xmlShellCtxtPtr ctxt; /* the shell context */
7387 int n_ctxt;
7388 char * arg; /* unused */
7389 int n_arg;
7390 xmlNodePtr node; /* a node */
7391 int n_node;
7392 xmlNodePtr node2; /* unused */
7393 int n_node2;
7394
7395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7396 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7397 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7398 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7399 mem_base = xmlMemBlocks();
7400 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7401 arg = gen_char_ptr(n_arg, 1);
7402 node = gen_xmlNodePtr(n_node, 2);
7403 node2 = gen_xmlNodePtr(n_node2, 3);
7404
7405 ret_val = xmlShellBase(ctxt, arg, node, node2);
7406 desret_int(ret_val);
7407 call_tests++;
7408 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7409 des_char_ptr(n_arg, arg, 1);
7410 des_xmlNodePtr(n_node, node, 2);
7411 des_xmlNodePtr(n_node2, node2, 3);
7412 xmlResetLastError();
7413 if (mem_base != xmlMemBlocks()) {
7414 printf("Leak of %d blocks found in xmlShellBase",
7415 xmlMemBlocks() - mem_base);
7416 test_ret++;
7417 printf(" %d", n_ctxt);
7418 printf(" %d", n_arg);
7419 printf(" %d", n_node);
7420 printf(" %d", n_node2);
7421 printf("\n");
7422 }
7423 }
7424 }
7425 }
7426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007427 function_tests++;
7428#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007429
Daniel Veillarda82b1822004-11-08 16:24:57 +00007430 return(test_ret);
7431}
7432
7433
7434static int
7435test_xmlShellCat(void) {
7436 int test_ret = 0;
7437
William M. Brack21e4ef22005-01-02 09:53:13 +00007438#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007439 int mem_base;
7440 int ret_val;
7441 xmlShellCtxtPtr ctxt; /* the shell context */
7442 int n_ctxt;
7443 char * arg; /* unused */
7444 int n_arg;
7445 xmlNodePtr node; /* a node */
7446 int n_node;
7447 xmlNodePtr node2; /* unused */
7448 int n_node2;
7449
7450 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7451 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7452 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7453 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7454 mem_base = xmlMemBlocks();
7455 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7456 arg = gen_char_ptr(n_arg, 1);
7457 node = gen_xmlNodePtr(n_node, 2);
7458 node2 = gen_xmlNodePtr(n_node2, 3);
7459
7460 ret_val = xmlShellCat(ctxt, arg, node, node2);
7461 desret_int(ret_val);
7462 call_tests++;
7463 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7464 des_char_ptr(n_arg, arg, 1);
7465 des_xmlNodePtr(n_node, node, 2);
7466 des_xmlNodePtr(n_node2, node2, 3);
7467 xmlResetLastError();
7468 if (mem_base != xmlMemBlocks()) {
7469 printf("Leak of %d blocks found in xmlShellCat",
7470 xmlMemBlocks() - mem_base);
7471 test_ret++;
7472 printf(" %d", n_ctxt);
7473 printf(" %d", n_arg);
7474 printf(" %d", n_node);
7475 printf(" %d", n_node2);
7476 printf("\n");
7477 }
7478 }
7479 }
7480 }
7481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007482 function_tests++;
7483#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007484
Daniel Veillarda82b1822004-11-08 16:24:57 +00007485 return(test_ret);
7486}
7487
7488
7489static int
7490test_xmlShellDir(void) {
7491 int test_ret = 0;
7492
William M. Brack21e4ef22005-01-02 09:53:13 +00007493#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007494 int mem_base;
7495 int ret_val;
7496 xmlShellCtxtPtr ctxt; /* the shell context */
7497 int n_ctxt;
7498 char * arg; /* unused */
7499 int n_arg;
7500 xmlNodePtr node; /* a node */
7501 int n_node;
7502 xmlNodePtr node2; /* unused */
7503 int n_node2;
7504
7505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7506 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7507 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7508 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7509 mem_base = xmlMemBlocks();
7510 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7511 arg = gen_char_ptr(n_arg, 1);
7512 node = gen_xmlNodePtr(n_node, 2);
7513 node2 = gen_xmlNodePtr(n_node2, 3);
7514
7515 ret_val = xmlShellDir(ctxt, arg, node, node2);
7516 desret_int(ret_val);
7517 call_tests++;
7518 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7519 des_char_ptr(n_arg, arg, 1);
7520 des_xmlNodePtr(n_node, node, 2);
7521 des_xmlNodePtr(n_node2, node2, 3);
7522 xmlResetLastError();
7523 if (mem_base != xmlMemBlocks()) {
7524 printf("Leak of %d blocks found in xmlShellDir",
7525 xmlMemBlocks() - mem_base);
7526 test_ret++;
7527 printf(" %d", n_ctxt);
7528 printf(" %d", n_arg);
7529 printf(" %d", n_node);
7530 printf(" %d", n_node2);
7531 printf("\n");
7532 }
7533 }
7534 }
7535 }
7536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007537 function_tests++;
7538#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007539
Daniel Veillarda82b1822004-11-08 16:24:57 +00007540 return(test_ret);
7541}
7542
7543
7544static int
7545test_xmlShellDu(void) {
7546 int test_ret = 0;
7547
William M. Brack21e4ef22005-01-02 09:53:13 +00007548#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007549 int mem_base;
7550 int ret_val;
7551 xmlShellCtxtPtr ctxt; /* the shell context */
7552 int n_ctxt;
7553 char * arg; /* unused */
7554 int n_arg;
7555 xmlNodePtr tree; /* a node defining a subtree */
7556 int n_tree;
7557 xmlNodePtr node2; /* unused */
7558 int n_node2;
7559
7560 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7561 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7562 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7563 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7564 mem_base = xmlMemBlocks();
7565 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7566 arg = gen_char_ptr(n_arg, 1);
7567 tree = gen_xmlNodePtr(n_tree, 2);
7568 node2 = gen_xmlNodePtr(n_node2, 3);
7569
7570 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7571 desret_int(ret_val);
7572 call_tests++;
7573 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7574 des_char_ptr(n_arg, arg, 1);
7575 des_xmlNodePtr(n_tree, tree, 2);
7576 des_xmlNodePtr(n_node2, node2, 3);
7577 xmlResetLastError();
7578 if (mem_base != xmlMemBlocks()) {
7579 printf("Leak of %d blocks found in xmlShellDu",
7580 xmlMemBlocks() - mem_base);
7581 test_ret++;
7582 printf(" %d", n_ctxt);
7583 printf(" %d", n_arg);
7584 printf(" %d", n_tree);
7585 printf(" %d", n_node2);
7586 printf("\n");
7587 }
7588 }
7589 }
7590 }
7591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007592 function_tests++;
7593#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007594
Daniel Veillarda82b1822004-11-08 16:24:57 +00007595 return(test_ret);
7596}
7597
7598
7599static int
7600test_xmlShellList(void) {
7601 int test_ret = 0;
7602
William M. Brack21e4ef22005-01-02 09:53:13 +00007603#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007604 int mem_base;
7605 int ret_val;
7606 xmlShellCtxtPtr ctxt; /* the shell context */
7607 int n_ctxt;
7608 char * arg; /* unused */
7609 int n_arg;
7610 xmlNodePtr node; /* a node */
7611 int n_node;
7612 xmlNodePtr node2; /* unused */
7613 int n_node2;
7614
7615 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7616 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7617 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7618 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7619 mem_base = xmlMemBlocks();
7620 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7621 arg = gen_char_ptr(n_arg, 1);
7622 node = gen_xmlNodePtr(n_node, 2);
7623 node2 = gen_xmlNodePtr(n_node2, 3);
7624
7625 ret_val = xmlShellList(ctxt, arg, node, node2);
7626 desret_int(ret_val);
7627 call_tests++;
7628 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7629 des_char_ptr(n_arg, arg, 1);
7630 des_xmlNodePtr(n_node, node, 2);
7631 des_xmlNodePtr(n_node2, node2, 3);
7632 xmlResetLastError();
7633 if (mem_base != xmlMemBlocks()) {
7634 printf("Leak of %d blocks found in xmlShellList",
7635 xmlMemBlocks() - mem_base);
7636 test_ret++;
7637 printf(" %d", n_ctxt);
7638 printf(" %d", n_arg);
7639 printf(" %d", n_node);
7640 printf(" %d", n_node2);
7641 printf("\n");
7642 }
7643 }
7644 }
7645 }
7646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007647 function_tests++;
7648#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007649
Daniel Veillarda82b1822004-11-08 16:24:57 +00007650 return(test_ret);
7651}
7652
7653
7654static int
7655test_xmlShellLoad(void) {
7656 int test_ret = 0;
7657
William M. Brack21e4ef22005-01-02 09:53:13 +00007658#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007659 int mem_base;
7660 int ret_val;
7661 xmlShellCtxtPtr ctxt; /* the shell context */
7662 int n_ctxt;
7663 char * filename; /* the file name */
7664 int n_filename;
7665 xmlNodePtr node; /* unused */
7666 int n_node;
7667 xmlNodePtr node2; /* unused */
7668 int n_node2;
7669
7670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7671 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7672 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7673 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7674 mem_base = xmlMemBlocks();
7675 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7676 filename = gen_char_ptr(n_filename, 1);
7677 node = gen_xmlNodePtr(n_node, 2);
7678 node2 = gen_xmlNodePtr(n_node2, 3);
7679
7680 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7681 desret_int(ret_val);
7682 call_tests++;
7683 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7684 des_char_ptr(n_filename, filename, 1);
7685 des_xmlNodePtr(n_node, node, 2);
7686 des_xmlNodePtr(n_node2, node2, 3);
7687 xmlResetLastError();
7688 if (mem_base != xmlMemBlocks()) {
7689 printf("Leak of %d blocks found in xmlShellLoad",
7690 xmlMemBlocks() - mem_base);
7691 test_ret++;
7692 printf(" %d", n_ctxt);
7693 printf(" %d", n_filename);
7694 printf(" %d", n_node);
7695 printf(" %d", n_node2);
7696 printf("\n");
7697 }
7698 }
7699 }
7700 }
7701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007702 function_tests++;
7703#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007704
Daniel Veillarda82b1822004-11-08 16:24:57 +00007705 return(test_ret);
7706}
7707
7708
7709static int
7710test_xmlShellPrintXPathResult(void) {
7711 int test_ret = 0;
7712
William M. Brack21e4ef22005-01-02 09:53:13 +00007713#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007714 int mem_base;
7715 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7716 int n_list;
7717
7718 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7719 mem_base = xmlMemBlocks();
7720 list = gen_xmlXPathObjectPtr(n_list, 0);
7721
7722 xmlShellPrintXPathResult(list);
7723 call_tests++;
7724 des_xmlXPathObjectPtr(n_list, list, 0);
7725 xmlResetLastError();
7726 if (mem_base != xmlMemBlocks()) {
7727 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7728 xmlMemBlocks() - mem_base);
7729 test_ret++;
7730 printf(" %d", n_list);
7731 printf("\n");
7732 }
7733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007734 function_tests++;
7735#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007736
Daniel Veillarda82b1822004-11-08 16:24:57 +00007737 return(test_ret);
7738}
7739
7740
7741static int
7742test_xmlShellPwd(void) {
7743 int test_ret = 0;
7744
William M. Brack21e4ef22005-01-02 09:53:13 +00007745#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007746 int mem_base;
7747 int ret_val;
7748 xmlShellCtxtPtr ctxt; /* the shell context */
7749 int n_ctxt;
7750 char * buffer; /* the output buffer */
7751 int n_buffer;
7752 xmlNodePtr node; /* a node */
7753 int n_node;
7754 xmlNodePtr node2; /* unused */
7755 int n_node2;
7756
7757 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7758 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7759 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7760 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7761 mem_base = xmlMemBlocks();
7762 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7763 buffer = gen_char_ptr(n_buffer, 1);
7764 node = gen_xmlNodePtr(n_node, 2);
7765 node2 = gen_xmlNodePtr(n_node2, 3);
7766
7767 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7768 desret_int(ret_val);
7769 call_tests++;
7770 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7771 des_char_ptr(n_buffer, buffer, 1);
7772 des_xmlNodePtr(n_node, node, 2);
7773 des_xmlNodePtr(n_node2, node2, 3);
7774 xmlResetLastError();
7775 if (mem_base != xmlMemBlocks()) {
7776 printf("Leak of %d blocks found in xmlShellPwd",
7777 xmlMemBlocks() - mem_base);
7778 test_ret++;
7779 printf(" %d", n_ctxt);
7780 printf(" %d", n_buffer);
7781 printf(" %d", n_node);
7782 printf(" %d", n_node2);
7783 printf("\n");
7784 }
7785 }
7786 }
7787 }
7788 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007789 function_tests++;
7790#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007791
Daniel Veillarda82b1822004-11-08 16:24:57 +00007792 return(test_ret);
7793}
7794
7795
7796static int
7797test_xmlShellSave(void) {
7798 int test_ret = 0;
7799
William M. Brack21e4ef22005-01-02 09:53:13 +00007800#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007801 int mem_base;
7802 int ret_val;
7803 xmlShellCtxtPtr ctxt; /* the shell context */
7804 int n_ctxt;
7805 char * filename; /* the file name (optional) */
7806 int n_filename;
7807 xmlNodePtr node; /* unused */
7808 int n_node;
7809 xmlNodePtr node2; /* unused */
7810 int n_node2;
7811
7812 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7813 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7814 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7815 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7816 mem_base = xmlMemBlocks();
7817 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7818 filename = gen_char_ptr(n_filename, 1);
7819 node = gen_xmlNodePtr(n_node, 2);
7820 node2 = gen_xmlNodePtr(n_node2, 3);
7821
7822 ret_val = xmlShellSave(ctxt, filename, node, node2);
7823 desret_int(ret_val);
7824 call_tests++;
7825 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7826 des_char_ptr(n_filename, filename, 1);
7827 des_xmlNodePtr(n_node, node, 2);
7828 des_xmlNodePtr(n_node2, node2, 3);
7829 xmlResetLastError();
7830 if (mem_base != xmlMemBlocks()) {
7831 printf("Leak of %d blocks found in xmlShellSave",
7832 xmlMemBlocks() - mem_base);
7833 test_ret++;
7834 printf(" %d", n_ctxt);
7835 printf(" %d", n_filename);
7836 printf(" %d", n_node);
7837 printf(" %d", n_node2);
7838 printf("\n");
7839 }
7840 }
7841 }
7842 }
7843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007844 function_tests++;
7845#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007846
Daniel Veillarda82b1822004-11-08 16:24:57 +00007847 return(test_ret);
7848}
7849
7850
7851static int
7852test_xmlShellValidate(void) {
7853 int test_ret = 0;
7854
William M. Brack21e4ef22005-01-02 09:53:13 +00007855#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007856 int mem_base;
7857 int ret_val;
7858 xmlShellCtxtPtr ctxt; /* the shell context */
7859 int n_ctxt;
7860 char * dtd; /* the DTD URI (optional) */
7861 int n_dtd;
7862 xmlNodePtr node; /* unused */
7863 int n_node;
7864 xmlNodePtr node2; /* unused */
7865 int n_node2;
7866
7867 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7868 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7869 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7870 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7871 mem_base = xmlMemBlocks();
7872 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7873 dtd = gen_char_ptr(n_dtd, 1);
7874 node = gen_xmlNodePtr(n_node, 2);
7875 node2 = gen_xmlNodePtr(n_node2, 3);
7876
7877 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7878 desret_int(ret_val);
7879 call_tests++;
7880 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7881 des_char_ptr(n_dtd, dtd, 1);
7882 des_xmlNodePtr(n_node, node, 2);
7883 des_xmlNodePtr(n_node2, node2, 3);
7884 xmlResetLastError();
7885 if (mem_base != xmlMemBlocks()) {
7886 printf("Leak of %d blocks found in xmlShellValidate",
7887 xmlMemBlocks() - mem_base);
7888 test_ret++;
7889 printf(" %d", n_ctxt);
7890 printf(" %d", n_dtd);
7891 printf(" %d", n_node);
7892 printf(" %d", n_node2);
7893 printf("\n");
7894 }
7895 }
7896 }
7897 }
7898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007899 function_tests++;
7900#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007901
Daniel Veillarda82b1822004-11-08 16:24:57 +00007902 return(test_ret);
7903}
7904
7905
7906static int
7907test_xmlShellWrite(void) {
7908 int test_ret = 0;
7909
William M. Brack21e4ef22005-01-02 09:53:13 +00007910#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007911 int mem_base;
7912 int ret_val;
7913 xmlShellCtxtPtr ctxt; /* the shell context */
7914 int n_ctxt;
7915 char * filename; /* the file name */
7916 int n_filename;
7917 xmlNodePtr node; /* a node in the tree */
7918 int n_node;
7919 xmlNodePtr node2; /* unused */
7920 int n_node2;
7921
7922 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7923 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7924 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7925 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7926 mem_base = xmlMemBlocks();
7927 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7928 filename = gen_char_ptr(n_filename, 1);
7929 node = gen_xmlNodePtr(n_node, 2);
7930 node2 = gen_xmlNodePtr(n_node2, 3);
7931
7932 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7933 desret_int(ret_val);
7934 call_tests++;
7935 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7936 des_char_ptr(n_filename, filename, 1);
7937 des_xmlNodePtr(n_node, node, 2);
7938 des_xmlNodePtr(n_node2, node2, 3);
7939 xmlResetLastError();
7940 if (mem_base != xmlMemBlocks()) {
7941 printf("Leak of %d blocks found in xmlShellWrite",
7942 xmlMemBlocks() - mem_base);
7943 test_ret++;
7944 printf(" %d", n_ctxt);
7945 printf(" %d", n_filename);
7946 printf(" %d", n_node);
7947 printf(" %d", n_node2);
7948 printf("\n");
7949 }
7950 }
7951 }
7952 }
7953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007954 function_tests++;
7955#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007956
Daniel Veillarda82b1822004-11-08 16:24:57 +00007957 return(test_ret);
7958}
7959
7960static int
7961test_debugXML(void) {
7962 int test_ret = 0;
7963
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007964 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007965 test_ret += test_xmlBoolToText();
7966 test_ret += test_xmlDebugCheckDocument();
7967 test_ret += test_xmlDebugDumpAttr();
7968 test_ret += test_xmlDebugDumpAttrList();
7969 test_ret += test_xmlDebugDumpDTD();
7970 test_ret += test_xmlDebugDumpDocument();
7971 test_ret += test_xmlDebugDumpDocumentHead();
7972 test_ret += test_xmlDebugDumpEntities();
7973 test_ret += test_xmlDebugDumpNode();
7974 test_ret += test_xmlDebugDumpNodeList();
7975 test_ret += test_xmlDebugDumpOneNode();
7976 test_ret += test_xmlDebugDumpString();
7977 test_ret += test_xmlLsCountNode();
7978 test_ret += test_xmlLsOneNode();
7979 test_ret += test_xmlShell();
7980 test_ret += test_xmlShellBase();
7981 test_ret += test_xmlShellCat();
7982 test_ret += test_xmlShellDir();
7983 test_ret += test_xmlShellDu();
7984 test_ret += test_xmlShellList();
7985 test_ret += test_xmlShellLoad();
7986 test_ret += test_xmlShellPrintXPathResult();
7987 test_ret += test_xmlShellPwd();
7988 test_ret += test_xmlShellSave();
7989 test_ret += test_xmlShellValidate();
7990 test_ret += test_xmlShellWrite();
7991
7992 if (test_ret != 0)
7993 printf("Module debugXML: %d errors\n", test_ret);
7994 return(test_ret);
7995}
7996
7997static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007998test_xmlDictCleanup(void) {
7999 int test_ret = 0;
8000
8001 int mem_base;
8002
8003 mem_base = xmlMemBlocks();
8004
8005 xmlDictCleanup();
8006 call_tests++;
8007 xmlResetLastError();
8008 if (mem_base != xmlMemBlocks()) {
8009 printf("Leak of %d blocks found in xmlDictCleanup",
8010 xmlMemBlocks() - mem_base);
8011 test_ret++;
8012 printf("\n");
8013 }
8014 function_tests++;
8015
8016 return(test_ret);
8017}
8018
8019
8020static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008021test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008023
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008024 int mem_base;
8025 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008026
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008027 mem_base = xmlMemBlocks();
8028
8029 ret_val = xmlDictCreate();
8030 desret_xmlDictPtr(ret_val);
8031 call_tests++;
8032 xmlResetLastError();
8033 if (mem_base != xmlMemBlocks()) {
8034 printf("Leak of %d blocks found in xmlDictCreate",
8035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008036 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008037 printf("\n");
8038 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008039 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008040
Daniel Veillard42595322004-11-08 10:52:06 +00008041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008042}
8043
8044
8045static int
8046test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008048
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008049 int mem_base;
8050 xmlDictPtr ret_val;
8051 xmlDictPtr sub; /* an existing dictionnary */
8052 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008053
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008054 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8055 mem_base = xmlMemBlocks();
8056 sub = gen_xmlDictPtr(n_sub, 0);
8057
8058 ret_val = xmlDictCreateSub(sub);
8059 desret_xmlDictPtr(ret_val);
8060 call_tests++;
8061 des_xmlDictPtr(n_sub, sub, 0);
8062 xmlResetLastError();
8063 if (mem_base != xmlMemBlocks()) {
8064 printf("Leak of %d blocks found in xmlDictCreateSub",
8065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008066 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008067 printf(" %d", n_sub);
8068 printf("\n");
8069 }
8070 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008071 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008072
Daniel Veillard42595322004-11-08 10:52:06 +00008073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008074}
8075
8076
8077static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008078test_xmlDictExists(void) {
8079 int test_ret = 0;
8080
8081 int mem_base;
8082 const xmlChar * ret_val;
8083 xmlDictPtr dict; /* the dictionnary */
8084 int n_dict;
8085 xmlChar * name; /* the name of the userdata */
8086 int n_name;
8087 int len; /* the length of the name, if -1 it is recomputed */
8088 int n_len;
8089
8090 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8091 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8092 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8093 mem_base = xmlMemBlocks();
8094 dict = gen_xmlDictPtr(n_dict, 0);
8095 name = gen_const_xmlChar_ptr(n_name, 1);
8096 len = gen_int(n_len, 2);
8097
8098 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8099 desret_const_xmlChar_ptr(ret_val);
8100 call_tests++;
8101 des_xmlDictPtr(n_dict, dict, 0);
8102 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8103 des_int(n_len, len, 2);
8104 xmlResetLastError();
8105 if (mem_base != xmlMemBlocks()) {
8106 printf("Leak of %d blocks found in xmlDictExists",
8107 xmlMemBlocks() - mem_base);
8108 test_ret++;
8109 printf(" %d", n_dict);
8110 printf(" %d", n_name);
8111 printf(" %d", n_len);
8112 printf("\n");
8113 }
8114 }
8115 }
8116 }
8117 function_tests++;
8118
8119 return(test_ret);
8120}
8121
8122
8123static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008124test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008126
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008127 int mem_base;
8128 const xmlChar * ret_val;
8129 xmlDictPtr dict; /* the dictionnary */
8130 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008131 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008132 int n_name;
8133 int len; /* the length of the name, if -1 it is recomputed */
8134 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008135
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008136 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8138 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8139 mem_base = xmlMemBlocks();
8140 dict = gen_xmlDictPtr(n_dict, 0);
8141 name = gen_const_xmlChar_ptr(n_name, 1);
8142 len = gen_int(n_len, 2);
8143
William M. Brackf13f77f2004-11-12 16:03:48 +00008144 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008145 desret_const_xmlChar_ptr(ret_val);
8146 call_tests++;
8147 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008148 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008149 des_int(n_len, len, 2);
8150 xmlResetLastError();
8151 if (mem_base != xmlMemBlocks()) {
8152 printf("Leak of %d blocks found in xmlDictLookup",
8153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008154 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 printf(" %d", n_dict);
8156 printf(" %d", n_name);
8157 printf(" %d", n_len);
8158 printf("\n");
8159 }
8160 }
8161 }
8162 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008163 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008164
Daniel Veillard42595322004-11-08 10:52:06 +00008165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008166}
8167
8168
8169static int
8170test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008172
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008173 int mem_base;
8174 int ret_val;
8175 xmlDictPtr dict; /* the dictionnary */
8176 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008177 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008179
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008180 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8181 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8182 mem_base = xmlMemBlocks();
8183 dict = gen_xmlDictPtr(n_dict, 0);
8184 str = gen_const_xmlChar_ptr(n_str, 1);
8185
William M. Brackf13f77f2004-11-12 16:03:48 +00008186 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008187 desret_int(ret_val);
8188 call_tests++;
8189 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008190 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 xmlResetLastError();
8192 if (mem_base != xmlMemBlocks()) {
8193 printf("Leak of %d blocks found in xmlDictOwns",
8194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008195 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008196 printf(" %d", n_dict);
8197 printf(" %d", n_str);
8198 printf("\n");
8199 }
8200 }
8201 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008203
Daniel Veillard42595322004-11-08 10:52:06 +00008204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008205}
8206
8207
8208static int
8209test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008211
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008212 int mem_base;
8213 const xmlChar * ret_val;
8214 xmlDictPtr dict; /* the dictionnary */
8215 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008216 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008217 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008218 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008219 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008220
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008221 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8222 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8223 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8224 mem_base = xmlMemBlocks();
8225 dict = gen_xmlDictPtr(n_dict, 0);
8226 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8227 name = gen_const_xmlChar_ptr(n_name, 2);
8228
William M. Brackf13f77f2004-11-12 16:03:48 +00008229 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008230 desret_const_xmlChar_ptr(ret_val);
8231 call_tests++;
8232 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008233 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008235 xmlResetLastError();
8236 if (mem_base != xmlMemBlocks()) {
8237 printf("Leak of %d blocks found in xmlDictQLookup",
8238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008239 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008240 printf(" %d", n_dict);
8241 printf(" %d", n_prefix);
8242 printf(" %d", n_name);
8243 printf("\n");
8244 }
8245 }
8246 }
8247 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008249
Daniel Veillard42595322004-11-08 10:52:06 +00008250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008251}
8252
8253
8254static int
8255test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008257
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008258 int mem_base;
8259 int ret_val;
8260 xmlDictPtr dict; /* the dictionnary */
8261 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008262
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008263 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8264 mem_base = xmlMemBlocks();
8265 dict = gen_xmlDictPtr(n_dict, 0);
8266
8267 ret_val = xmlDictReference(dict);
8268 xmlDictFree(dict);
8269 desret_int(ret_val);
8270 call_tests++;
8271 des_xmlDictPtr(n_dict, dict, 0);
8272 xmlResetLastError();
8273 if (mem_base != xmlMemBlocks()) {
8274 printf("Leak of %d blocks found in xmlDictReference",
8275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008276 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008277 printf(" %d", n_dict);
8278 printf("\n");
8279 }
8280 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008281 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008282
Daniel Veillard42595322004-11-08 10:52:06 +00008283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008284}
8285
8286
8287static int
8288test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008290
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008291 int mem_base;
8292 int ret_val;
8293 xmlDictPtr dict; /* the dictionnary */
8294 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008295
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008296 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8297 mem_base = xmlMemBlocks();
8298 dict = gen_xmlDictPtr(n_dict, 0);
8299
8300 ret_val = xmlDictSize(dict);
8301 desret_int(ret_val);
8302 call_tests++;
8303 des_xmlDictPtr(n_dict, dict, 0);
8304 xmlResetLastError();
8305 if (mem_base != xmlMemBlocks()) {
8306 printf("Leak of %d blocks found in xmlDictSize",
8307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008308 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008309 printf(" %d", n_dict);
8310 printf("\n");
8311 }
8312 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008313 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008314
Daniel Veillard42595322004-11-08 10:52:06 +00008315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008316}
8317
8318static int
8319test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008321
Daniel Veillard2ae13382005-01-25 23:45:06 +00008322 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8323 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008324 test_ret += test_xmlDictCreate();
8325 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008326 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008327 test_ret += test_xmlDictLookup();
8328 test_ret += test_xmlDictOwns();
8329 test_ret += test_xmlDictQLookup();
8330 test_ret += test_xmlDictReference();
8331 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008332
Daniel Veillard42595322004-11-08 10:52:06 +00008333 if (test_ret != 0)
8334 printf("Module dict: %d errors\n", test_ret);
8335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008336}
8337
8338static int
8339test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008341
William M. Brack21e4ef22005-01-02 09:53:13 +00008342#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008343#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008344 int mem_base;
8345 int ret_val;
8346 unsigned char * out; /* a pointer to an array of bytes to store the result */
8347 int n_out;
8348 int * outlen; /* the length of @out */
8349 int n_outlen;
8350 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8351 int n_in;
8352 int * inlen; /* the length of @in */
8353 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008354
Daniel Veillardce682bc2004-11-05 17:22:25 +00008355 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8356 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8357 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8358 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8359 mem_base = xmlMemBlocks();
8360 out = gen_unsigned_char_ptr(n_out, 0);
8361 outlen = gen_int_ptr(n_outlen, 1);
8362 in = gen_const_unsigned_char_ptr(n_in, 2);
8363 inlen = gen_int_ptr(n_inlen, 3);
8364
William M. Brackf13f77f2004-11-12 16:03:48 +00008365 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008366 desret_int(ret_val);
8367 call_tests++;
8368 des_unsigned_char_ptr(n_out, out, 0);
8369 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008370 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008371 des_int_ptr(n_inlen, inlen, 3);
8372 xmlResetLastError();
8373 if (mem_base != xmlMemBlocks()) {
8374 printf("Leak of %d blocks found in UTF8Toisolat1",
8375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008376 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008377 printf(" %d", n_out);
8378 printf(" %d", n_outlen);
8379 printf(" %d", n_in);
8380 printf(" %d", n_inlen);
8381 printf("\n");
8382 }
8383 }
8384 }
8385 }
8386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008387 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008388#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008389#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008390
Daniel Veillard42595322004-11-08 10:52:06 +00008391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008392}
8393
8394
8395static int
8396test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008398
Daniel Veillardce682bc2004-11-05 17:22:25 +00008399 int mem_base;
8400 int ret_val;
8401 unsigned char * out; /* a pointer to an array of bytes to store the result */
8402 int n_out;
8403 int * outlen; /* the length of @out */
8404 int n_outlen;
8405 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8406 int n_in;
8407 int * inlen; /* the length of @in */
8408 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008409
Daniel Veillardce682bc2004-11-05 17:22:25 +00008410 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8411 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8412 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8413 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8414 mem_base = xmlMemBlocks();
8415 out = gen_unsigned_char_ptr(n_out, 0);
8416 outlen = gen_int_ptr(n_outlen, 1);
8417 in = gen_const_unsigned_char_ptr(n_in, 2);
8418 inlen = gen_int_ptr(n_inlen, 3);
8419
William M. Brackf13f77f2004-11-12 16:03:48 +00008420 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 desret_int(ret_val);
8422 call_tests++;
8423 des_unsigned_char_ptr(n_out, out, 0);
8424 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008425 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008426 des_int_ptr(n_inlen, inlen, 3);
8427 xmlResetLastError();
8428 if (mem_base != xmlMemBlocks()) {
8429 printf("Leak of %d blocks found in isolat1ToUTF8",
8430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008431 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008432 printf(" %d", n_out);
8433 printf(" %d", n_outlen);
8434 printf(" %d", n_in);
8435 printf(" %d", n_inlen);
8436 printf("\n");
8437 }
8438 }
8439 }
8440 }
8441 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008443
Daniel Veillard42595322004-11-08 10:52:06 +00008444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008445}
8446
8447
8448static int
8449test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008451
8452 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008453 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008454 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008455 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008456 int n_alias;
8457
8458 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8459 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008460 name = gen_const_char_ptr(n_name, 0);
8461 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008462
William M. Brackf13f77f2004-11-12 16:03:48 +00008463 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008464 desret_int(ret_val);
8465 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008466 des_const_char_ptr(n_name, (const char *)name, 0);
8467 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008468 xmlResetLastError();
8469 }
8470 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008471 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008472
Daniel Veillard42595322004-11-08 10:52:06 +00008473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008474}
8475
8476
Daniel Veillardce682bc2004-11-05 17:22:25 +00008477#define gen_nb_xmlCharEncodingHandler_ptr 1
8478static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8479 return(NULL);
8480}
8481static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8482}
8483
Daniel Veillardd93f6252004-11-02 15:53:51 +00008484static int
8485test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008487
Daniel Veillardce682bc2004-11-05 17:22:25 +00008488 int mem_base;
8489 int ret_val;
8490 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8491 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008492
Daniel Veillardce682bc2004-11-05 17:22:25 +00008493 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8494 mem_base = xmlMemBlocks();
8495 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8496
8497 ret_val = xmlCharEncCloseFunc(handler);
8498 desret_int(ret_val);
8499 call_tests++;
8500 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8501 xmlResetLastError();
8502 if (mem_base != xmlMemBlocks()) {
8503 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008505 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008506 printf(" %d", n_handler);
8507 printf("\n");
8508 }
8509 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008510 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008511
Daniel Veillard42595322004-11-08 10:52:06 +00008512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008513}
8514
8515
8516static int
8517test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008519
Daniel Veillardce682bc2004-11-05 17:22:25 +00008520 int mem_base;
8521 int ret_val;
8522 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8523 int n_handler;
8524 xmlBufferPtr out; /* an xmlBuffer for the output. */
8525 int n_out;
8526 xmlBufferPtr in; /* an xmlBuffer for the input */
8527 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008528
Daniel Veillardce682bc2004-11-05 17:22:25 +00008529 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8530 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8531 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8532 mem_base = xmlMemBlocks();
8533 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8534 out = gen_xmlBufferPtr(n_out, 1);
8535 in = gen_xmlBufferPtr(n_in, 2);
8536
8537 ret_val = xmlCharEncFirstLine(handler, out, in);
8538 desret_int(ret_val);
8539 call_tests++;
8540 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8541 des_xmlBufferPtr(n_out, out, 1);
8542 des_xmlBufferPtr(n_in, in, 2);
8543 xmlResetLastError();
8544 if (mem_base != xmlMemBlocks()) {
8545 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008547 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008548 printf(" %d", n_handler);
8549 printf(" %d", n_out);
8550 printf(" %d", n_in);
8551 printf("\n");
8552 }
8553 }
8554 }
8555 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008557
Daniel Veillard42595322004-11-08 10:52:06 +00008558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008559}
8560
8561
8562static int
8563test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008565
Daniel Veillardce682bc2004-11-05 17:22:25 +00008566 int mem_base;
8567 int ret_val;
8568 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8569 int n_handler;
8570 xmlBufferPtr out; /* an xmlBuffer for the output. */
8571 int n_out;
8572 xmlBufferPtr in; /* an xmlBuffer for the input */
8573 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008574
Daniel Veillardce682bc2004-11-05 17:22:25 +00008575 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8576 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8577 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8578 mem_base = xmlMemBlocks();
8579 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8580 out = gen_xmlBufferPtr(n_out, 1);
8581 in = gen_xmlBufferPtr(n_in, 2);
8582
8583 ret_val = xmlCharEncInFunc(handler, out, in);
8584 desret_int(ret_val);
8585 call_tests++;
8586 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8587 des_xmlBufferPtr(n_out, out, 1);
8588 des_xmlBufferPtr(n_in, in, 2);
8589 xmlResetLastError();
8590 if (mem_base != xmlMemBlocks()) {
8591 printf("Leak of %d blocks found in xmlCharEncInFunc",
8592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008593 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008594 printf(" %d", n_handler);
8595 printf(" %d", n_out);
8596 printf(" %d", n_in);
8597 printf("\n");
8598 }
8599 }
8600 }
8601 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008602 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008603
Daniel Veillard42595322004-11-08 10:52:06 +00008604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008605}
8606
8607
8608static int
8609test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008611
Daniel Veillardce682bc2004-11-05 17:22:25 +00008612 int mem_base;
8613 int ret_val;
8614 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8615 int n_handler;
8616 xmlBufferPtr out; /* an xmlBuffer for the output. */
8617 int n_out;
8618 xmlBufferPtr in; /* an xmlBuffer for the input */
8619 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008620
Daniel Veillardce682bc2004-11-05 17:22:25 +00008621 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8622 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8623 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8624 mem_base = xmlMemBlocks();
8625 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8626 out = gen_xmlBufferPtr(n_out, 1);
8627 in = gen_xmlBufferPtr(n_in, 2);
8628
8629 ret_val = xmlCharEncOutFunc(handler, out, in);
8630 desret_int(ret_val);
8631 call_tests++;
8632 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8633 des_xmlBufferPtr(n_out, out, 1);
8634 des_xmlBufferPtr(n_in, in, 2);
8635 xmlResetLastError();
8636 if (mem_base != xmlMemBlocks()) {
8637 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008639 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008640 printf(" %d", n_handler);
8641 printf(" %d", n_out);
8642 printf(" %d", n_in);
8643 printf("\n");
8644 }
8645 }
8646 }
8647 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008648 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008649
Daniel Veillard42595322004-11-08 10:52:06 +00008650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008651}
8652
8653
8654static int
8655test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008657
8658
8659
8660 xmlCleanupCharEncodingHandlers();
8661 call_tests++;
8662 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008663 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008664
Daniel Veillard42595322004-11-08 10:52:06 +00008665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008666}
8667
8668
8669static int
8670test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008672
8673 int mem_base;
8674
8675 mem_base = xmlMemBlocks();
8676
8677 xmlCleanupEncodingAliases();
8678 call_tests++;
8679 xmlResetLastError();
8680 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008681 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008684 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008687
Daniel Veillard42595322004-11-08 10:52:06 +00008688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008689}
8690
8691
8692static int
8693test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695
8696 int mem_base;
8697 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008698 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008699 int n_alias;
8700
8701 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008703 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008704
William M. Brackf13f77f2004-11-12 16:03:48 +00008705 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008706 desret_int(ret_val);
8707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008708 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008709 xmlResetLastError();
8710 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008711 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008713 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008714 printf(" %d", n_alias);
8715 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008716 }
8717 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008718 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008719
Daniel Veillard42595322004-11-08 10:52:06 +00008720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008721}
8722
8723
8724static int
8725test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008727
Daniel Veillardce682bc2004-11-05 17:22:25 +00008728 int mem_base;
8729 xmlCharEncoding ret_val;
8730 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). */
8731 int n_in;
8732 int len; /* pointer to the length of the buffer */
8733 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734
Daniel Veillardce682bc2004-11-05 17:22:25 +00008735 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8736 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8737 mem_base = xmlMemBlocks();
8738 in = gen_const_unsigned_char_ptr(n_in, 0);
8739 len = gen_int(n_len, 1);
8740
William M. Brackf13f77f2004-11-12 16:03:48 +00008741 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008742 desret_xmlCharEncoding(ret_val);
8743 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008744 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008745 des_int(n_len, len, 1);
8746 xmlResetLastError();
8747 if (mem_base != xmlMemBlocks()) {
8748 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008750 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008751 printf(" %d", n_in);
8752 printf(" %d", n_len);
8753 printf("\n");
8754 }
8755 }
8756 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008757 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008758
Daniel Veillard42595322004-11-08 10:52:06 +00008759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008760}
8761
8762
8763static int
8764test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008766
8767
8768 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770}
8771
8772
8773static int
8774test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008776
8777
8778 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008780}
8781
8782
8783static int
8784test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008786
Daniel Veillard3d97e662004-11-04 10:49:00 +00008787 int mem_base;
8788 const char * ret_val;
8789 xmlCharEncoding enc; /* the encoding */
8790 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791
Daniel Veillard3d97e662004-11-04 10:49:00 +00008792 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8793 mem_base = xmlMemBlocks();
8794 enc = gen_xmlCharEncoding(n_enc, 0);
8795
8796 ret_val = xmlGetCharEncodingName(enc);
8797 desret_const_char_ptr(ret_val);
8798 call_tests++;
8799 des_xmlCharEncoding(n_enc, enc, 0);
8800 xmlResetLastError();
8801 if (mem_base != xmlMemBlocks()) {
8802 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008804 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 printf(" %d", n_enc);
8806 printf("\n");
8807 }
8808 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008809 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008810
Daniel Veillard42595322004-11-08 10:52:06 +00008811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008812}
8813
8814
8815static int
8816test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818
8819 int mem_base;
8820 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008821 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008822 int n_alias;
8823
8824 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008826 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008827
William M. Brackf13f77f2004-11-12 16:03:48 +00008828 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829 desret_const_char_ptr(ret_val);
8830 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008831 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008832 xmlResetLastError();
8833 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008834 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008836 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008837 printf(" %d", n_alias);
8838 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008839 }
8840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008842
Daniel Veillard42595322004-11-08 10:52:06 +00008843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844}
8845
8846
8847static int
8848test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008850
8851
8852
8853 xmlInitCharEncodingHandlers();
8854 call_tests++;
8855 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008856 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008857
Daniel Veillard42595322004-11-08 10:52:06 +00008858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008859}
8860
8861
8862static int
8863test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008865
8866
8867 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008869}
8870
8871
8872static int
8873test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008875
Daniel Veillard3d97e662004-11-04 10:49:00 +00008876 int mem_base;
8877 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008878 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008879 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880
Daniel Veillard3d97e662004-11-04 10:49:00 +00008881 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8882 mem_base = xmlMemBlocks();
8883 name = gen_const_char_ptr(n_name, 0);
8884
William M. Brackf13f77f2004-11-12 16:03:48 +00008885 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008886 desret_xmlCharEncoding(ret_val);
8887 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008888 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008889 xmlResetLastError();
8890 if (mem_base != xmlMemBlocks()) {
8891 printf("Leak of %d blocks found in xmlParseCharEncoding",
8892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008893 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008894 printf(" %d", n_name);
8895 printf("\n");
8896 }
8897 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008898 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008899
Daniel Veillard42595322004-11-08 10:52:06 +00008900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008901}
8902
8903
Daniel Veillardce682bc2004-11-05 17:22:25 +00008904#define gen_nb_xmlCharEncodingHandlerPtr 1
8905static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8906 return(NULL);
8907}
8908static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8909}
8910
Daniel Veillardd93f6252004-11-02 15:53:51 +00008911static int
8912test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008914
Daniel Veillardce682bc2004-11-05 17:22:25 +00008915 int mem_base;
8916 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8917 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008918
Daniel Veillardce682bc2004-11-05 17:22:25 +00008919 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8920 mem_base = xmlMemBlocks();
8921 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8922
8923 xmlRegisterCharEncodingHandler(handler);
8924 call_tests++;
8925 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8926 xmlResetLastError();
8927 if (mem_base != xmlMemBlocks()) {
8928 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008930 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008931 printf(" %d", n_handler);
8932 printf("\n");
8933 }
8934 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008936
Daniel Veillard42595322004-11-08 10:52:06 +00008937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008938}
8939
8940static int
8941test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008943
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008944 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008945 test_ret += test_UTF8Toisolat1();
8946 test_ret += test_isolat1ToUTF8();
8947 test_ret += test_xmlAddEncodingAlias();
8948 test_ret += test_xmlCharEncCloseFunc();
8949 test_ret += test_xmlCharEncFirstLine();
8950 test_ret += test_xmlCharEncInFunc();
8951 test_ret += test_xmlCharEncOutFunc();
8952 test_ret += test_xmlCleanupCharEncodingHandlers();
8953 test_ret += test_xmlCleanupEncodingAliases();
8954 test_ret += test_xmlDelEncodingAlias();
8955 test_ret += test_xmlDetectCharEncoding();
8956 test_ret += test_xmlFindCharEncodingHandler();
8957 test_ret += test_xmlGetCharEncodingHandler();
8958 test_ret += test_xmlGetCharEncodingName();
8959 test_ret += test_xmlGetEncodingAlias();
8960 test_ret += test_xmlInitCharEncodingHandlers();
8961 test_ret += test_xmlNewCharEncodingHandler();
8962 test_ret += test_xmlParseCharEncoding();
8963 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008964
Daniel Veillard42595322004-11-08 10:52:06 +00008965 if (test_ret != 0)
8966 printf("Module encoding: %d errors\n", test_ret);
8967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008968}
8969
8970static int
8971test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008973
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008974 int mem_base;
8975 xmlEntityPtr ret_val;
8976 xmlDocPtr doc; /* the document */
8977 int n_doc;
8978 xmlChar * name; /* the entity name */
8979 int n_name;
8980 int type; /* the entity type XML_xxx_yyy_ENTITY */
8981 int n_type;
8982 xmlChar * ExternalID; /* the entity external ID if available */
8983 int n_ExternalID;
8984 xmlChar * SystemID; /* the entity system ID if available */
8985 int n_SystemID;
8986 xmlChar * content; /* the entity content */
8987 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008988
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8990 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8991 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8992 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8993 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8994 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8995 mem_base = xmlMemBlocks();
8996 doc = gen_xmlDocPtr(n_doc, 0);
8997 name = gen_const_xmlChar_ptr(n_name, 1);
8998 type = gen_int(n_type, 2);
8999 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9000 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9001 content = gen_const_xmlChar_ptr(n_content, 5);
9002
William M. Brackf13f77f2004-11-12 16:03:48 +00009003 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009004 desret_xmlEntityPtr(ret_val);
9005 call_tests++;
9006 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009007 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009008 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009009 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9010 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9011 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009012 xmlResetLastError();
9013 if (mem_base != xmlMemBlocks()) {
9014 printf("Leak of %d blocks found in xmlAddDocEntity",
9015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009016 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009017 printf(" %d", n_doc);
9018 printf(" %d", n_name);
9019 printf(" %d", n_type);
9020 printf(" %d", n_ExternalID);
9021 printf(" %d", n_SystemID);
9022 printf(" %d", n_content);
9023 printf("\n");
9024 }
9025 }
9026 }
9027 }
9028 }
9029 }
9030 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009031 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009032
Daniel Veillard42595322004-11-08 10:52:06 +00009033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009034}
9035
9036
9037static int
9038test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009040
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009041 int mem_base;
9042 xmlEntityPtr ret_val;
9043 xmlDocPtr doc; /* the document */
9044 int n_doc;
9045 xmlChar * name; /* the entity name */
9046 int n_name;
9047 int type; /* the entity type XML_xxx_yyy_ENTITY */
9048 int n_type;
9049 xmlChar * ExternalID; /* the entity external ID if available */
9050 int n_ExternalID;
9051 xmlChar * SystemID; /* the entity system ID if available */
9052 int n_SystemID;
9053 xmlChar * content; /* the entity content */
9054 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009055
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009056 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9058 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9059 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9060 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9061 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9062 mem_base = xmlMemBlocks();
9063 doc = gen_xmlDocPtr(n_doc, 0);
9064 name = gen_const_xmlChar_ptr(n_name, 1);
9065 type = gen_int(n_type, 2);
9066 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9067 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9068 content = gen_const_xmlChar_ptr(n_content, 5);
9069
William M. Brackf13f77f2004-11-12 16:03:48 +00009070 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009071 desret_xmlEntityPtr(ret_val);
9072 call_tests++;
9073 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009074 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009075 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009076 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9077 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9078 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009079 xmlResetLastError();
9080 if (mem_base != xmlMemBlocks()) {
9081 printf("Leak of %d blocks found in xmlAddDtdEntity",
9082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009083 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009084 printf(" %d", n_doc);
9085 printf(" %d", n_name);
9086 printf(" %d", n_type);
9087 printf(" %d", n_ExternalID);
9088 printf(" %d", n_SystemID);
9089 printf(" %d", n_content);
9090 printf("\n");
9091 }
9092 }
9093 }
9094 }
9095 }
9096 }
9097 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009098 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009099
Daniel Veillard42595322004-11-08 10:52:06 +00009100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009101}
9102
9103
9104static int
9105test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107
William M. Brack21e4ef22005-01-02 09:53:13 +00009108#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009109#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009110 int mem_base;
9111
9112 mem_base = xmlMemBlocks();
9113
9114 xmlCleanupPredefinedEntities();
9115 call_tests++;
9116 xmlResetLastError();
9117 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009118 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009120 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009121 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009123 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009124#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009125#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009126
Daniel Veillard42595322004-11-08 10:52:06 +00009127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009128}
9129
9130
Daniel Veillardce682bc2004-11-05 17:22:25 +00009131#define gen_nb_xmlEntitiesTablePtr 1
9132static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9133 return(NULL);
9134}
9135static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9136}
9137
Daniel Veillardd93f6252004-11-02 15:53:51 +00009138static int
9139test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009141
9142
9143 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009145}
9146
9147
9148static int
9149test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009151
9152
9153 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009155}
9156
9157
9158static int
9159test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009161
William M. Brack21e4ef22005-01-02 09:53:13 +00009162#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009163 int mem_base;
9164 xmlBufferPtr buf; /* An XML buffer. */
9165 int n_buf;
9166 xmlEntitiesTablePtr table; /* An entity table */
9167 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009168
Daniel Veillardce682bc2004-11-05 17:22:25 +00009169 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9170 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9171 mem_base = xmlMemBlocks();
9172 buf = gen_xmlBufferPtr(n_buf, 0);
9173 table = gen_xmlEntitiesTablePtr(n_table, 1);
9174
9175 xmlDumpEntitiesTable(buf, table);
9176 call_tests++;
9177 des_xmlBufferPtr(n_buf, buf, 0);
9178 des_xmlEntitiesTablePtr(n_table, table, 1);
9179 xmlResetLastError();
9180 if (mem_base != xmlMemBlocks()) {
9181 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009183 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009184 printf(" %d", n_buf);
9185 printf(" %d", n_table);
9186 printf("\n");
9187 }
9188 }
9189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009190 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009191#endif
9192
Daniel Veillard42595322004-11-08 10:52:06 +00009193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009194}
9195
9196
Daniel Veillardce682bc2004-11-05 17:22:25 +00009197#define gen_nb_xmlEntityPtr 1
9198static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9199 return(NULL);
9200}
9201static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9202}
9203
Daniel Veillardd93f6252004-11-02 15:53:51 +00009204static int
9205test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009207
William M. Brack21e4ef22005-01-02 09:53:13 +00009208#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 int mem_base;
9210 xmlBufferPtr buf; /* An XML buffer. */
9211 int n_buf;
9212 xmlEntityPtr ent; /* An entity table */
9213 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009214
Daniel Veillardce682bc2004-11-05 17:22:25 +00009215 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9216 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9217 mem_base = xmlMemBlocks();
9218 buf = gen_xmlBufferPtr(n_buf, 0);
9219 ent = gen_xmlEntityPtr(n_ent, 1);
9220
9221 xmlDumpEntityDecl(buf, ent);
9222 call_tests++;
9223 des_xmlBufferPtr(n_buf, buf, 0);
9224 des_xmlEntityPtr(n_ent, ent, 1);
9225 xmlResetLastError();
9226 if (mem_base != xmlMemBlocks()) {
9227 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009230 printf(" %d", n_buf);
9231 printf(" %d", n_ent);
9232 printf("\n");
9233 }
9234 }
9235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009236 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009237#endif
9238
Daniel Veillard42595322004-11-08 10:52:06 +00009239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009240}
9241
9242
9243static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009244test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009246
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009247 int mem_base;
9248 xmlChar * ret_val;
9249 xmlDocPtr doc; /* the document containing the string */
9250 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009251 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009252 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009253
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009254 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9255 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009257 doc = gen_xmlDocPtr(n_doc, 0);
9258 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009259
William M. Brackf13f77f2004-11-12 16:03:48 +00009260 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009261 desret_xmlChar_ptr(ret_val);
9262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009263 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009264 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009265 xmlResetLastError();
9266 if (mem_base != xmlMemBlocks()) {
9267 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009269 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009270 printf(" %d", n_doc);
9271 printf(" %d", n_input);
9272 printf("\n");
9273 }
9274 }
9275 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009276 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009277
Daniel Veillard42595322004-11-08 10:52:06 +00009278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009279}
9280
9281
9282static int
9283test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009285
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009286 int mem_base;
9287 xmlChar * ret_val;
9288 xmlDocPtr doc; /* the document containing the string */
9289 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009290 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009291 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009292
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9294 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9295 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009296 doc = gen_xmlDocPtr(n_doc, 0);
9297 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009298
William M. Brackf13f77f2004-11-12 16:03:48 +00009299 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009300 desret_xmlChar_ptr(ret_val);
9301 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009302 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009303 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009304 xmlResetLastError();
9305 if (mem_base != xmlMemBlocks()) {
9306 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009308 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009309 printf(" %d", n_doc);
9310 printf(" %d", n_input);
9311 printf("\n");
9312 }
9313 }
9314 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009315 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009316
Daniel Veillard42595322004-11-08 10:52:06 +00009317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009318}
9319
9320
9321static int
9322test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009324
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009325 int mem_base;
9326 xmlEntityPtr ret_val;
9327 xmlDocPtr doc; /* the document referencing the entity */
9328 int n_doc;
9329 xmlChar * name; /* the entity name */
9330 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009331
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009332 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9333 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9334 mem_base = xmlMemBlocks();
9335 doc = gen_xmlDocPtr(n_doc, 0);
9336 name = gen_const_xmlChar_ptr(n_name, 1);
9337
William M. Brackf13f77f2004-11-12 16:03:48 +00009338 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009339 desret_xmlEntityPtr(ret_val);
9340 call_tests++;
9341 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009342 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009343 xmlResetLastError();
9344 if (mem_base != xmlMemBlocks()) {
9345 printf("Leak of %d blocks found in xmlGetDocEntity",
9346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009347 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009348 printf(" %d", n_doc);
9349 printf(" %d", n_name);
9350 printf("\n");
9351 }
9352 }
9353 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009354 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009355
Daniel Veillard42595322004-11-08 10:52:06 +00009356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009357}
9358
9359
9360static int
9361test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009363
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009364 int mem_base;
9365 xmlEntityPtr ret_val;
9366 xmlDocPtr doc; /* the document referencing the entity */
9367 int n_doc;
9368 xmlChar * name; /* the entity name */
9369 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009370
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009371 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9372 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9373 mem_base = xmlMemBlocks();
9374 doc = gen_xmlDocPtr(n_doc, 0);
9375 name = gen_const_xmlChar_ptr(n_name, 1);
9376
William M. Brackf13f77f2004-11-12 16:03:48 +00009377 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009378 desret_xmlEntityPtr(ret_val);
9379 call_tests++;
9380 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009381 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009382 xmlResetLastError();
9383 if (mem_base != xmlMemBlocks()) {
9384 printf("Leak of %d blocks found in xmlGetDtdEntity",
9385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009386 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009387 printf(" %d", n_doc);
9388 printf(" %d", n_name);
9389 printf("\n");
9390 }
9391 }
9392 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009393 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009394
Daniel Veillard42595322004-11-08 10:52:06 +00009395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009396}
9397
9398
9399static int
9400test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009402
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009403 int mem_base;
9404 xmlEntityPtr ret_val;
9405 xmlDocPtr doc; /* the document referencing the entity */
9406 int n_doc;
9407 xmlChar * name; /* the entity name */
9408 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009409
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009410 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9411 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9412 mem_base = xmlMemBlocks();
9413 doc = gen_xmlDocPtr(n_doc, 0);
9414 name = gen_const_xmlChar_ptr(n_name, 1);
9415
William M. Brackf13f77f2004-11-12 16:03:48 +00009416 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009417 desret_xmlEntityPtr(ret_val);
9418 call_tests++;
9419 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009420 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009421 xmlResetLastError();
9422 if (mem_base != xmlMemBlocks()) {
9423 printf("Leak of %d blocks found in xmlGetParameterEntity",
9424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009425 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009426 printf(" %d", n_doc);
9427 printf(" %d", n_name);
9428 printf("\n");
9429 }
9430 }
9431 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009433
Daniel Veillard42595322004-11-08 10:52:06 +00009434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009435}
9436
9437
9438static int
9439test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009441
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009442 int mem_base;
9443 xmlEntityPtr ret_val;
9444 xmlChar * name; /* the entity name */
9445 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009446
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009447 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9448 mem_base = xmlMemBlocks();
9449 name = gen_const_xmlChar_ptr(n_name, 0);
9450
William M. Brackf13f77f2004-11-12 16:03:48 +00009451 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009452 desret_xmlEntityPtr(ret_val);
9453 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009454 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009455 xmlResetLastError();
9456 if (mem_base != xmlMemBlocks()) {
9457 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009459 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009460 printf(" %d", n_name);
9461 printf("\n");
9462 }
9463 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009464 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009465
Daniel Veillard42595322004-11-08 10:52:06 +00009466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467}
9468
9469
9470static int
9471test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009473
William M. Brack21e4ef22005-01-02 09:53:13 +00009474#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009475#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009476 int mem_base;
9477
9478 mem_base = xmlMemBlocks();
9479
9480 xmlInitializePredefinedEntities();
9481 call_tests++;
9482 xmlResetLastError();
9483 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009484 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009486 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009487 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009489 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009490#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009491#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009492
Daniel Veillard42595322004-11-08 10:52:06 +00009493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009494}
9495
9496static int
9497test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009499
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009500 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009501 test_ret += test_xmlAddDocEntity();
9502 test_ret += test_xmlAddDtdEntity();
9503 test_ret += test_xmlCleanupPredefinedEntities();
9504 test_ret += test_xmlCopyEntitiesTable();
9505 test_ret += test_xmlCreateEntitiesTable();
9506 test_ret += test_xmlDumpEntitiesTable();
9507 test_ret += test_xmlDumpEntityDecl();
9508 test_ret += test_xmlEncodeEntitiesReentrant();
9509 test_ret += test_xmlEncodeSpecialChars();
9510 test_ret += test_xmlGetDocEntity();
9511 test_ret += test_xmlGetDtdEntity();
9512 test_ret += test_xmlGetParameterEntity();
9513 test_ret += test_xmlGetPredefinedEntity();
9514 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009515
Daniel Veillard42595322004-11-08 10:52:06 +00009516 if (test_ret != 0)
9517 printf("Module entities: %d errors\n", test_ret);
9518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009519}
9520
9521static int
9522test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009524
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009525 int mem_base;
9526 int ret_val;
9527 xmlHashTablePtr table; /* the hash table */
9528 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009529 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009530 int n_name;
9531 void * userdata; /* a pointer to the userdata */
9532 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009533
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009534 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9535 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9536 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009538 table = gen_xmlHashTablePtr(n_table, 0);
9539 name = gen_const_xmlChar_ptr(n_name, 1);
9540 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009541
William M. Brackf13f77f2004-11-12 16:03:48 +00009542 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009543 desret_int(ret_val);
9544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009545 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009546 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009547 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009548 xmlResetLastError();
9549 if (mem_base != xmlMemBlocks()) {
9550 printf("Leak of %d blocks found in xmlHashAddEntry",
9551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009552 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009553 printf(" %d", n_table);
9554 printf(" %d", n_name);
9555 printf(" %d", n_userdata);
9556 printf("\n");
9557 }
9558 }
9559 }
9560 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009562
Daniel Veillard42595322004-11-08 10:52:06 +00009563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009564}
9565
9566
9567static int
9568test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009570
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009571 int mem_base;
9572 int ret_val;
9573 xmlHashTablePtr table; /* the hash table */
9574 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009575 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009576 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009577 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009578 int n_name2;
9579 void * userdata; /* a pointer to the userdata */
9580 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009581
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009582 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9583 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9584 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9585 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009587 table = gen_xmlHashTablePtr(n_table, 0);
9588 name = gen_const_xmlChar_ptr(n_name, 1);
9589 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9590 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009591
William M. Brackf13f77f2004-11-12 16:03:48 +00009592 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009593 desret_int(ret_val);
9594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009595 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009596 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9597 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009598 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009599 xmlResetLastError();
9600 if (mem_base != xmlMemBlocks()) {
9601 printf("Leak of %d blocks found in xmlHashAddEntry2",
9602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009603 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009604 printf(" %d", n_table);
9605 printf(" %d", n_name);
9606 printf(" %d", n_name2);
9607 printf(" %d", n_userdata);
9608 printf("\n");
9609 }
9610 }
9611 }
9612 }
9613 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009614 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009615
Daniel Veillard42595322004-11-08 10:52:06 +00009616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009617}
9618
9619
9620static int
9621test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009623
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009624 int mem_base;
9625 int ret_val;
9626 xmlHashTablePtr table; /* the hash table */
9627 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009628 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009629 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009630 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009631 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009632 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009633 int n_name3;
9634 void * userdata; /* a pointer to the userdata */
9635 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009636
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009637 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9638 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9639 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9640 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9641 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009643 table = gen_xmlHashTablePtr(n_table, 0);
9644 name = gen_const_xmlChar_ptr(n_name, 1);
9645 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9646 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9647 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009648
William M. Brackf13f77f2004-11-12 16:03:48 +00009649 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009650 desret_int(ret_val);
9651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009652 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009653 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9654 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9655 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009656 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009657 xmlResetLastError();
9658 if (mem_base != xmlMemBlocks()) {
9659 printf("Leak of %d blocks found in xmlHashAddEntry3",
9660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009661 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009662 printf(" %d", n_table);
9663 printf(" %d", n_name);
9664 printf(" %d", n_name2);
9665 printf(" %d", n_name3);
9666 printf(" %d", n_userdata);
9667 printf("\n");
9668 }
9669 }
9670 }
9671 }
9672 }
9673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009675
Daniel Veillard42595322004-11-08 10:52:06 +00009676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009677}
9678
9679
9680static int
9681test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009683
9684
9685 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009687}
9688
9689
9690static int
9691test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009693
9694
9695 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009697}
9698
9699
9700static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009701test_xmlHashCreateDict(void) {
9702 int test_ret = 0;
9703
9704
9705 /* missing type support */
9706 return(test_ret);
9707}
9708
9709
9710static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009711test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009713
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009714 int mem_base;
9715 void * ret_val;
9716 xmlHashTablePtr table; /* the hash table */
9717 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009718 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009719 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009720
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009721 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9722 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009724 table = gen_xmlHashTablePtr(n_table, 0);
9725 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009726
William M. Brackf13f77f2004-11-12 16:03:48 +00009727 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009728 desret_void_ptr(ret_val);
9729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009730 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009731 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009732 xmlResetLastError();
9733 if (mem_base != xmlMemBlocks()) {
9734 printf("Leak of %d blocks found in xmlHashLookup",
9735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009736 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009737 printf(" %d", n_table);
9738 printf(" %d", n_name);
9739 printf("\n");
9740 }
9741 }
9742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009744
Daniel Veillard42595322004-11-08 10:52:06 +00009745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009746}
9747
9748
9749static int
9750test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009753 int mem_base;
9754 void * ret_val;
9755 xmlHashTablePtr table; /* the hash table */
9756 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009757 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009758 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009759 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009760 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009761
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009762 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9763 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9764 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009766 table = gen_xmlHashTablePtr(n_table, 0);
9767 name = gen_const_xmlChar_ptr(n_name, 1);
9768 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009769
William M. Brackf13f77f2004-11-12 16:03:48 +00009770 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009771 desret_void_ptr(ret_val);
9772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009773 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009774 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9775 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009776 xmlResetLastError();
9777 if (mem_base != xmlMemBlocks()) {
9778 printf("Leak of %d blocks found in xmlHashLookup2",
9779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009780 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009781 printf(" %d", n_table);
9782 printf(" %d", n_name);
9783 printf(" %d", n_name2);
9784 printf("\n");
9785 }
9786 }
9787 }
9788 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009789 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009790
Daniel Veillard42595322004-11-08 10:52:06 +00009791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009792}
9793
9794
9795static int
9796test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009798
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009799 int mem_base;
9800 void * ret_val;
9801 xmlHashTablePtr table; /* the hash table */
9802 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009803 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009804 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009805 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009806 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009807 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009808 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009809
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009810 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9811 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9812 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9813 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009815 table = gen_xmlHashTablePtr(n_table, 0);
9816 name = gen_const_xmlChar_ptr(n_name, 1);
9817 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9818 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009819
William M. Brackf13f77f2004-11-12 16:03:48 +00009820 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009821 desret_void_ptr(ret_val);
9822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009823 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009824 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9825 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9826 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009827 xmlResetLastError();
9828 if (mem_base != xmlMemBlocks()) {
9829 printf("Leak of %d blocks found in xmlHashLookup3",
9830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009831 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009832 printf(" %d", n_table);
9833 printf(" %d", n_name);
9834 printf(" %d", n_name2);
9835 printf(" %d", n_name3);
9836 printf("\n");
9837 }
9838 }
9839 }
9840 }
9841 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009842 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009843
Daniel Veillard42595322004-11-08 10:52:06 +00009844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009845}
9846
9847
9848static int
9849test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009851
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009852 int mem_base;
9853 void * ret_val;
9854 xmlHashTablePtr table; /* the hash table */
9855 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009856 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009857 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009858 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009859 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009860
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009861 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9862 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9863 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009865 table = gen_xmlHashTablePtr(n_table, 0);
9866 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9867 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009868
William M. Brackf13f77f2004-11-12 16:03:48 +00009869 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009870 desret_void_ptr(ret_val);
9871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009872 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009873 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9874 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009875 xmlResetLastError();
9876 if (mem_base != xmlMemBlocks()) {
9877 printf("Leak of %d blocks found in xmlHashQLookup",
9878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009879 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009880 printf(" %d", n_table);
9881 printf(" %d", n_prefix);
9882 printf(" %d", n_name);
9883 printf("\n");
9884 }
9885 }
9886 }
9887 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009888 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009889
Daniel Veillard42595322004-11-08 10:52:06 +00009890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009891}
9892
9893
9894static int
9895test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009897
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009898 int mem_base;
9899 void * ret_val;
9900 xmlHashTablePtr table; /* the hash table */
9901 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009902 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009903 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009904 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009905 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009906 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009907 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009908 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009909 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009910
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009911 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9912 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9913 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9914 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9915 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009917 table = gen_xmlHashTablePtr(n_table, 0);
9918 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9919 name = gen_const_xmlChar_ptr(n_name, 2);
9920 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9921 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009922
William M. Brackf13f77f2004-11-12 16:03:48 +00009923 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009924 desret_void_ptr(ret_val);
9925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009926 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009927 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9928 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9929 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9930 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009931 xmlResetLastError();
9932 if (mem_base != xmlMemBlocks()) {
9933 printf("Leak of %d blocks found in xmlHashQLookup2",
9934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009935 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009936 printf(" %d", n_table);
9937 printf(" %d", n_prefix);
9938 printf(" %d", n_name);
9939 printf(" %d", n_prefix2);
9940 printf(" %d", n_name2);
9941 printf("\n");
9942 }
9943 }
9944 }
9945 }
9946 }
9947 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009948 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009949
Daniel Veillard42595322004-11-08 10:52:06 +00009950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009951}
9952
9953
9954static int
9955test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009957
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009958 int mem_base;
9959 void * ret_val;
9960 xmlHashTablePtr table; /* the hash table */
9961 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009962 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009963 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009964 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009965 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009966 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009967 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009968 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009969 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009970 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009971 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009972 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009973 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009974
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009975 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9976 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9977 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9978 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9979 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9980 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9981 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009983 table = gen_xmlHashTablePtr(n_table, 0);
9984 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9985 name = gen_const_xmlChar_ptr(n_name, 2);
9986 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9987 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9988 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9989 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009990
William M. Brackf13f77f2004-11-12 16:03:48 +00009991 ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009992 desret_void_ptr(ret_val);
9993 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009994 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009995 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9997 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9998 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9999 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
10000 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010001 xmlResetLastError();
10002 if (mem_base != xmlMemBlocks()) {
10003 printf("Leak of %d blocks found in xmlHashQLookup3",
10004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010005 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010006 printf(" %d", n_table);
10007 printf(" %d", n_prefix);
10008 printf(" %d", n_name);
10009 printf(" %d", n_prefix2);
10010 printf(" %d", n_name2);
10011 printf(" %d", n_prefix3);
10012 printf(" %d", n_name3);
10013 printf("\n");
10014 }
10015 }
10016 }
10017 }
10018 }
10019 }
10020 }
10021 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010023
Daniel Veillard42595322004-11-08 10:52:06 +000010024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010025}
10026
10027
10028static int
10029test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 int mem_base;
10033 int ret_val;
10034 xmlHashTablePtr table; /* the hash table */
10035 int n_table;
10036 xmlChar * name; /* the name of the userdata */
10037 int n_name;
10038 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10039 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010040
Daniel Veillard42595322004-11-08 10:52:06 +000010041 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10042 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10043 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10044 mem_base = xmlMemBlocks();
10045 table = gen_xmlHashTablePtr(n_table, 0);
10046 name = gen_const_xmlChar_ptr(n_name, 1);
10047 f = gen_xmlHashDeallocator(n_f, 2);
10048
William M. Brackf13f77f2004-11-12 16:03:48 +000010049 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010050 desret_int(ret_val);
10051 call_tests++;
10052 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010053 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010054 des_xmlHashDeallocator(n_f, f, 2);
10055 xmlResetLastError();
10056 if (mem_base != xmlMemBlocks()) {
10057 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10058 xmlMemBlocks() - mem_base);
10059 test_ret++;
10060 printf(" %d", n_table);
10061 printf(" %d", n_name);
10062 printf(" %d", n_f);
10063 printf("\n");
10064 }
10065 }
10066 }
10067 }
Daniel Veillard42595322004-11-08 10:52:06 +000010068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010069
Daniel Veillard42595322004-11-08 10:52:06 +000010070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010071}
10072
10073
10074static int
10075test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010077
Daniel Veillard42595322004-11-08 10:52:06 +000010078 int mem_base;
10079 int ret_val;
10080 xmlHashTablePtr table; /* the hash table */
10081 int n_table;
10082 xmlChar * name; /* the name of the userdata */
10083 int n_name;
10084 xmlChar * name2; /* a second name of the userdata */
10085 int n_name2;
10086 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10087 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010088
Daniel Veillard42595322004-11-08 10:52:06 +000010089 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10090 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10091 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10092 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10093 mem_base = xmlMemBlocks();
10094 table = gen_xmlHashTablePtr(n_table, 0);
10095 name = gen_const_xmlChar_ptr(n_name, 1);
10096 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10097 f = gen_xmlHashDeallocator(n_f, 3);
10098
William M. Brackf13f77f2004-11-12 16:03:48 +000010099 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010100 desret_int(ret_val);
10101 call_tests++;
10102 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010103 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10104 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010105 des_xmlHashDeallocator(n_f, f, 3);
10106 xmlResetLastError();
10107 if (mem_base != xmlMemBlocks()) {
10108 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10109 xmlMemBlocks() - mem_base);
10110 test_ret++;
10111 printf(" %d", n_table);
10112 printf(" %d", n_name);
10113 printf(" %d", n_name2);
10114 printf(" %d", n_f);
10115 printf("\n");
10116 }
10117 }
10118 }
10119 }
10120 }
Daniel Veillard42595322004-11-08 10:52:06 +000010121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010122
Daniel Veillard42595322004-11-08 10:52:06 +000010123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010124}
10125
10126
10127static int
10128test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010130
Daniel Veillard42595322004-11-08 10:52:06 +000010131 int mem_base;
10132 int ret_val;
10133 xmlHashTablePtr table; /* the hash table */
10134 int n_table;
10135 xmlChar * name; /* the name of the userdata */
10136 int n_name;
10137 xmlChar * name2; /* a second name of the userdata */
10138 int n_name2;
10139 xmlChar * name3; /* a third name of the userdata */
10140 int n_name3;
10141 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10142 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010143
Daniel Veillard42595322004-11-08 10:52:06 +000010144 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10145 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10146 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10147 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10148 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10149 mem_base = xmlMemBlocks();
10150 table = gen_xmlHashTablePtr(n_table, 0);
10151 name = gen_const_xmlChar_ptr(n_name, 1);
10152 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10153 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10154 f = gen_xmlHashDeallocator(n_f, 4);
10155
William M. Brackf13f77f2004-11-12 16:03:48 +000010156 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010157 desret_int(ret_val);
10158 call_tests++;
10159 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010160 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10161 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10162 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010163 des_xmlHashDeallocator(n_f, f, 4);
10164 xmlResetLastError();
10165 if (mem_base != xmlMemBlocks()) {
10166 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10167 xmlMemBlocks() - mem_base);
10168 test_ret++;
10169 printf(" %d", n_table);
10170 printf(" %d", n_name);
10171 printf(" %d", n_name2);
10172 printf(" %d", n_name3);
10173 printf(" %d", n_f);
10174 printf("\n");
10175 }
10176 }
10177 }
10178 }
10179 }
10180 }
Daniel Veillard42595322004-11-08 10:52:06 +000010181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010182
Daniel Veillard42595322004-11-08 10:52:06 +000010183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010184}
10185
10186
10187static int
10188test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010190
10191
10192 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010194}
10195
10196
10197static int
10198test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010200
10201
10202 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010204}
10205
10206
10207static int
10208test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010210
10211
10212 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010214}
10215
10216
10217static int
10218test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010220
10221
10222 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010224}
10225
10226
10227static int
10228test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010230
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010231 int mem_base;
10232 int ret_val;
10233 xmlHashTablePtr table; /* the hash table */
10234 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010235
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010236 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010238 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010239
10240 ret_val = xmlHashSize(table);
10241 desret_int(ret_val);
10242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010243 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010244 xmlResetLastError();
10245 if (mem_base != xmlMemBlocks()) {
10246 printf("Leak of %d blocks found in xmlHashSize",
10247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010248 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010249 printf(" %d", n_table);
10250 printf("\n");
10251 }
10252 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010254
Daniel Veillard42595322004-11-08 10:52:06 +000010255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010256}
10257
10258
10259static int
10260test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010262
Daniel Veillard42595322004-11-08 10:52:06 +000010263 int mem_base;
10264 int ret_val;
10265 xmlHashTablePtr table; /* the hash table */
10266 int n_table;
10267 xmlChar * name; /* the name of the userdata */
10268 int n_name;
10269 void * userdata; /* a pointer to the userdata */
10270 int n_userdata;
10271 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10272 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010273
Daniel Veillard42595322004-11-08 10:52:06 +000010274 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10275 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10276 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10277 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10278 mem_base = xmlMemBlocks();
10279 table = gen_xmlHashTablePtr(n_table, 0);
10280 name = gen_const_xmlChar_ptr(n_name, 1);
10281 userdata = gen_userdata(n_userdata, 2);
10282 f = gen_xmlHashDeallocator(n_f, 3);
10283
William M. Brackf13f77f2004-11-12 16:03:48 +000010284 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010285 desret_int(ret_val);
10286 call_tests++;
10287 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010289 des_userdata(n_userdata, userdata, 2);
10290 des_xmlHashDeallocator(n_f, f, 3);
10291 xmlResetLastError();
10292 if (mem_base != xmlMemBlocks()) {
10293 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10294 xmlMemBlocks() - mem_base);
10295 test_ret++;
10296 printf(" %d", n_table);
10297 printf(" %d", n_name);
10298 printf(" %d", n_userdata);
10299 printf(" %d", n_f);
10300 printf("\n");
10301 }
10302 }
10303 }
10304 }
10305 }
Daniel Veillard42595322004-11-08 10:52:06 +000010306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010307
Daniel Veillard42595322004-11-08 10:52:06 +000010308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010309}
10310
10311
10312static int
10313test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010315
Daniel Veillard42595322004-11-08 10:52:06 +000010316 int mem_base;
10317 int ret_val;
10318 xmlHashTablePtr table; /* the hash table */
10319 int n_table;
10320 xmlChar * name; /* the name of the userdata */
10321 int n_name;
10322 xmlChar * name2; /* a second name of the userdata */
10323 int n_name2;
10324 void * userdata; /* a pointer to the userdata */
10325 int n_userdata;
10326 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10327 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010328
Daniel Veillard42595322004-11-08 10:52:06 +000010329 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10330 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10331 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10332 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10333 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10334 mem_base = xmlMemBlocks();
10335 table = gen_xmlHashTablePtr(n_table, 0);
10336 name = gen_const_xmlChar_ptr(n_name, 1);
10337 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10338 userdata = gen_userdata(n_userdata, 3);
10339 f = gen_xmlHashDeallocator(n_f, 4);
10340
William M. Brackf13f77f2004-11-12 16:03:48 +000010341 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010342 desret_int(ret_val);
10343 call_tests++;
10344 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010345 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10346 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010347 des_userdata(n_userdata, userdata, 3);
10348 des_xmlHashDeallocator(n_f, f, 4);
10349 xmlResetLastError();
10350 if (mem_base != xmlMemBlocks()) {
10351 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10352 xmlMemBlocks() - mem_base);
10353 test_ret++;
10354 printf(" %d", n_table);
10355 printf(" %d", n_name);
10356 printf(" %d", n_name2);
10357 printf(" %d", n_userdata);
10358 printf(" %d", n_f);
10359 printf("\n");
10360 }
10361 }
10362 }
10363 }
10364 }
10365 }
Daniel Veillard42595322004-11-08 10:52:06 +000010366 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010367
Daniel Veillard42595322004-11-08 10:52:06 +000010368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010369}
10370
10371
10372static int
10373test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010375
Daniel Veillard42595322004-11-08 10:52:06 +000010376 int mem_base;
10377 int ret_val;
10378 xmlHashTablePtr table; /* the hash table */
10379 int n_table;
10380 xmlChar * name; /* the name of the userdata */
10381 int n_name;
10382 xmlChar * name2; /* a second name of the userdata */
10383 int n_name2;
10384 xmlChar * name3; /* a third name of the userdata */
10385 int n_name3;
10386 void * userdata; /* a pointer to the userdata */
10387 int n_userdata;
10388 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10389 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010390
Daniel Veillard42595322004-11-08 10:52:06 +000010391 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10392 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10393 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10394 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10395 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10396 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10397 mem_base = xmlMemBlocks();
10398 table = gen_xmlHashTablePtr(n_table, 0);
10399 name = gen_const_xmlChar_ptr(n_name, 1);
10400 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10401 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10402 userdata = gen_userdata(n_userdata, 4);
10403 f = gen_xmlHashDeallocator(n_f, 5);
10404
William M. Brackf13f77f2004-11-12 16:03:48 +000010405 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010406 desret_int(ret_val);
10407 call_tests++;
10408 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010409 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10410 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10411 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010412 des_userdata(n_userdata, userdata, 4);
10413 des_xmlHashDeallocator(n_f, f, 5);
10414 xmlResetLastError();
10415 if (mem_base != xmlMemBlocks()) {
10416 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10417 xmlMemBlocks() - mem_base);
10418 test_ret++;
10419 printf(" %d", n_table);
10420 printf(" %d", n_name);
10421 printf(" %d", n_name2);
10422 printf(" %d", n_name3);
10423 printf(" %d", n_userdata);
10424 printf(" %d", n_f);
10425 printf("\n");
10426 }
10427 }
10428 }
10429 }
10430 }
10431 }
10432 }
Daniel Veillard42595322004-11-08 10:52:06 +000010433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010434
Daniel Veillard42595322004-11-08 10:52:06 +000010435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010436}
10437
10438static int
10439test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010441
Daniel Veillard2ae13382005-01-25 23:45:06 +000010442 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010443 test_ret += test_xmlHashAddEntry();
10444 test_ret += test_xmlHashAddEntry2();
10445 test_ret += test_xmlHashAddEntry3();
10446 test_ret += test_xmlHashCopy();
10447 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010448 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010449 test_ret += test_xmlHashLookup();
10450 test_ret += test_xmlHashLookup2();
10451 test_ret += test_xmlHashLookup3();
10452 test_ret += test_xmlHashQLookup();
10453 test_ret += test_xmlHashQLookup2();
10454 test_ret += test_xmlHashQLookup3();
10455 test_ret += test_xmlHashRemoveEntry();
10456 test_ret += test_xmlHashRemoveEntry2();
10457 test_ret += test_xmlHashRemoveEntry3();
10458 test_ret += test_xmlHashScan();
10459 test_ret += test_xmlHashScan3();
10460 test_ret += test_xmlHashScanFull();
10461 test_ret += test_xmlHashScanFull3();
10462 test_ret += test_xmlHashSize();
10463 test_ret += test_xmlHashUpdateEntry();
10464 test_ret += test_xmlHashUpdateEntry2();
10465 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010466
Daniel Veillard42595322004-11-08 10:52:06 +000010467 if (test_ret != 0)
10468 printf("Module hash: %d errors\n", test_ret);
10469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010470}
10471
Daniel Veillardce682bc2004-11-05 17:22:25 +000010472#define gen_nb_xmlLinkPtr 1
10473static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10474 return(NULL);
10475}
10476static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10477}
10478
Daniel Veillardd93f6252004-11-02 15:53:51 +000010479static int
10480test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010482
Daniel Veillardce682bc2004-11-05 17:22:25 +000010483 int mem_base;
10484 void * ret_val;
10485 xmlLinkPtr lk; /* a link */
10486 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010487
Daniel Veillardce682bc2004-11-05 17:22:25 +000010488 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10489 mem_base = xmlMemBlocks();
10490 lk = gen_xmlLinkPtr(n_lk, 0);
10491
10492 ret_val = xmlLinkGetData(lk);
10493 desret_void_ptr(ret_val);
10494 call_tests++;
10495 des_xmlLinkPtr(n_lk, lk, 0);
10496 xmlResetLastError();
10497 if (mem_base != xmlMemBlocks()) {
10498 printf("Leak of %d blocks found in xmlLinkGetData",
10499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010500 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010501 printf(" %d", n_lk);
10502 printf("\n");
10503 }
10504 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010505 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010506
Daniel Veillard42595322004-11-08 10:52:06 +000010507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010508}
10509
10510
10511static int
10512test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010514
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010515 int mem_base;
10516 int ret_val;
10517 xmlListPtr l; /* a list */
10518 int n_l;
10519 void * data; /* the data */
10520 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010521
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010522 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10523 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010525 l = gen_xmlListPtr(n_l, 0);
10526 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010527
10528 ret_val = xmlListAppend(l, data);
10529 desret_int(ret_val);
10530 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010531 des_xmlListPtr(n_l, l, 0);
10532 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010533 xmlResetLastError();
10534 if (mem_base != xmlMemBlocks()) {
10535 printf("Leak of %d blocks found in xmlListAppend",
10536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010537 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010538 printf(" %d", n_l);
10539 printf(" %d", n_data);
10540 printf("\n");
10541 }
10542 }
10543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010545
Daniel Veillard42595322004-11-08 10:52:06 +000010546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010547}
10548
10549
10550static int
10551test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010553
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010554 int mem_base;
10555 xmlListPtr l; /* a list */
10556 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010557
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010558 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010560 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010561
10562 xmlListClear(l);
10563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010564 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010565 xmlResetLastError();
10566 if (mem_base != xmlMemBlocks()) {
10567 printf("Leak of %d blocks found in xmlListClear",
10568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010569 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010570 printf(" %d", n_l);
10571 printf("\n");
10572 }
10573 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010574 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010575
Daniel Veillard42595322004-11-08 10:52:06 +000010576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010577}
10578
10579
Daniel Veillardce682bc2004-11-05 17:22:25 +000010580#define gen_nb_const_xmlListPtr 1
10581static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10582 return(NULL);
10583}
10584static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10585}
10586
Daniel Veillardd93f6252004-11-02 15:53:51 +000010587static int
10588test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010590
Daniel Veillardce682bc2004-11-05 17:22:25 +000010591 int mem_base;
10592 int ret_val;
10593 xmlListPtr cur; /* the new list */
10594 int n_cur;
10595 xmlListPtr old; /* the old list */
10596 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010597
Daniel Veillardce682bc2004-11-05 17:22:25 +000010598 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10599 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10600 mem_base = xmlMemBlocks();
10601 cur = gen_xmlListPtr(n_cur, 0);
10602 old = gen_const_xmlListPtr(n_old, 1);
10603
William M. Brackf13f77f2004-11-12 16:03:48 +000010604 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010605 desret_int(ret_val);
10606 call_tests++;
10607 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010608 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010609 xmlResetLastError();
10610 if (mem_base != xmlMemBlocks()) {
10611 printf("Leak of %d blocks found in xmlListCopy",
10612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010613 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010614 printf(" %d", n_cur);
10615 printf(" %d", n_old);
10616 printf("\n");
10617 }
10618 }
10619 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010620 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010621
Daniel Veillard42595322004-11-08 10:52:06 +000010622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010623}
10624
10625
10626static int
10627test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010629
10630
10631 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010633}
10634
10635
10636static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010637test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010639
10640
10641 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010643}
10644
10645
10646static int
10647test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010649
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010650 int mem_base;
10651 int ret_val;
10652 xmlListPtr l; /* a list */
10653 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010655 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10656 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010657 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010658
10659 ret_val = xmlListEmpty(l);
10660 desret_int(ret_val);
10661 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010662 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010663 xmlResetLastError();
10664 if (mem_base != xmlMemBlocks()) {
10665 printf("Leak of %d blocks found in xmlListEmpty",
10666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010667 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010668 printf(" %d", n_l);
10669 printf("\n");
10670 }
10671 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010673
Daniel Veillard42595322004-11-08 10:52:06 +000010674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010675}
10676
10677
10678static int
10679test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010681
10682
10683 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010685}
10686
10687
10688static int
10689test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010691
10692
10693 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010695}
10696
10697
10698static int
10699test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010701
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010702 int mem_base;
10703 int ret_val;
10704 xmlListPtr l; /* a list */
10705 int n_l;
10706 void * data; /* the data */
10707 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010708
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010709 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10710 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010712 l = gen_xmlListPtr(n_l, 0);
10713 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010714
10715 ret_val = xmlListInsert(l, data);
10716 desret_int(ret_val);
10717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010718 des_xmlListPtr(n_l, l, 0);
10719 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 xmlResetLastError();
10721 if (mem_base != xmlMemBlocks()) {
10722 printf("Leak of %d blocks found in xmlListInsert",
10723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010724 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010725 printf(" %d", n_l);
10726 printf(" %d", n_data);
10727 printf("\n");
10728 }
10729 }
10730 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010731 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010732
Daniel Veillard42595322004-11-08 10:52:06 +000010733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010734}
10735
10736
10737static int
10738test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010740
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741 int mem_base;
10742 xmlListPtr l1; /* the original list */
10743 int n_l1;
10744 xmlListPtr l2; /* the new list */
10745 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010746
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010747 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10748 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10749 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010750 l1 = gen_xmlListPtr(n_l1, 0);
10751 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010752
10753 xmlListMerge(l1, l2);
10754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010755 des_xmlListPtr(n_l1, l1, 0);
10756 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010757 xmlResetLastError();
10758 if (mem_base != xmlMemBlocks()) {
10759 printf("Leak of %d blocks found in xmlListMerge",
10760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010761 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010762 printf(" %d", n_l1);
10763 printf(" %d", n_l2);
10764 printf("\n");
10765 }
10766 }
10767 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010768 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010769
Daniel Veillard42595322004-11-08 10:52:06 +000010770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010771}
10772
10773
10774static int
10775test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010777
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010778 int mem_base;
10779 xmlListPtr l; /* a list */
10780 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010781
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010782 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010784 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010785
10786 xmlListPopBack(l);
10787 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010788 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010789 xmlResetLastError();
10790 if (mem_base != xmlMemBlocks()) {
10791 printf("Leak of %d blocks found in xmlListPopBack",
10792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010793 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794 printf(" %d", n_l);
10795 printf("\n");
10796 }
10797 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010799
Daniel Veillard42595322004-11-08 10:52:06 +000010800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010801}
10802
10803
10804static int
10805test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010807
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010808 int mem_base;
10809 xmlListPtr l; /* a list */
10810 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010811
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010812 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10813 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010814 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010815
10816 xmlListPopFront(l);
10817 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010818 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010819 xmlResetLastError();
10820 if (mem_base != xmlMemBlocks()) {
10821 printf("Leak of %d blocks found in xmlListPopFront",
10822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010823 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 printf(" %d", n_l);
10825 printf("\n");
10826 }
10827 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010828 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010829
Daniel Veillard42595322004-11-08 10:52:06 +000010830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010831}
10832
10833
10834static int
10835test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010837
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010838 int mem_base;
10839 int ret_val;
10840 xmlListPtr l; /* a list */
10841 int n_l;
10842 void * data; /* new data */
10843 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010844
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010845 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10846 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010848 l = gen_xmlListPtr(n_l, 0);
10849 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010850
10851 ret_val = xmlListPushBack(l, data);
10852 desret_int(ret_val);
10853 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010854 des_xmlListPtr(n_l, l, 0);
10855 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010856 xmlResetLastError();
10857 if (mem_base != xmlMemBlocks()) {
10858 printf("Leak of %d blocks found in xmlListPushBack",
10859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010860 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010861 printf(" %d", n_l);
10862 printf(" %d", n_data);
10863 printf("\n");
10864 }
10865 }
10866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010868
Daniel Veillard42595322004-11-08 10:52:06 +000010869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010870}
10871
10872
10873static int
10874test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010876
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010877 int mem_base;
10878 int ret_val;
10879 xmlListPtr l; /* a list */
10880 int n_l;
10881 void * data; /* new data */
10882 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010883
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010884 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10885 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10886 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010887 l = gen_xmlListPtr(n_l, 0);
10888 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010889
10890 ret_val = xmlListPushFront(l, data);
10891 desret_int(ret_val);
10892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010893 des_xmlListPtr(n_l, l, 0);
10894 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010895 xmlResetLastError();
10896 if (mem_base != xmlMemBlocks()) {
10897 printf("Leak of %d blocks found in xmlListPushFront",
10898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010899 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010900 printf(" %d", n_l);
10901 printf(" %d", n_data);
10902 printf("\n");
10903 }
10904 }
10905 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010906 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010907
Daniel Veillard42595322004-11-08 10:52:06 +000010908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010909}
10910
10911
10912static int
10913test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010915
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010916 int mem_base;
10917 int ret_val;
10918 xmlListPtr l; /* a list */
10919 int n_l;
10920 void * data; /* list data */
10921 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010922
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010923 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10924 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010926 l = gen_xmlListPtr(n_l, 0);
10927 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010928
10929 ret_val = xmlListRemoveAll(l, data);
10930 desret_int(ret_val);
10931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010932 des_xmlListPtr(n_l, l, 0);
10933 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010934 xmlResetLastError();
10935 if (mem_base != xmlMemBlocks()) {
10936 printf("Leak of %d blocks found in xmlListRemoveAll",
10937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010938 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010939 printf(" %d", n_l);
10940 printf(" %d", n_data);
10941 printf("\n");
10942 }
10943 }
10944 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010945 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010946
Daniel Veillard42595322004-11-08 10:52:06 +000010947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010948}
10949
10950
10951static int
10952test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010955 int mem_base;
10956 int ret_val;
10957 xmlListPtr l; /* a list */
10958 int n_l;
10959 void * data; /* list data */
10960 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010961
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010962 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10963 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010965 l = gen_xmlListPtr(n_l, 0);
10966 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010967
10968 ret_val = xmlListRemoveFirst(l, data);
10969 desret_int(ret_val);
10970 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010971 des_xmlListPtr(n_l, l, 0);
10972 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010973 xmlResetLastError();
10974 if (mem_base != xmlMemBlocks()) {
10975 printf("Leak of %d blocks found in xmlListRemoveFirst",
10976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010977 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010978 printf(" %d", n_l);
10979 printf(" %d", n_data);
10980 printf("\n");
10981 }
10982 }
10983 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010984 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010985
Daniel Veillard42595322004-11-08 10:52:06 +000010986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010987}
10988
10989
10990static int
10991test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010993
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010994 int mem_base;
10995 int ret_val;
10996 xmlListPtr l; /* a list */
10997 int n_l;
10998 void * data; /* list data */
10999 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011001 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11002 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11003 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011004 l = gen_xmlListPtr(n_l, 0);
11005 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011006
11007 ret_val = xmlListRemoveLast(l, data);
11008 desret_int(ret_val);
11009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011010 des_xmlListPtr(n_l, l, 0);
11011 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011012 xmlResetLastError();
11013 if (mem_base != xmlMemBlocks()) {
11014 printf("Leak of %d blocks found in xmlListRemoveLast",
11015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011016 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011017 printf(" %d", n_l);
11018 printf(" %d", n_data);
11019 printf("\n");
11020 }
11021 }
11022 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011023 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011024
Daniel Veillard42595322004-11-08 10:52:06 +000011025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011026}
11027
11028
11029static int
11030test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011032
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011033 int mem_base;
11034 xmlListPtr l; /* a list */
11035 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011036
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011037 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011039 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011040
11041 xmlListReverse(l);
11042 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011043 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011044 xmlResetLastError();
11045 if (mem_base != xmlMemBlocks()) {
11046 printf("Leak of %d blocks found in xmlListReverse",
11047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011048 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011049 printf(" %d", n_l);
11050 printf("\n");
11051 }
11052 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011054
Daniel Veillard42595322004-11-08 10:52:06 +000011055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011056}
11057
11058
11059static int
11060test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011062
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011063 int mem_base;
11064 void * ret_val;
11065 xmlListPtr l; /* a list */
11066 int n_l;
11067 void * data; /* a search value */
11068 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011069
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011070 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11071 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11072 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011073 l = gen_xmlListPtr(n_l, 0);
11074 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011075
11076 ret_val = xmlListReverseSearch(l, data);
11077 desret_void_ptr(ret_val);
11078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011079 des_xmlListPtr(n_l, l, 0);
11080 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011081 xmlResetLastError();
11082 if (mem_base != xmlMemBlocks()) {
11083 printf("Leak of %d blocks found in xmlListReverseSearch",
11084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011085 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011086 printf(" %d", n_l);
11087 printf(" %d", n_data);
11088 printf("\n");
11089 }
11090 }
11091 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011093
Daniel Veillard42595322004-11-08 10:52:06 +000011094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011095}
11096
11097
11098static int
11099test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011101
11102
11103 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011105}
11106
11107
11108static int
11109test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011111
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011112 int mem_base;
11113 void * ret_val;
11114 xmlListPtr l; /* a list */
11115 int n_l;
11116 void * data; /* a search value */
11117 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011118
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011119 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11120 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011122 l = gen_xmlListPtr(n_l, 0);
11123 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011124
11125 ret_val = xmlListSearch(l, data);
11126 desret_void_ptr(ret_val);
11127 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011128 des_xmlListPtr(n_l, l, 0);
11129 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011130 xmlResetLastError();
11131 if (mem_base != xmlMemBlocks()) {
11132 printf("Leak of %d blocks found in xmlListSearch",
11133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011134 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011135 printf(" %d", n_l);
11136 printf(" %d", n_data);
11137 printf("\n");
11138 }
11139 }
11140 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011141 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011142
Daniel Veillard42595322004-11-08 10:52:06 +000011143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011144}
11145
11146
11147static int
11148test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011150
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011151 int mem_base;
11152 int ret_val;
11153 xmlListPtr l; /* a list */
11154 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011156 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11157 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011158 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011159
11160 ret_val = xmlListSize(l);
11161 desret_int(ret_val);
11162 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011163 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011164 xmlResetLastError();
11165 if (mem_base != xmlMemBlocks()) {
11166 printf("Leak of %d blocks found in xmlListSize",
11167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011168 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011169 printf(" %d", n_l);
11170 printf("\n");
11171 }
11172 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011174
Daniel Veillard42595322004-11-08 10:52:06 +000011175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011176}
11177
11178
11179static int
11180test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011182
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011183 int mem_base;
11184 xmlListPtr l; /* a list */
11185 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011186
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011187 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011189 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011190
11191 xmlListSort(l);
11192 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011193 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011194 xmlResetLastError();
11195 if (mem_base != xmlMemBlocks()) {
11196 printf("Leak of %d blocks found in xmlListSort",
11197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011198 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011199 printf(" %d", n_l);
11200 printf("\n");
11201 }
11202 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011203 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011204
Daniel Veillard42595322004-11-08 10:52:06 +000011205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011206}
11207
11208
11209static int
11210test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011212
11213
11214 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011216}
11217
11218static int
11219test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011221
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011222 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011223 test_ret += test_xmlLinkGetData();
11224 test_ret += test_xmlListAppend();
11225 test_ret += test_xmlListClear();
11226 test_ret += test_xmlListCopy();
11227 test_ret += test_xmlListCreate();
11228 test_ret += test_xmlListDup();
11229 test_ret += test_xmlListEmpty();
11230 test_ret += test_xmlListEnd();
11231 test_ret += test_xmlListFront();
11232 test_ret += test_xmlListInsert();
11233 test_ret += test_xmlListMerge();
11234 test_ret += test_xmlListPopBack();
11235 test_ret += test_xmlListPopFront();
11236 test_ret += test_xmlListPushBack();
11237 test_ret += test_xmlListPushFront();
11238 test_ret += test_xmlListRemoveAll();
11239 test_ret += test_xmlListRemoveFirst();
11240 test_ret += test_xmlListRemoveLast();
11241 test_ret += test_xmlListReverse();
11242 test_ret += test_xmlListReverseSearch();
11243 test_ret += test_xmlListReverseWalk();
11244 test_ret += test_xmlListSearch();
11245 test_ret += test_xmlListSize();
11246 test_ret += test_xmlListSort();
11247 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011248
Daniel Veillard42595322004-11-08 10:52:06 +000011249 if (test_ret != 0)
11250 printf("Module list: %d errors\n", test_ret);
11251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011252}
11253
11254static int
11255test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011257
William M. Brack21e4ef22005-01-02 09:53:13 +000011258#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011259 int mem_base;
11260 int ret_val;
11261 void * ctx; /* an FTP context */
11262 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011263
Daniel Veillard27f20102004-11-05 11:50:11 +000011264 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11265 mem_base = xmlMemBlocks();
11266 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11267
11268 ret_val = xmlNanoFTPCheckResponse(ctx);
11269 desret_int(ret_val);
11270 call_tests++;
11271 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11272 xmlResetLastError();
11273 if (mem_base != xmlMemBlocks()) {
11274 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011276 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011277 printf(" %d", n_ctx);
11278 printf("\n");
11279 }
11280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011281 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011282#endif
11283
Daniel Veillard42595322004-11-08 10:52:06 +000011284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011285}
11286
11287
11288static int
11289test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011291
William M. Brack21e4ef22005-01-02 09:53:13 +000011292#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293 int mem_base;
11294
11295 mem_base = xmlMemBlocks();
11296
11297 xmlNanoFTPCleanup();
11298 call_tests++;
11299 xmlResetLastError();
11300 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011301 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011303 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011304 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011306 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011307#endif
11308
Daniel Veillard42595322004-11-08 10:52:06 +000011309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011310}
11311
11312
11313static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011314test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011316
William M. Brack21e4ef22005-01-02 09:53:13 +000011317#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011318 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011319 int ret_val;
11320 void * ctx; /* an FTP context */
11321 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011322
Daniel Veillard27f20102004-11-05 11:50:11 +000011323 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011324 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011325 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011326
Daniel Veillard27f20102004-11-05 11:50:11 +000011327 ret_val = xmlNanoFTPCloseConnection(ctx);
11328 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011329 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011330 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011331 xmlResetLastError();
11332 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011333 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011335 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011337 printf("\n");
11338 }
11339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011340 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011341#endif
11342
Daniel Veillard42595322004-11-08 10:52:06 +000011343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344}
11345
11346
11347static int
11348test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011350
William M. Brack21e4ef22005-01-02 09:53:13 +000011351#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011352 int mem_base;
11353 int ret_val;
11354 void * ctx; /* an FTP context */
11355 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011356 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011357 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011358
Daniel Veillard27f20102004-11-05 11:50:11 +000011359 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11360 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11361 mem_base = xmlMemBlocks();
11362 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11363 directory = gen_const_char_ptr(n_directory, 1);
11364
William M. Brackf13f77f2004-11-12 16:03:48 +000011365 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011366 desret_int(ret_val);
11367 call_tests++;
11368 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011369 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011370 xmlResetLastError();
11371 if (mem_base != xmlMemBlocks()) {
11372 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011374 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011375 printf(" %d", n_ctx);
11376 printf(" %d", n_directory);
11377 printf("\n");
11378 }
11379 }
11380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011381 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011382#endif
11383
Daniel Veillard42595322004-11-08 10:52:06 +000011384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011385}
11386
11387
11388static int
11389test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011391
William M. Brack21e4ef22005-01-02 09:53:13 +000011392#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011393 int mem_base;
11394 int ret_val;
11395 void * ctx; /* an FTP context */
11396 int n_ctx;
11397 const char * file; /* a file or directory on the server */
11398 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011399
Daniel Veillard27f20102004-11-05 11:50:11 +000011400 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11401 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11402 mem_base = xmlMemBlocks();
11403 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11404 file = gen_filepath(n_file, 1);
11405
11406 ret_val = xmlNanoFTPDele(ctx, file);
11407 desret_int(ret_val);
11408 call_tests++;
11409 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11410 des_filepath(n_file, file, 1);
11411 xmlResetLastError();
11412 if (mem_base != xmlMemBlocks()) {
11413 printf("Leak of %d blocks found in xmlNanoFTPDele",
11414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011415 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011416 printf(" %d", n_ctx);
11417 printf(" %d", n_file);
11418 printf("\n");
11419 }
11420 }
11421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011422 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011423#endif
11424
Daniel Veillard42595322004-11-08 10:52:06 +000011425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011426}
11427
11428
11429static int
11430test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011432
11433
11434 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011436}
11437
11438
11439static int
11440test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011442
William M. Brack21e4ef22005-01-02 09:53:13 +000011443#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011444 int mem_base;
11445 int ret_val;
11446 void * ctx; /* an FTP context */
11447 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011448
Daniel Veillard27f20102004-11-05 11:50:11 +000011449 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11450 mem_base = xmlMemBlocks();
11451 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11452
11453 ret_val = xmlNanoFTPGetConnection(ctx);
11454 desret_int(ret_val);
11455 call_tests++;
11456 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11457 xmlResetLastError();
11458 if (mem_base != xmlMemBlocks()) {
11459 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011461 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011462 printf(" %d", n_ctx);
11463 printf("\n");
11464 }
11465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011466 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011467#endif
11468
Daniel Veillard42595322004-11-08 10:52:06 +000011469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011470}
11471
11472
11473static int
11474test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011476
William M. Brack21e4ef22005-01-02 09:53:13 +000011477#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011478 int mem_base;
11479 int ret_val;
11480 void * ctx; /* an FTP context */
11481 int n_ctx;
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 mem_base = xmlMemBlocks();
11485 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11486
11487 ret_val = xmlNanoFTPGetResponse(ctx);
11488 desret_int(ret_val);
11489 call_tests++;
11490 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11491 xmlResetLastError();
11492 if (mem_base != xmlMemBlocks()) {
11493 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011495 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011496 printf(" %d", n_ctx);
11497 printf("\n");
11498 }
11499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011500 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011501#endif
11502
Daniel Veillard42595322004-11-08 10:52:06 +000011503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011504}
11505
11506
11507static int
11508test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011510
William M. Brack21e4ef22005-01-02 09:53:13 +000011511#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011512 int mem_base;
11513 int ret_val;
11514 void * ctx; /* an FTP context */
11515 int n_ctx;
11516 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11517 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011518
Daniel Veillard27f20102004-11-05 11:50:11 +000011519 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11520 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11521 mem_base = xmlMemBlocks();
11522 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11523 filename = gen_filepath(n_filename, 1);
11524
11525 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11526 desret_int(ret_val);
11527 call_tests++;
11528 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11529 des_filepath(n_filename, filename, 1);
11530 xmlResetLastError();
11531 if (mem_base != xmlMemBlocks()) {
11532 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011534 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011535 printf(" %d", n_ctx);
11536 printf(" %d", n_filename);
11537 printf("\n");
11538 }
11539 }
11540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011541 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011542#endif
11543
Daniel Veillard42595322004-11-08 10:52:06 +000011544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545}
11546
11547
11548static int
11549test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011551
William M. Brack21e4ef22005-01-02 09:53:13 +000011552#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011553 int mem_base;
11554
11555 mem_base = xmlMemBlocks();
11556
11557 xmlNanoFTPInit();
11558 call_tests++;
11559 xmlResetLastError();
11560 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011561 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011563 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011566 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011567#endif
11568
Daniel Veillard42595322004-11-08 10:52:06 +000011569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011570}
11571
11572
11573static int
11574test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576
11577
11578 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011580}
11581
11582
11583static int
11584test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011586
William M. Brack015ccb22005-02-13 08:18:52 +000011587#if defined(LIBXML_FTP_ENABLED)
11588 int mem_base;
11589 void * ret_val;
11590 const char * URL; /* The URL used to initialize the context */
11591 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011592
William M. Brack015ccb22005-02-13 08:18:52 +000011593 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11594 mem_base = xmlMemBlocks();
11595 URL = gen_filepath(n_URL, 0);
11596
11597 ret_val = xmlNanoFTPNewCtxt(URL);
11598 desret_xmlNanoFTPCtxtPtr(ret_val);
11599 call_tests++;
11600 des_filepath(n_URL, URL, 0);
11601 xmlResetLastError();
11602 if (mem_base != xmlMemBlocks()) {
11603 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11604 xmlMemBlocks() - mem_base);
11605 test_ret++;
11606 printf(" %d", n_URL);
11607 printf("\n");
11608 }
11609 }
11610 function_tests++;
11611#endif
11612
Daniel Veillard42595322004-11-08 10:52:06 +000011613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011614}
11615
11616
11617static int
11618test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011620
William M. Brack21e4ef22005-01-02 09:53:13 +000011621#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011622 int mem_base;
11623 void * ret_val;
11624 const char * URL; /* the URL to the resource */
11625 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011626
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011627 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11628 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011629 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011630
11631 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011632 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011633 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011634 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011635 xmlResetLastError();
11636 if (mem_base != xmlMemBlocks()) {
11637 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011639 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011640 printf(" %d", n_URL);
11641 printf("\n");
11642 }
11643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011644 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011645#endif
11646
Daniel Veillard42595322004-11-08 10:52:06 +000011647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011648}
11649
11650
11651static int
11652test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011654
William M. Brack21e4ef22005-01-02 09:53:13 +000011655#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011656 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011657 int n_host;
11658 int port; /* the proxy port */
11659 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011660 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011661 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011662 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011663 int n_passwd;
11664 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11665 int n_type;
11666
11667 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11668 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11669 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11670 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11671 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011672 host = gen_const_char_ptr(n_host, 0);
11673 port = gen_int(n_port, 1);
11674 user = gen_const_char_ptr(n_user, 2);
11675 passwd = gen_const_char_ptr(n_passwd, 3);
11676 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011677
William M. Brackf13f77f2004-11-12 16:03:48 +000011678 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011679 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011680 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011681 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011682 des_const_char_ptr(n_user, (const char *)user, 2);
11683 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011684 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011685 xmlResetLastError();
11686 }
11687 }
11688 }
11689 }
11690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011691 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011692#endif
11693
Daniel Veillard42595322004-11-08 10:52:06 +000011694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011695}
11696
11697
11698static int
11699test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011701
William M. Brack21e4ef22005-01-02 09:53:13 +000011702#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011703 int mem_base;
11704 int ret_val;
11705 void * ctx; /* an FTP context */
11706 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011707
Daniel Veillard27f20102004-11-05 11:50:11 +000011708 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11709 mem_base = xmlMemBlocks();
11710 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11711
11712 ret_val = xmlNanoFTPQuit(ctx);
11713 desret_int(ret_val);
11714 call_tests++;
11715 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11716 xmlResetLastError();
11717 if (mem_base != xmlMemBlocks()) {
11718 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011720 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011721 printf(" %d", n_ctx);
11722 printf("\n");
11723 }
11724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011725 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011726#endif
11727
Daniel Veillard42595322004-11-08 10:52:06 +000011728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011729}
11730
11731
11732static int
11733test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011735
William M. Brack21e4ef22005-01-02 09:53:13 +000011736#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011737 int mem_base;
11738 int ret_val;
11739 void * ctx; /* the FTP context */
11740 int n_ctx;
11741 void * dest; /* a buffer */
11742 int n_dest;
11743 int len; /* the buffer length */
11744 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011745
Daniel Veillard27f20102004-11-05 11:50:11 +000011746 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11747 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11748 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11749 mem_base = xmlMemBlocks();
11750 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11751 dest = gen_void_ptr(n_dest, 1);
11752 len = gen_int(n_len, 2);
11753
11754 ret_val = xmlNanoFTPRead(ctx, dest, len);
11755 desret_int(ret_val);
11756 call_tests++;
11757 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11758 des_void_ptr(n_dest, dest, 1);
11759 des_int(n_len, len, 2);
11760 xmlResetLastError();
11761 if (mem_base != xmlMemBlocks()) {
11762 printf("Leak of %d blocks found in xmlNanoFTPRead",
11763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011764 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011765 printf(" %d", n_ctx);
11766 printf(" %d", n_dest);
11767 printf(" %d", n_len);
11768 printf("\n");
11769 }
11770 }
11771 }
11772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011773 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011774#endif
11775
Daniel Veillard42595322004-11-08 10:52:06 +000011776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011777}
11778
11779
11780static int
11781test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011783
William M. Brack21e4ef22005-01-02 09:53:13 +000011784#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785 const char * URL; /* The proxy URL used to initialize the proxy context */
11786 int n_URL;
11787
11788 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011789 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011790
11791 xmlNanoFTPScanProxy(URL);
11792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011793 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011794 xmlResetLastError();
11795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011796 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011797#endif
11798
Daniel Veillard42595322004-11-08 10:52:06 +000011799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011800}
11801
11802
11803static int
11804test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011806
William M. Brack21e4ef22005-01-02 09:53:13 +000011807#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011808 int mem_base;
11809 int ret_val;
11810 void * ctx; /* an FTP context */
11811 int n_ctx;
11812 const char * URL; /* The URL used to update the context */
11813 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011814
Daniel Veillard27f20102004-11-05 11:50:11 +000011815 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11816 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11817 mem_base = xmlMemBlocks();
11818 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11819 URL = gen_filepath(n_URL, 1);
11820
11821 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11822 desret_int(ret_val);
11823 call_tests++;
11824 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11825 des_filepath(n_URL, URL, 1);
11826 xmlResetLastError();
11827 if (mem_base != xmlMemBlocks()) {
11828 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011830 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011831 printf(" %d", n_ctx);
11832 printf(" %d", n_URL);
11833 printf("\n");
11834 }
11835 }
11836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011837 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011838#endif
11839
Daniel Veillard42595322004-11-08 10:52:06 +000011840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011841}
11842
11843static int
11844test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011846
William M. Brack015ccb22005-02-13 08:18:52 +000011847 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011848 test_ret += test_xmlNanoFTPCheckResponse();
11849 test_ret += test_xmlNanoFTPCleanup();
11850 test_ret += test_xmlNanoFTPCloseConnection();
11851 test_ret += test_xmlNanoFTPCwd();
11852 test_ret += test_xmlNanoFTPDele();
11853 test_ret += test_xmlNanoFTPGet();
11854 test_ret += test_xmlNanoFTPGetConnection();
11855 test_ret += test_xmlNanoFTPGetResponse();
11856 test_ret += test_xmlNanoFTPGetSocket();
11857 test_ret += test_xmlNanoFTPInit();
11858 test_ret += test_xmlNanoFTPList();
11859 test_ret += test_xmlNanoFTPNewCtxt();
11860 test_ret += test_xmlNanoFTPOpen();
11861 test_ret += test_xmlNanoFTPProxy();
11862 test_ret += test_xmlNanoFTPQuit();
11863 test_ret += test_xmlNanoFTPRead();
11864 test_ret += test_xmlNanoFTPScanProxy();
11865 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011866
Daniel Veillard42595322004-11-08 10:52:06 +000011867 if (test_ret != 0)
11868 printf("Module nanoftp: %d errors\n", test_ret);
11869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011870}
11871
11872static int
11873test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011875
William M. Brack21e4ef22005-01-02 09:53:13 +000011876#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011877 int mem_base;
11878 const char * ret_val;
11879 void * ctx; /* the HTTP context */
11880 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011881
Daniel Veillard27f20102004-11-05 11:50:11 +000011882 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11883 mem_base = xmlMemBlocks();
11884 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11885
11886 ret_val = xmlNanoHTTPAuthHeader(ctx);
11887 desret_const_char_ptr(ret_val);
11888 call_tests++;
11889 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11890 xmlResetLastError();
11891 if (mem_base != xmlMemBlocks()) {
11892 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011894 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011895 printf(" %d", n_ctx);
11896 printf("\n");
11897 }
11898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011899 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011900#endif
11901
Daniel Veillard42595322004-11-08 10:52:06 +000011902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011903}
11904
11905
11906static int
11907test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011909
William M. Brack21e4ef22005-01-02 09:53:13 +000011910#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011911 int mem_base;
11912
11913 mem_base = xmlMemBlocks();
11914
11915 xmlNanoHTTPCleanup();
11916 call_tests++;
11917 xmlResetLastError();
11918 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011919 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011921 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011922 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011924 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925#endif
11926
Daniel Veillard42595322004-11-08 10:52:06 +000011927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011928}
11929
11930
11931static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011932test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011934
William M. Brack21e4ef22005-01-02 09:53:13 +000011935#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011936 int mem_base;
11937 int 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 = xmlNanoHTTPContentLength(ctx);
11946 desret_int(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 xmlNanoHTTPContentLength",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011958 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011959#endif
11960
Daniel Veillard42595322004-11-08 10:52:06 +000011961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011962}
11963
11964
11965static int
11966test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011968
William M. Brack21e4ef22005-01-02 09:53:13 +000011969#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011970 int mem_base;
11971 const char * ret_val;
11972 void * ctx; /* the HTTP context */
11973 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011974
Daniel Veillard27f20102004-11-05 11:50:11 +000011975 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11976 mem_base = xmlMemBlocks();
11977 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11978
11979 ret_val = xmlNanoHTTPEncoding(ctx);
11980 desret_const_char_ptr(ret_val);
11981 call_tests++;
11982 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11983 xmlResetLastError();
11984 if (mem_base != xmlMemBlocks()) {
11985 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011987 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011988 printf(" %d", n_ctx);
11989 printf("\n");
11990 }
11991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011992 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011993#endif
11994
Daniel Veillard42595322004-11-08 10:52:06 +000011995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011996}
11997
11998
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011999#define gen_nb_char_ptr_ptr 1
12000static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12001 return(NULL);
12002}
12003static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12004}
12005
Daniel Veillardd93f6252004-11-02 15:53:51 +000012006static int
12007test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012009
William M. Brack21e4ef22005-01-02 09:53:13 +000012010#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012011 int mem_base;
12012 int ret_val;
12013 const char * URL; /* The URL to load */
12014 int n_URL;
12015 const char * filename; /* the filename where the content should be saved */
12016 int n_filename;
12017 char ** contentType; /* if available the Content-Type information will be returned at that location */
12018 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019
William M. Brack015ccb22005-02-13 08:18:52 +000012020 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
12021 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012022 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12023 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000012024 URL = gen_fileoutput(n_URL, 0);
12025 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012026 contentType = gen_char_ptr_ptr(n_contentType, 2);
12027
12028 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12029 desret_int(ret_val);
12030 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000012031 des_fileoutput(n_URL, URL, 0);
12032 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012033 des_char_ptr_ptr(n_contentType, contentType, 2);
12034 xmlResetLastError();
12035 if (mem_base != xmlMemBlocks()) {
12036 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012038 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012039 printf(" %d", n_URL);
12040 printf(" %d", n_filename);
12041 printf(" %d", n_contentType);
12042 printf("\n");
12043 }
12044 }
12045 }
12046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012047 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012048#endif
12049
Daniel Veillard42595322004-11-08 10:52:06 +000012050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012051}
12052
12053
12054static int
12055test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012057
William M. Brack21e4ef22005-01-02 09:53:13 +000012058#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059 int mem_base;
12060
12061 mem_base = xmlMemBlocks();
12062
12063 xmlNanoHTTPInit();
12064 call_tests++;
12065 xmlResetLastError();
12066 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012067 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012069 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012070 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012072 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012073#endif
12074
Daniel Veillard42595322004-11-08 10:52:06 +000012075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012076}
12077
12078
12079static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012080test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012082
William M. Brack21e4ef22005-01-02 09:53:13 +000012083#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012084 int mem_base;
12085 const char * ret_val;
12086 void * ctx; /* the HTTP context */
12087 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012088
Daniel Veillard27f20102004-11-05 11:50:11 +000012089 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12090 mem_base = xmlMemBlocks();
12091 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12092
12093 ret_val = xmlNanoHTTPMimeType(ctx);
12094 desret_const_char_ptr(ret_val);
12095 call_tests++;
12096 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12097 xmlResetLastError();
12098 if (mem_base != xmlMemBlocks()) {
12099 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012101 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012102 printf(" %d", n_ctx);
12103 printf("\n");
12104 }
12105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012106 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012107#endif
12108
Daniel Veillard42595322004-11-08 10:52:06 +000012109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012110}
12111
12112
12113static int
12114test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012116
William M. Brack21e4ef22005-01-02 09:53:13 +000012117#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012118 int mem_base;
12119 void * ret_val;
12120 const char * URL; /* The URL to load */
12121 int n_URL;
12122 char ** contentType; /* if available the Content-Type information will be returned at that location */
12123 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012124
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012125 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12126 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12127 mem_base = xmlMemBlocks();
12128 URL = gen_filepath(n_URL, 0);
12129 contentType = gen_char_ptr_ptr(n_contentType, 1);
12130
12131 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012132 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012133 call_tests++;
12134 des_filepath(n_URL, URL, 0);
12135 des_char_ptr_ptr(n_contentType, contentType, 1);
12136 xmlResetLastError();
12137 if (mem_base != xmlMemBlocks()) {
12138 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012140 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012141 printf(" %d", n_URL);
12142 printf(" %d", n_contentType);
12143 printf("\n");
12144 }
12145 }
12146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012147 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012148#endif
12149
Daniel Veillard42595322004-11-08 10:52:06 +000012150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012151}
12152
12153
12154static int
12155test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012157
William M. Brack21e4ef22005-01-02 09:53:13 +000012158#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012159 int mem_base;
12160 void * ret_val;
12161 const char * URL; /* The URL to load */
12162 int n_URL;
12163 char ** contentType; /* if available the Content-Type information will be returned at that location */
12164 int n_contentType;
12165 char ** redir; /* if available the redirected URL will be returned */
12166 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012167
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012168 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12169 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12170 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12171 mem_base = xmlMemBlocks();
12172 URL = gen_filepath(n_URL, 0);
12173 contentType = gen_char_ptr_ptr(n_contentType, 1);
12174 redir = gen_char_ptr_ptr(n_redir, 2);
12175
12176 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012177 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012178 call_tests++;
12179 des_filepath(n_URL, URL, 0);
12180 des_char_ptr_ptr(n_contentType, contentType, 1);
12181 des_char_ptr_ptr(n_redir, redir, 2);
12182 xmlResetLastError();
12183 if (mem_base != xmlMemBlocks()) {
12184 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012186 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012187 printf(" %d", n_URL);
12188 printf(" %d", n_contentType);
12189 printf(" %d", n_redir);
12190 printf("\n");
12191 }
12192 }
12193 }
12194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012195 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012196#endif
12197
Daniel Veillard42595322004-11-08 10:52:06 +000012198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012199}
12200
12201
12202static int
12203test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012205
William M. Brack21e4ef22005-01-02 09:53:13 +000012206#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012207 int mem_base;
12208 int ret_val;
12209 void * ctx; /* the HTTP context */
12210 int n_ctx;
12211 void * dest; /* a buffer */
12212 int n_dest;
12213 int len; /* the buffer length */
12214 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012215
Daniel Veillard27f20102004-11-05 11:50:11 +000012216 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12217 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12218 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12219 mem_base = xmlMemBlocks();
12220 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12221 dest = gen_void_ptr(n_dest, 1);
12222 len = gen_int(n_len, 2);
12223
12224 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12225 desret_int(ret_val);
12226 call_tests++;
12227 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12228 des_void_ptr(n_dest, dest, 1);
12229 des_int(n_len, len, 2);
12230 xmlResetLastError();
12231 if (mem_base != xmlMemBlocks()) {
12232 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012234 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012235 printf(" %d", n_ctx);
12236 printf(" %d", n_dest);
12237 printf(" %d", n_len);
12238 printf("\n");
12239 }
12240 }
12241 }
12242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012243 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012244#endif
12245
Daniel Veillard42595322004-11-08 10:52:06 +000012246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012247}
12248
12249
12250static int
12251test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012253
12254
12255 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012257}
12258
12259
12260static int
12261test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012263
William M. Brack21e4ef22005-01-02 09:53:13 +000012264#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012265 int mem_base;
12266 int ret_val;
12267 void * ctx; /* the HTTP context */
12268 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012269
Daniel Veillard27f20102004-11-05 11:50:11 +000012270 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12271 mem_base = xmlMemBlocks();
12272 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12273
12274 ret_val = xmlNanoHTTPReturnCode(ctx);
12275 desret_int(ret_val);
12276 call_tests++;
12277 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12278 xmlResetLastError();
12279 if (mem_base != xmlMemBlocks()) {
12280 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012282 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012283 printf(" %d", n_ctx);
12284 printf("\n");
12285 }
12286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012287 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012288#endif
12289
Daniel Veillard42595322004-11-08 10:52:06 +000012290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012291}
12292
12293
12294static int
12295test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012297
William M. Brack21e4ef22005-01-02 09:53:13 +000012298#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012299 int mem_base;
12300 int ret_val;
12301 void * ctxt; /* the HTTP context */
12302 int n_ctxt;
12303 const char * filename; /* the filename where the content should be saved */
12304 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012305
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012306 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12307 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12308 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012309 ctxt = gen_void_ptr(n_ctxt, 0);
12310 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012311
12312 ret_val = xmlNanoHTTPSave(ctxt, filename);
12313 desret_int(ret_val);
12314 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012315 des_void_ptr(n_ctxt, ctxt, 0);
12316 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012317 xmlResetLastError();
12318 if (mem_base != xmlMemBlocks()) {
12319 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012321 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012322 printf(" %d", n_ctxt);
12323 printf(" %d", n_filename);
12324 printf("\n");
12325 }
12326 }
12327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012328 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012329#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012330
Daniel Veillard42595322004-11-08 10:52:06 +000012331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012332}
12333
12334
12335static int
12336test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012338
William M. Brack21e4ef22005-01-02 09:53:13 +000012339#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012340 const char * URL; /* The proxy URL used to initialize the proxy context */
12341 int n_URL;
12342
12343 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012344 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012345
12346 xmlNanoHTTPScanProxy(URL);
12347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012348 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012349 xmlResetLastError();
12350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012351 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012352#endif
12353
Daniel Veillard42595322004-11-08 10:52:06 +000012354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355}
12356
12357static int
12358test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012360
William M. Brack015ccb22005-02-13 08:18:52 +000012361 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012362 test_ret += test_xmlNanoHTTPAuthHeader();
12363 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012364 test_ret += test_xmlNanoHTTPContentLength();
12365 test_ret += test_xmlNanoHTTPEncoding();
12366 test_ret += test_xmlNanoHTTPFetch();
12367 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012368 test_ret += test_xmlNanoHTTPMimeType();
12369 test_ret += test_xmlNanoHTTPOpen();
12370 test_ret += test_xmlNanoHTTPOpenRedir();
12371 test_ret += test_xmlNanoHTTPRead();
12372 test_ret += test_xmlNanoHTTPRedir();
12373 test_ret += test_xmlNanoHTTPReturnCode();
12374 test_ret += test_xmlNanoHTTPSave();
12375 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012376
Daniel Veillard42595322004-11-08 10:52:06 +000012377 if (test_ret != 0)
12378 printf("Module nanohttp: %d errors\n", test_ret);
12379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012380}
12381
12382static int
12383test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012385
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012386 int mem_base;
12387 long ret_val;
12388 xmlParserCtxtPtr ctxt; /* an XML parser context */
12389 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012390
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012391 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12392 mem_base = xmlMemBlocks();
12393 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12394
12395 ret_val = xmlByteConsumed(ctxt);
12396 desret_long(ret_val);
12397 call_tests++;
12398 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12399 xmlResetLastError();
12400 if (mem_base != xmlMemBlocks()) {
12401 printf("Leak of %d blocks found in xmlByteConsumed",
12402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012403 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012404 printf(" %d", n_ctxt);
12405 printf("\n");
12406 }
12407 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012408 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012409
Daniel Veillard42595322004-11-08 10:52:06 +000012410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012411}
12412
12413
12414static int
12415test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012417
Daniel Veillardce682bc2004-11-05 17:22:25 +000012418 int mem_base;
12419 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12420 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012421
Daniel Veillardce682bc2004-11-05 17:22:25 +000012422 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12423 mem_base = xmlMemBlocks();
12424 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12425
12426 xmlClearNodeInfoSeq(seq);
12427 call_tests++;
12428 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12429 xmlResetLastError();
12430 if (mem_base != xmlMemBlocks()) {
12431 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012433 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012434 printf(" %d", n_seq);
12435 printf("\n");
12436 }
12437 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012439
Daniel Veillard42595322004-11-08 10:52:06 +000012440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441}
12442
12443
12444static int
12445test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012447
12448 int mem_base;
12449 xmlParserCtxtPtr ctxt; /* an XML parser context */
12450 int n_ctxt;
12451
12452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012454 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012455
12456 xmlClearParserCtxt(ctxt);
12457 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012458 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012459 xmlResetLastError();
12460 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012461 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012464 printf(" %d", n_ctxt);
12465 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012466 }
12467 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012468 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012469
Daniel Veillard42595322004-11-08 10:52:06 +000012470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012471}
12472
12473
12474static int
12475test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012477
Daniel Veillard34099b42004-11-04 17:34:35 +000012478 int mem_base;
12479 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012480 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012481 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012482
Daniel Veillard34099b42004-11-04 17:34:35 +000012483 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12484 mem_base = xmlMemBlocks();
12485 cur = gen_const_xmlChar_ptr(n_cur, 0);
12486
William M. Brackf13f77f2004-11-12 16:03:48 +000012487 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012488 desret_xmlParserCtxtPtr(ret_val);
12489 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012490 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012491 xmlResetLastError();
12492 if (mem_base != xmlMemBlocks()) {
12493 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012495 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012496 printf(" %d", n_cur);
12497 printf("\n");
12498 }
12499 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012500 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012501
Daniel Veillard42595322004-11-08 10:52:06 +000012502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012503}
12504
12505
12506static int
12507test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012509
William M. Brack21e4ef22005-01-02 09:53:13 +000012510#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012511 int mem_base;
12512 xmlParserCtxtPtr ret_val;
12513 xmlSAXHandlerPtr sax; /* a SAX handler */
12514 int n_sax;
12515 void * user_data; /* The user data returned on SAX callbacks */
12516 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012517 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012518 int n_chunk;
12519 int size; /* number of chars in the array */
12520 int n_size;
12521 const char * filename; /* an optional file name or URI */
12522 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523
Daniel Veillard34099b42004-11-04 17:34:35 +000012524 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12525 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12526 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12527 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012528 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012529 mem_base = xmlMemBlocks();
12530 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12531 user_data = gen_userdata(n_user_data, 1);
12532 chunk = gen_const_char_ptr(n_chunk, 2);
12533 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012534 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012535
William M. Brackf13f77f2004-11-12 16:03:48 +000012536 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012537 desret_xmlParserCtxtPtr(ret_val);
12538 call_tests++;
12539 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12540 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012541 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012542 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012543 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012544 xmlResetLastError();
12545 if (mem_base != xmlMemBlocks()) {
12546 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012548 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012549 printf(" %d", n_sax);
12550 printf(" %d", n_user_data);
12551 printf(" %d", n_chunk);
12552 printf(" %d", n_size);
12553 printf(" %d", n_filename);
12554 printf("\n");
12555 }
12556 }
12557 }
12558 }
12559 }
12560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012561 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012562#endif
12563
Daniel Veillard42595322004-11-08 10:52:06 +000012564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012565}
12566
12567
12568static int
12569test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012571
12572 int mem_base;
12573 xmlDocPtr ret_val;
12574 xmlParserCtxtPtr ctxt; /* an XML parser context */
12575 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012576 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012577 int n_cur;
12578 const char * URL; /* the base URL to use for the document */
12579 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012580 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012581 int n_encoding;
12582 int options; /* a combination of xmlParserOption */
12583 int n_options;
12584
12585 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12586 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12587 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12588 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012589 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012591 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12592 cur = gen_const_xmlChar_ptr(n_cur, 1);
12593 URL = gen_filepath(n_URL, 2);
12594 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012595 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012596
William M. Brackf13f77f2004-11-12 16:03:48 +000012597 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012598 desret_xmlDocPtr(ret_val);
12599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012600 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012601 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012602 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012603 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012604 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012605 xmlResetLastError();
12606 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012607 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012609 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012610 printf(" %d", n_ctxt);
12611 printf(" %d", n_cur);
12612 printf(" %d", n_URL);
12613 printf(" %d", n_encoding);
12614 printf(" %d", n_options);
12615 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012616 }
12617 }
12618 }
12619 }
12620 }
12621 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012622 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012623
Daniel Veillard42595322004-11-08 10:52:06 +000012624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012625}
12626
12627
12628static int
12629test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012631
12632 int mem_base;
12633 xmlDocPtr ret_val;
12634 xmlParserCtxtPtr ctxt; /* an XML parser context */
12635 int n_ctxt;
12636 const char * filename; /* a file or URL */
12637 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012638 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012639 int n_encoding;
12640 int options; /* a combination of xmlParserOption */
12641 int n_options;
12642
12643 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12644 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12645 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012646 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012647 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012648 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12649 filename = gen_filepath(n_filename, 1);
12650 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012651 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012652
William M. Brackf13f77f2004-11-12 16:03:48 +000012653 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012654 desret_xmlDocPtr(ret_val);
12655 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012656 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12657 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012658 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012659 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012660 xmlResetLastError();
12661 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012662 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012664 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012665 printf(" %d", n_ctxt);
12666 printf(" %d", n_filename);
12667 printf(" %d", n_encoding);
12668 printf(" %d", n_options);
12669 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670 }
12671 }
12672 }
12673 }
12674 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012676
Daniel Veillard42595322004-11-08 10:52:06 +000012677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012678}
12679
12680
12681static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012682test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012684
12685 int mem_base;
12686 xmlDocPtr ret_val;
12687 xmlParserCtxtPtr ctxt; /* an XML parser context */
12688 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012689 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012690 int n_buffer;
12691 int size; /* the size of the array */
12692 int n_size;
12693 const char * URL; /* the base URL to use for the document */
12694 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012695 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012696 int n_encoding;
12697 int options; /* a combination of xmlParserOption */
12698 int n_options;
12699
12700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12701 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12702 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12703 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12704 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012705 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012707 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12708 buffer = gen_const_char_ptr(n_buffer, 1);
12709 size = gen_int(n_size, 2);
12710 URL = gen_filepath(n_URL, 3);
12711 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012712 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012713
William M. Brackf13f77f2004-11-12 16:03:48 +000012714 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715 desret_xmlDocPtr(ret_val);
12716 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012717 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012718 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012719 des_int(n_size, size, 2);
12720 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012721 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012722 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012723 xmlResetLastError();
12724 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012725 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012727 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012728 printf(" %d", n_ctxt);
12729 printf(" %d", n_buffer);
12730 printf(" %d", n_size);
12731 printf(" %d", n_URL);
12732 printf(" %d", n_encoding);
12733 printf(" %d", n_options);
12734 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012735 }
12736 }
12737 }
12738 }
12739 }
12740 }
12741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012743
Daniel Veillard42595322004-11-08 10:52:06 +000012744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745}
12746
12747
12748static int
12749test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751
12752 int mem_base;
12753 xmlParserCtxtPtr ctxt; /* an XML parser context */
12754 int n_ctxt;
12755
12756 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012758 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012759
12760 xmlCtxtReset(ctxt);
12761 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012762 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012763 xmlResetLastError();
12764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012765 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012768 printf(" %d", n_ctxt);
12769 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770 }
12771 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012773
Daniel Veillard42595322004-11-08 10:52:06 +000012774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012775}
12776
12777
12778static int
12779test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012781
12782 int mem_base;
12783 int ret_val;
12784 xmlParserCtxtPtr ctxt; /* an XML parser context */
12785 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012786 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 int n_chunk;
12788 int size; /* number of chars in the array */
12789 int n_size;
12790 const char * filename; /* an optional file name or URI */
12791 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012792 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012793 int n_encoding;
12794
12795 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12796 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12797 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12798 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12799 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12800 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012801 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12802 chunk = gen_const_char_ptr(n_chunk, 1);
12803 size = gen_int(n_size, 2);
12804 filename = gen_filepath(n_filename, 3);
12805 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012806
William M. Brackf13f77f2004-11-12 16:03:48 +000012807 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012808 desret_int(ret_val);
12809 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012810 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012811 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012812 des_int(n_size, size, 2);
12813 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012814 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012815 xmlResetLastError();
12816 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012817 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012819 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012820 printf(" %d", n_ctxt);
12821 printf(" %d", n_chunk);
12822 printf(" %d", n_size);
12823 printf(" %d", n_filename);
12824 printf(" %d", n_encoding);
12825 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012826 }
12827 }
12828 }
12829 }
12830 }
12831 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012833
Daniel Veillard42595322004-11-08 10:52:06 +000012834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012835}
12836
12837
12838static int
12839test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012841
12842 int mem_base;
12843 int ret_val;
12844 xmlParserCtxtPtr ctxt; /* an XML parser context */
12845 int n_ctxt;
12846 int options; /* a combination of xmlParserOption */
12847 int n_options;
12848
12849 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012850 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012852 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012853 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012854
12855 ret_val = xmlCtxtUseOptions(ctxt, options);
12856 desret_int(ret_val);
12857 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012858 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012859 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012860 xmlResetLastError();
12861 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012862 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012864 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012865 printf(" %d", n_ctxt);
12866 printf(" %d", n_options);
12867 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012868 }
12869 }
12870 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012871 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012872
Daniel Veillard42595322004-11-08 10:52:06 +000012873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012874}
12875
12876
12877static int
12878test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
12881
12882 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012884}
12885
12886
12887static int
12888test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012890
William M. Brack21e4ef22005-01-02 09:53:13 +000012891#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012892#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012893 int mem_base;
12894 int ret_val;
12895 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12896 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012897 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012898 int n_name;
12899 void * result; /* location to store the result */
12900 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012901
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012902 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12903 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12904 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12905 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012906 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12907 name = gen_const_char_ptr(n_name, 1);
12908 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012909
William M. Brackf13f77f2004-11-12 16:03:48 +000012910 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012911 desret_int(ret_val);
12912 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012913 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012914 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012915 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012916 xmlResetLastError();
12917 if (mem_base != xmlMemBlocks()) {
12918 printf("Leak of %d blocks found in xmlGetFeature",
12919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012920 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012921 printf(" %d", n_ctxt);
12922 printf(" %d", n_name);
12923 printf(" %d", n_result);
12924 printf("\n");
12925 }
12926 }
12927 }
12928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012929 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012930#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012931#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012932
Daniel Veillard42595322004-11-08 10:52:06 +000012933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934}
12935
12936
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012937#define gen_nb_const_char_ptr_ptr 1
12938static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12939 return(NULL);
12940}
12941static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12942}
12943
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944static int
12945test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012947
William M. Brack21e4ef22005-01-02 09:53:13 +000012948#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012949#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012950 int mem_base;
12951 int ret_val;
12952 int * len; /* the length of the features name array (input/output) */
12953 int n_len;
12954 char ** result; /* an array of string to be filled with the features name. */
12955 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012956
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012957 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12958 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12959 mem_base = xmlMemBlocks();
12960 len = gen_int_ptr(n_len, 0);
12961 result = gen_const_char_ptr_ptr(n_result, 1);
12962
William M. Brackf13f77f2004-11-12 16:03:48 +000012963 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012964 desret_int(ret_val);
12965 call_tests++;
12966 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012967 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012968 xmlResetLastError();
12969 if (mem_base != xmlMemBlocks()) {
12970 printf("Leak of %d blocks found in xmlGetFeaturesList",
12971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012972 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012973 printf(" %d", n_len);
12974 printf(" %d", n_result);
12975 printf("\n");
12976 }
12977 }
12978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012979 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012980#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012981#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012982
Daniel Veillard42595322004-11-08 10:52:06 +000012983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012984}
12985
12986
12987static int
12988test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012990
William M. Brack21e4ef22005-01-02 09:53:13 +000012991#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012992#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012993 int mem_base;
12994 xmlDtdPtr ret_val;
12995 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12996 int n_sax;
12997 xmlParserInputBufferPtr input; /* an Input Buffer */
12998 int n_input;
12999 xmlCharEncoding enc; /* the charset encoding if known */
13000 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013001
Daniel Veillard34099b42004-11-04 17:34:35 +000013002 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13003 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13004 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13005 mem_base = xmlMemBlocks();
13006 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13007 input = gen_xmlParserInputBufferPtr(n_input, 1);
13008 enc = gen_xmlCharEncoding(n_enc, 2);
13009
13010 ret_val = xmlIOParseDTD(sax, input, enc);
13011 input = NULL;
13012 desret_xmlDtdPtr(ret_val);
13013 call_tests++;
13014 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13015 des_xmlParserInputBufferPtr(n_input, input, 1);
13016 des_xmlCharEncoding(n_enc, enc, 2);
13017 xmlResetLastError();
13018 if (mem_base != xmlMemBlocks()) {
13019 printf("Leak of %d blocks found in xmlIOParseDTD",
13020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013021 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013022 printf(" %d", n_sax);
13023 printf(" %d", n_input);
13024 printf(" %d", n_enc);
13025 printf("\n");
13026 }
13027 }
13028 }
13029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013030 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013031#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013032#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013033
Daniel Veillard42595322004-11-08 10:52:06 +000013034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013035}
13036
13037
13038static int
13039test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013041
Daniel Veillardce682bc2004-11-05 17:22:25 +000013042 int mem_base;
13043 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13044 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013045
Daniel Veillardce682bc2004-11-05 17:22:25 +000013046 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13047 mem_base = xmlMemBlocks();
13048 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13049
13050 xmlInitNodeInfoSeq(seq);
13051 call_tests++;
13052 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13053 xmlResetLastError();
13054 if (mem_base != xmlMemBlocks()) {
13055 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013057 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013058 printf(" %d", n_seq);
13059 printf("\n");
13060 }
13061 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013062 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013063
Daniel Veillard42595322004-11-08 10:52:06 +000013064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013065}
13066
13067
13068static int
13069test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013071
13072 int mem_base;
13073
13074 mem_base = xmlMemBlocks();
13075
13076 xmlInitParser();
13077 call_tests++;
13078 xmlResetLastError();
13079 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013080 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013082 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013083 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013084 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013085 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013086
Daniel Veillard42595322004-11-08 10:52:06 +000013087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013088}
13089
13090
13091static int
13092test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013094
13095 int mem_base;
13096 int ret_val;
13097 xmlParserCtxtPtr ctxt; /* an XML parser context */
13098 int n_ctxt;
13099
13100 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13101 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013102 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013103
13104 ret_val = xmlInitParserCtxt(ctxt);
13105 desret_int(ret_val);
13106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013107 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
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 xmlInitParserCtxt",
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("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013115 }
13116 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013117 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013118
Daniel Veillard42595322004-11-08 10:52:06 +000013119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013120}
13121
13122
13123static int
13124test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126
13127 int mem_base;
13128 int ret_val;
13129 int val; /* int 0 or 1 */
13130 int n_val;
13131
13132 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13133 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013134 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013135
13136 ret_val = xmlKeepBlanksDefault(val);
13137 desret_int(ret_val);
13138 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013139 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013140 xmlResetLastError();
13141 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013142 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013144 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013145 printf(" %d", n_val);
13146 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013147 }
13148 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013149 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013150
Daniel Veillard42595322004-11-08 10:52:06 +000013151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013152}
13153
13154
13155static int
13156test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158
13159 int mem_base;
13160 int ret_val;
13161 int val; /* int 0 or 1 */
13162 int n_val;
13163
13164 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013166 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013167
13168 ret_val = xmlLineNumbersDefault(val);
13169 desret_int(ret_val);
13170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013171 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013172 xmlResetLastError();
13173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013174 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013177 printf(" %d", n_val);
13178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013179 }
13180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013182
Daniel Veillard42595322004-11-08 10:52:06 +000013183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013184}
13185
13186
13187static int
13188test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013190
Daniel Veillard42595322004-11-08 10:52:06 +000013191 int mem_base;
13192 xmlParserInputPtr ret_val;
13193 const char * URL; /* the URL for the entity to load */
13194 int n_URL;
13195 char * ID; /* the Public ID for the entity to load */
13196 int n_ID;
13197 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13198 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013199
Daniel Veillard42595322004-11-08 10:52:06 +000013200 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13201 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13202 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13203 mem_base = xmlMemBlocks();
13204 URL = gen_filepath(n_URL, 0);
13205 ID = gen_const_char_ptr(n_ID, 1);
13206 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13207
William M. Brackf13f77f2004-11-12 16:03:48 +000013208 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013209 desret_xmlParserInputPtr(ret_val);
13210 call_tests++;
13211 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013212 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013213 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13214 xmlResetLastError();
13215 if (mem_base != xmlMemBlocks()) {
13216 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13217 xmlMemBlocks() - mem_base);
13218 test_ret++;
13219 printf(" %d", n_URL);
13220 printf(" %d", n_ID);
13221 printf(" %d", n_ctxt);
13222 printf("\n");
13223 }
13224 }
13225 }
13226 }
Daniel Veillard42595322004-11-08 10:52:06 +000013227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013228
Daniel Veillard42595322004-11-08 10:52:06 +000013229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013230}
13231
13232
13233static int
13234test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013236
Daniel Veillard42595322004-11-08 10:52:06 +000013237 int mem_base;
13238 xmlParserInputPtr ret_val;
13239 xmlParserCtxtPtr ctxt; /* an XML parser context */
13240 int n_ctxt;
13241 xmlParserInputBufferPtr input; /* an I/O Input */
13242 int n_input;
13243 xmlCharEncoding enc; /* the charset encoding if known */
13244 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013245
Daniel Veillard42595322004-11-08 10:52:06 +000013246 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13247 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13248 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13249 mem_base = xmlMemBlocks();
13250 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13251 input = gen_xmlParserInputBufferPtr(n_input, 1);
13252 enc = gen_xmlCharEncoding(n_enc, 2);
13253
13254 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13255 if (ret_val != NULL) input = NULL;
13256 desret_xmlParserInputPtr(ret_val);
13257 call_tests++;
13258 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13259 des_xmlParserInputBufferPtr(n_input, input, 1);
13260 des_xmlCharEncoding(n_enc, enc, 2);
13261 xmlResetLastError();
13262 if (mem_base != xmlMemBlocks()) {
13263 printf("Leak of %d blocks found in xmlNewIOInputStream",
13264 xmlMemBlocks() - mem_base);
13265 test_ret++;
13266 printf(" %d", n_ctxt);
13267 printf(" %d", n_input);
13268 printf(" %d", n_enc);
13269 printf("\n");
13270 }
13271 }
13272 }
13273 }
Daniel Veillard42595322004-11-08 10:52:06 +000013274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013275
Daniel Veillard42595322004-11-08 10:52:06 +000013276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013277}
13278
13279
13280static int
13281test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013283
Daniel Veillard34099b42004-11-04 17:34:35 +000013284 int mem_base;
13285 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013286
Daniel Veillard34099b42004-11-04 17:34:35 +000013287 mem_base = xmlMemBlocks();
13288
13289 ret_val = xmlNewParserCtxt();
13290 desret_xmlParserCtxtPtr(ret_val);
13291 call_tests++;
13292 xmlResetLastError();
13293 if (mem_base != xmlMemBlocks()) {
13294 printf("Leak of %d blocks found in xmlNewParserCtxt",
13295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013296 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013297 printf("\n");
13298 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013300
Daniel Veillard42595322004-11-08 10:52:06 +000013301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013302}
13303
13304
Daniel Veillardce682bc2004-11-05 17:22:25 +000013305#define gen_nb_xmlNodePtr_ptr 1
13306static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13307 return(NULL);
13308}
13309static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13310}
13311
Daniel Veillardd93f6252004-11-02 15:53:51 +000013312static int
13313test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013315
William M. Brack21e4ef22005-01-02 09:53:13 +000013316#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013317#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013318 int mem_base;
13319 int ret_val;
13320 xmlDocPtr doc; /* the document the chunk pertains to */
13321 int n_doc;
13322 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13323 int n_sax;
13324 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13325 int n_user_data;
13326 int depth; /* Used for loop detection, use 0 */
13327 int n_depth;
13328 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13329 int n_string;
13330 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13331 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013332
Daniel Veillardce682bc2004-11-05 17:22:25 +000013333 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13334 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13335 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13336 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13337 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13338 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13339 mem_base = xmlMemBlocks();
13340 doc = gen_xmlDocPtr(n_doc, 0);
13341 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13342 user_data = gen_userdata(n_user_data, 2);
13343 depth = gen_int(n_depth, 3);
13344 string = gen_const_xmlChar_ptr(n_string, 4);
13345 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013346
13347#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013348 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013349#endif
13350
Daniel Veillardce682bc2004-11-05 17:22:25 +000013351
William M. Brackf13f77f2004-11-12 16:03:48 +000013352 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013353 desret_int(ret_val);
13354 call_tests++;
13355 des_xmlDocPtr(n_doc, doc, 0);
13356 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13357 des_userdata(n_user_data, user_data, 2);
13358 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013359 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013360 des_xmlNodePtr_ptr(n_lst, lst, 5);
13361 xmlResetLastError();
13362 if (mem_base != xmlMemBlocks()) {
13363 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013365 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013366 printf(" %d", n_doc);
13367 printf(" %d", n_sax);
13368 printf(" %d", n_user_data);
13369 printf(" %d", n_depth);
13370 printf(" %d", n_string);
13371 printf(" %d", n_lst);
13372 printf("\n");
13373 }
13374 }
13375 }
13376 }
13377 }
13378 }
13379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013380 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013381#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013382#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013383
Daniel Veillard42595322004-11-08 10:52:06 +000013384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013385}
13386
13387
13388static int
13389test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013391
William M. Brack21e4ef22005-01-02 09:53:13 +000013392#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013393#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013394 int mem_base;
13395 int ret_val;
13396 xmlDocPtr doc; /* the document the chunk pertains to */
13397 int n_doc;
13398 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13399 int n_sax;
13400 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13401 int n_user_data;
13402 int depth; /* Used for loop detection, use 0 */
13403 int n_depth;
13404 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13405 int n_string;
13406 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13407 int n_lst;
13408 int recover; /* return nodes even if the data is broken (use 0) */
13409 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013410
Daniel Veillardce682bc2004-11-05 17:22:25 +000013411 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13412 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13413 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13414 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13415 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13416 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13417 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13418 mem_base = xmlMemBlocks();
13419 doc = gen_xmlDocPtr(n_doc, 0);
13420 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13421 user_data = gen_userdata(n_user_data, 2);
13422 depth = gen_int(n_depth, 3);
13423 string = gen_const_xmlChar_ptr(n_string, 4);
13424 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13425 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013426
13427#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013428 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013429#endif
13430
Daniel Veillardce682bc2004-11-05 17:22:25 +000013431
William M. Brackf13f77f2004-11-12 16:03:48 +000013432 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013433 desret_int(ret_val);
13434 call_tests++;
13435 des_xmlDocPtr(n_doc, doc, 0);
13436 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13437 des_userdata(n_user_data, user_data, 2);
13438 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013439 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013440 des_xmlNodePtr_ptr(n_lst, lst, 5);
13441 des_int(n_recover, recover, 6);
13442 xmlResetLastError();
13443 if (mem_base != xmlMemBlocks()) {
13444 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013446 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013447 printf(" %d", n_doc);
13448 printf(" %d", n_sax);
13449 printf(" %d", n_user_data);
13450 printf(" %d", n_depth);
13451 printf(" %d", n_string);
13452 printf(" %d", n_lst);
13453 printf(" %d", n_recover);
13454 printf("\n");
13455 }
13456 }
13457 }
13458 }
13459 }
13460 }
13461 }
13462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013463 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013464#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013465#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013466
Daniel Veillard42595322004-11-08 10:52:06 +000013467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013468}
13469
13470
13471static int
13472test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013474
William M. Brack21e4ef22005-01-02 09:53:13 +000013475#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013476 int mem_base;
13477 int ret_val;
13478 xmlParserCtxtPtr ctxt; /* an XML parser context */
13479 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013480 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013481 int n_chunk;
13482 int size; /* the size in byte of the chunk */
13483 int n_size;
13484 int terminate; /* last chunk indicator */
13485 int n_terminate;
13486
13487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13488 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13489 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13490 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13491 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013492 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13493 chunk = gen_const_char_ptr(n_chunk, 1);
13494 size = gen_int(n_size, 2);
13495 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013496
William M. Brackf13f77f2004-11-12 16:03:48 +000013497 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013498 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013499 desret_int(ret_val);
13500 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013501 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013502 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013503 des_int(n_size, size, 2);
13504 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013505 xmlResetLastError();
13506 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013507 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013509 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013510 printf(" %d", n_ctxt);
13511 printf(" %d", n_chunk);
13512 printf(" %d", n_size);
13513 printf(" %d", n_terminate);
13514 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013515 }
13516 }
13517 }
13518 }
13519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013520 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013521#endif
13522
Daniel Veillard42595322004-11-08 10:52:06 +000013523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013524}
13525
13526
13527static int
13528test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013530
Daniel Veillardce682bc2004-11-05 17:22:25 +000013531 int mem_base;
13532 int ret_val;
13533 xmlParserCtxtPtr ctx; /* the existing parsing context */
13534 int n_ctx;
13535 xmlChar * URL; /* the URL for the entity to load */
13536 int n_URL;
13537 xmlChar * ID; /* the System ID for the entity to load */
13538 int n_ID;
13539 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13540 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013541
Daniel Veillardce682bc2004-11-05 17:22:25 +000013542 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13543 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13544 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13545 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13546 mem_base = xmlMemBlocks();
13547 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13548 URL = gen_const_xmlChar_ptr(n_URL, 1);
13549 ID = gen_const_xmlChar_ptr(n_ID, 2);
13550 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13551
William M. Brackf13f77f2004-11-12 16:03:48 +000013552 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013553 desret_int(ret_val);
13554 call_tests++;
13555 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013556 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13557 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013558 des_xmlNodePtr_ptr(n_lst, lst, 3);
13559 xmlResetLastError();
13560 if (mem_base != xmlMemBlocks()) {
13561 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013563 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013564 printf(" %d", n_ctx);
13565 printf(" %d", n_URL);
13566 printf(" %d", n_ID);
13567 printf(" %d", n_lst);
13568 printf("\n");
13569 }
13570 }
13571 }
13572 }
13573 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013574 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013575
Daniel Veillard42595322004-11-08 10:52:06 +000013576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013577}
13578
13579
13580static int
13581test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013583
William M. Brack21e4ef22005-01-02 09:53:13 +000013584#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013585#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013586 int mem_base;
13587 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013588 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013589 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013590 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013591 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013592
Daniel Veillard34099b42004-11-04 17:34:35 +000013593 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13594 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13595 mem_base = xmlMemBlocks();
13596 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13597 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13598
William M. Brackf13f77f2004-11-12 16:03:48 +000013599 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013600 desret_xmlDtdPtr(ret_val);
13601 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013602 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13603 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013604 xmlResetLastError();
13605 if (mem_base != xmlMemBlocks()) {
13606 printf("Leak of %d blocks found in xmlParseDTD",
13607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013608 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013609 printf(" %d", n_ExternalID);
13610 printf(" %d", n_SystemID);
13611 printf("\n");
13612 }
13613 }
13614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013615 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013616#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013617#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013618
Daniel Veillard42595322004-11-08 10:52:06 +000013619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013620}
13621
13622
13623static int
13624test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013626
William M. Brack21e4ef22005-01-02 09:53:13 +000013627#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013628#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013629 int mem_base;
13630 xmlDocPtr ret_val;
13631 xmlChar * cur; /* a pointer to an array of xmlChar */
13632 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013633
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013634 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013635 mem_base = xmlMemBlocks();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013636 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013637
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013638 ret_val = xmlParseDoc((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013639 desret_xmlDocPtr(ret_val);
13640 call_tests++;
Daniel Veillard5d4644e2005-04-01 13:11:58 +000013641 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013642 xmlResetLastError();
13643 if (mem_base != xmlMemBlocks()) {
13644 printf("Leak of %d blocks found in xmlParseDoc",
13645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013646 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013647 printf(" %d", n_cur);
13648 printf("\n");
13649 }
13650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013651 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013652#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013653#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013654
Daniel Veillard42595322004-11-08 10:52:06 +000013655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656}
13657
13658
13659static int
13660test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013662
13663 int mem_base;
13664 int ret_val;
13665 xmlParserCtxtPtr ctxt; /* an XML parser context */
13666 int n_ctxt;
13667
13668 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013670 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013671
13672 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013673 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013674 desret_int(ret_val);
13675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013676 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013677 xmlResetLastError();
13678 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013679 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013681 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013682 printf(" %d", n_ctxt);
13683 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013684 }
13685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013687
Daniel Veillard42595322004-11-08 10:52:06 +000013688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013689}
13690
13691
13692static int
13693test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013695
William M. Brack21e4ef22005-01-02 09:53:13 +000013696#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013697#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013698 int mem_base;
13699 xmlDocPtr ret_val;
13700 const char * filename; /* the filename */
13701 int n_filename;
13702
13703 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013705 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013706
13707 ret_val = xmlParseEntity(filename);
13708 desret_xmlDocPtr(ret_val);
13709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013710 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013711 xmlResetLastError();
13712 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013713 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013715 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013716 printf(" %d", n_filename);
13717 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013718 }
13719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013720 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013721#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013722#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013723
Daniel Veillard42595322004-11-08 10:52:06 +000013724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725}
13726
13727
13728static int
13729test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013731
13732 int mem_base;
13733 int ret_val;
13734 xmlParserCtxtPtr ctxt; /* an XML parser context */
13735 int n_ctxt;
13736
13737 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013739 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013740
13741 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013742 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013743 desret_int(ret_val);
13744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013745 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013746 xmlResetLastError();
13747 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013748 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013750 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013751 printf(" %d", n_ctxt);
13752 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013753 }
13754 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013756
Daniel Veillard42595322004-11-08 10:52:06 +000013757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013758}
13759
13760
13761static int
13762test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013764
William M. Brack21e4ef22005-01-02 09:53:13 +000013765#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013766#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013767 int mem_base;
13768 int ret_val;
13769 xmlDocPtr doc; /* the document the chunk pertains to */
13770 int n_doc;
13771 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13772 int n_sax;
13773 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13774 int n_user_data;
13775 int depth; /* Used for loop detection, use 0 */
13776 int n_depth;
13777 xmlChar * URL; /* the URL for the entity to load */
13778 int n_URL;
13779 xmlChar * ID; /* the System ID for the entity to load */
13780 int n_ID;
13781 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13782 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013783
Daniel Veillardce682bc2004-11-05 17:22:25 +000013784 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13785 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13786 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13787 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13788 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13789 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13790 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13791 mem_base = xmlMemBlocks();
13792 doc = gen_xmlDocPtr(n_doc, 0);
13793 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13794 user_data = gen_userdata(n_user_data, 2);
13795 depth = gen_int(n_depth, 3);
13796 URL = gen_const_xmlChar_ptr(n_URL, 4);
13797 ID = gen_const_xmlChar_ptr(n_ID, 5);
13798 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13799
William M. Brackf13f77f2004-11-12 16:03:48 +000013800 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013801 desret_int(ret_val);
13802 call_tests++;
13803 des_xmlDocPtr(n_doc, doc, 0);
13804 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13805 des_userdata(n_user_data, user_data, 2);
13806 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013807 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13808 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013809 des_xmlNodePtr_ptr(n_lst, lst, 6);
13810 xmlResetLastError();
13811 if (mem_base != xmlMemBlocks()) {
13812 printf("Leak of %d blocks found in xmlParseExternalEntity",
13813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013814 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013815 printf(" %d", n_doc);
13816 printf(" %d", n_sax);
13817 printf(" %d", n_user_data);
13818 printf(" %d", n_depth);
13819 printf(" %d", n_URL);
13820 printf(" %d", n_ID);
13821 printf(" %d", n_lst);
13822 printf("\n");
13823 }
13824 }
13825 }
13826 }
13827 }
13828 }
13829 }
13830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013831 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013832#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013833#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013834
Daniel Veillard42595322004-11-08 10:52:06 +000013835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013836}
13837
13838
13839static int
13840test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013842
William M. Brack21e4ef22005-01-02 09:53:13 +000013843#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013844#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013845 int mem_base;
13846 xmlDocPtr ret_val;
13847 const char * filename; /* the filename */
13848 int n_filename;
13849
13850 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013852 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013853
13854 ret_val = xmlParseFile(filename);
13855 desret_xmlDocPtr(ret_val);
13856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013857 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013858 xmlResetLastError();
13859 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013860 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013862 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013863 printf(" %d", n_filename);
13864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013865 }
13866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013867 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013868#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013869#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013870
Daniel Veillard42595322004-11-08 10:52:06 +000013871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013872}
13873
13874
13875static int
13876test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013878
Daniel Veillard57b25162004-11-06 14:50:18 +000013879 int mem_base;
13880 xmlParserErrors ret_val;
13881 xmlNodePtr node; /* the context node */
13882 int n_node;
13883 char * data; /* the input string */
13884 int n_data;
13885 int datalen; /* the input string length in bytes */
13886 int n_datalen;
13887 int options; /* a combination of xmlParserOption */
13888 int n_options;
13889 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13890 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013891
Daniel Veillard57b25162004-11-06 14:50:18 +000013892 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13893 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13894 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013895 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013896 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13897 mem_base = xmlMemBlocks();
13898 node = gen_xmlNodePtr(n_node, 0);
13899 data = gen_const_char_ptr(n_data, 1);
13900 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013901 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013902 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13903
William M. Brackf13f77f2004-11-12 16:03:48 +000013904 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013905 desret_xmlParserErrors(ret_val);
13906 call_tests++;
13907 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013908 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013909 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013910 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013911 des_xmlNodePtr_ptr(n_lst, lst, 4);
13912 xmlResetLastError();
13913 if (mem_base != xmlMemBlocks()) {
13914 printf("Leak of %d blocks found in xmlParseInNodeContext",
13915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013916 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013917 printf(" %d", n_node);
13918 printf(" %d", n_data);
13919 printf(" %d", n_datalen);
13920 printf(" %d", n_options);
13921 printf(" %d", n_lst);
13922 printf("\n");
13923 }
13924 }
13925 }
13926 }
13927 }
13928 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013930
Daniel Veillard42595322004-11-08 10:52:06 +000013931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013932}
13933
13934
13935static int
13936test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013938
William M. Brack21e4ef22005-01-02 09:53:13 +000013939#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013940#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941 int mem_base;
13942 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013943 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013944 int n_buffer;
13945 int size; /* the size of the array */
13946 int n_size;
13947
13948 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13949 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013951 buffer = gen_const_char_ptr(n_buffer, 0);
13952 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013953
William M. Brackf13f77f2004-11-12 16:03:48 +000013954 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013955 desret_xmlDocPtr(ret_val);
13956 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013957 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013958 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013959 xmlResetLastError();
13960 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013961 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013963 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013964 printf(" %d", n_buffer);
13965 printf(" %d", n_size);
13966 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013967 }
13968 }
13969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013970 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013971#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013972#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013973
Daniel Veillard42595322004-11-08 10:52:06 +000013974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013975}
13976
13977
Daniel Veillardce682bc2004-11-05 17:22:25 +000013978#define gen_nb_const_xmlParserNodeInfoPtr 1
13979static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13980 return(NULL);
13981}
13982static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13983}
13984
Daniel Veillardd93f6252004-11-02 15:53:51 +000013985static int
13986test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013988
Daniel Veillardce682bc2004-11-05 17:22:25 +000013989 int mem_base;
13990 xmlParserCtxtPtr ctxt; /* an XML parser context */
13991 int n_ctxt;
13992 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13993 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013994
Daniel Veillardce682bc2004-11-05 17:22:25 +000013995 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13996 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13997 mem_base = xmlMemBlocks();
13998 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13999 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14000
William M. Brackf13f77f2004-11-12 16:03:48 +000014001 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014002 call_tests++;
14003 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014004 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014005 xmlResetLastError();
14006 if (mem_base != xmlMemBlocks()) {
14007 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014009 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014010 printf(" %d", n_ctxt);
14011 printf(" %d", n_info);
14012 printf("\n");
14013 }
14014 }
14015 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014016 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014017
Daniel Veillard42595322004-11-08 10:52:06 +000014018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014019}
14020
14021
Daniel Veillardce682bc2004-11-05 17:22:25 +000014022#define gen_nb_const_xmlParserCtxtPtr 1
14023static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14024 return(NULL);
14025}
14026static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14027}
14028
Daniel Veillarda521d282004-11-09 14:59:59 +000014029#define gen_nb_const_xmlNodePtr 1
14030static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14031 return(NULL);
14032}
14033static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14034}
14035
Daniel Veillardd93f6252004-11-02 15:53:51 +000014036static int
14037test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039
William M. Brack094dd862004-11-14 14:28:34 +000014040 int mem_base;
14041 const xmlParserNodeInfo * ret_val;
14042 xmlParserCtxtPtr ctx; /* an XML parser context */
14043 int n_ctx;
14044 xmlNodePtr node; /* an XML node within the tree */
14045 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014046
William M. Brack094dd862004-11-14 14:28:34 +000014047 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14048 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14049 mem_base = xmlMemBlocks();
14050 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14051 node = gen_const_xmlNodePtr(n_node, 1);
14052
14053 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14054 desret_const_xmlParserNodeInfo_ptr(ret_val);
14055 call_tests++;
14056 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14057 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14058 xmlResetLastError();
14059 if (mem_base != xmlMemBlocks()) {
14060 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14061 xmlMemBlocks() - mem_base);
14062 test_ret++;
14063 printf(" %d", n_ctx);
14064 printf(" %d", n_node);
14065 printf("\n");
14066 }
14067 }
14068 }
14069 function_tests++;
14070
Daniel Veillard42595322004-11-08 10:52:06 +000014071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014072}
14073
14074
Daniel Veillardce682bc2004-11-05 17:22:25 +000014075#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14076static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14077 return(NULL);
14078}
14079static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14080}
14081
Daniel Veillardd93f6252004-11-02 15:53:51 +000014082static int
14083test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014085
William M. Brack094dd862004-11-14 14:28:34 +000014086 int mem_base;
14087 unsigned long ret_val;
14088 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14089 int n_seq;
14090 xmlNodePtr node; /* an XML node pointer */
14091 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014092
William M. Brack094dd862004-11-14 14:28:34 +000014093 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14094 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14095 mem_base = xmlMemBlocks();
14096 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14097 node = gen_const_xmlNodePtr(n_node, 1);
14098
14099 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14100 desret_unsigned_long(ret_val);
14101 call_tests++;
14102 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14103 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14104 xmlResetLastError();
14105 if (mem_base != xmlMemBlocks()) {
14106 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14107 xmlMemBlocks() - mem_base);
14108 test_ret++;
14109 printf(" %d", n_seq);
14110 printf(" %d", n_node);
14111 printf("\n");
14112 }
14113 }
14114 }
14115 function_tests++;
14116
Daniel Veillard42595322004-11-08 10:52:06 +000014117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014118}
14119
14120
Daniel Veillardce682bc2004-11-05 17:22:25 +000014121#define gen_nb_xmlParserInputPtr 1
14122static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14123 return(NULL);
14124}
14125static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14126}
14127
Daniel Veillardd93f6252004-11-02 15:53:51 +000014128static int
14129test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014131
Daniel Veillardce682bc2004-11-05 17:22:25 +000014132 int mem_base;
14133 int ret_val;
14134 xmlParserInputPtr in; /* an XML parser input */
14135 int n_in;
14136 int len; /* an indicative size for the lookahead */
14137 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014138
Daniel Veillardce682bc2004-11-05 17:22:25 +000014139 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14140 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14141 mem_base = xmlMemBlocks();
14142 in = gen_xmlParserInputPtr(n_in, 0);
14143 len = gen_int(n_len, 1);
14144
14145 ret_val = xmlParserInputGrow(in, len);
14146 desret_int(ret_val);
14147 call_tests++;
14148 des_xmlParserInputPtr(n_in, in, 0);
14149 des_int(n_len, len, 1);
14150 xmlResetLastError();
14151 if (mem_base != xmlMemBlocks()) {
14152 printf("Leak of %d blocks found in xmlParserInputGrow",
14153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014154 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014155 printf(" %d", n_in);
14156 printf(" %d", n_len);
14157 printf("\n");
14158 }
14159 }
14160 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014162
Daniel Veillard42595322004-11-08 10:52:06 +000014163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014164}
14165
14166
14167static int
14168test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014170
Daniel Veillardce682bc2004-11-05 17:22:25 +000014171 int mem_base;
14172 int ret_val;
14173 xmlParserInputPtr in; /* an XML parser input */
14174 int n_in;
14175 int len; /* an indicative size for the lookahead */
14176 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014177
Daniel Veillardce682bc2004-11-05 17:22:25 +000014178 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14179 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14180 mem_base = xmlMemBlocks();
14181 in = gen_xmlParserInputPtr(n_in, 0);
14182 len = gen_int(n_len, 1);
14183
14184 ret_val = xmlParserInputRead(in, len);
14185 desret_int(ret_val);
14186 call_tests++;
14187 des_xmlParserInputPtr(n_in, in, 0);
14188 des_int(n_len, len, 1);
14189 xmlResetLastError();
14190 if (mem_base != xmlMemBlocks()) {
14191 printf("Leak of %d blocks found in xmlParserInputRead",
14192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014193 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014194 printf(" %d", n_in);
14195 printf(" %d", n_len);
14196 printf("\n");
14197 }
14198 }
14199 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014201
Daniel Veillard42595322004-11-08 10:52:06 +000014202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014203}
14204
14205
14206static int
14207test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209
14210 int mem_base;
14211 int ret_val;
14212 int val; /* int 0 or 1 */
14213 int n_val;
14214
14215 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014217 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014218
14219 ret_val = xmlPedanticParserDefault(val);
14220 desret_int(ret_val);
14221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014222 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014223 xmlResetLastError();
14224 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014225 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014227 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014228 printf(" %d", n_val);
14229 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014230 }
14231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014233
Daniel Veillard42595322004-11-08 10:52:06 +000014234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014235}
14236
14237
14238static int
14239test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
14242 int mem_base;
14243 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014244 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014245 int n_cur;
14246 const char * URL; /* the base URL to use for the document */
14247 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014248 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249 int n_encoding;
14250 int options; /* a combination of xmlParserOption */
14251 int n_options;
14252
14253 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14254 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14255 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014256 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014258 cur = gen_const_xmlChar_ptr(n_cur, 0);
14259 URL = gen_filepath(n_URL, 1);
14260 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014261 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014262
William M. Brackf13f77f2004-11-12 16:03:48 +000014263 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014264 desret_xmlDocPtr(ret_val);
14265 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014266 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014267 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014268 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014269 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014270 xmlResetLastError();
14271 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014272 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014274 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014275 printf(" %d", n_cur);
14276 printf(" %d", n_URL);
14277 printf(" %d", n_encoding);
14278 printf(" %d", n_options);
14279 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014280 }
14281 }
14282 }
14283 }
14284 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014286
Daniel Veillard42595322004-11-08 10:52:06 +000014287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014288}
14289
14290
14291static int
14292test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014294
14295 int mem_base;
14296 xmlDocPtr ret_val;
14297 const char * filename; /* a file or URL */
14298 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014299 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014300 int n_encoding;
14301 int options; /* a combination of xmlParserOption */
14302 int n_options;
14303
14304 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14305 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014306 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014308 filename = gen_filepath(n_filename, 0);
14309 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014310 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014311
William M. Brackf13f77f2004-11-12 16:03:48 +000014312 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313 desret_xmlDocPtr(ret_val);
14314 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014315 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014316 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014317 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014318 xmlResetLastError();
14319 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014320 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014322 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014323 printf(" %d", n_filename);
14324 printf(" %d", n_encoding);
14325 printf(" %d", n_options);
14326 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014327 }
14328 }
14329 }
14330 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014332
Daniel Veillard42595322004-11-08 10:52:06 +000014333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334}
14335
14336
14337static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014340
14341 int mem_base;
14342 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014343 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344 int n_buffer;
14345 int size; /* the size of the array */
14346 int n_size;
14347 const char * URL; /* the base URL to use for the document */
14348 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014349 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014350 int n_encoding;
14351 int options; /* a combination of xmlParserOption */
14352 int n_options;
14353
14354 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14355 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14356 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14357 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014358 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014359 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014360 buffer = gen_const_char_ptr(n_buffer, 0);
14361 size = gen_int(n_size, 1);
14362 URL = gen_filepath(n_URL, 2);
14363 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014364 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014365
William M. Brackf13f77f2004-11-12 16:03:48 +000014366 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014367 desret_xmlDocPtr(ret_val);
14368 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014369 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014370 des_int(n_size, size, 1);
14371 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014372 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014373 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014374 xmlResetLastError();
14375 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014376 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014378 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014379 printf(" %d", n_buffer);
14380 printf(" %d", n_size);
14381 printf(" %d", n_URL);
14382 printf(" %d", n_encoding);
14383 printf(" %d", n_options);
14384 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014385 }
14386 }
14387 }
14388 }
14389 }
14390 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014392
Daniel Veillard42595322004-11-08 10:52:06 +000014393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014394}
14395
14396
14397static int
14398test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014400
William M. Brack21e4ef22005-01-02 09:53:13 +000014401#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014402#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014403 int mem_base;
14404 xmlDocPtr ret_val;
14405 xmlChar * cur; /* a pointer to an array of xmlChar */
14406 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014407
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014408 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014410 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014411
14412 ret_val = xmlRecoverDoc(cur);
14413 desret_xmlDocPtr(ret_val);
14414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014415 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014416 xmlResetLastError();
14417 if (mem_base != xmlMemBlocks()) {
14418 printf("Leak of %d blocks found in xmlRecoverDoc",
14419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014420 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014421 printf(" %d", n_cur);
14422 printf("\n");
14423 }
14424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014425 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014426#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014427#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014428
Daniel Veillard42595322004-11-08 10:52:06 +000014429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014430}
14431
14432
14433static int
14434test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014436
William M. Brack21e4ef22005-01-02 09:53:13 +000014437#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014438#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439 int mem_base;
14440 xmlDocPtr ret_val;
14441 const char * filename; /* the filename */
14442 int n_filename;
14443
14444 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014446 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014447
14448 ret_val = xmlRecoverFile(filename);
14449 desret_xmlDocPtr(ret_val);
14450 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014451 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014452 xmlResetLastError();
14453 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014454 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014456 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014457 printf(" %d", n_filename);
14458 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014459 }
14460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014461 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014462#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014463#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014464
Daniel Veillard42595322004-11-08 10:52:06 +000014465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466}
14467
14468
14469static int
14470test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472
William M. Brack21e4ef22005-01-02 09:53:13 +000014473#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014474#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475 int mem_base;
14476 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014477 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014478 int n_buffer;
14479 int size; /* the size of the array */
14480 int n_size;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014485 buffer = gen_const_char_ptr(n_buffer, 0);
14486 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014487
William M. Brackf13f77f2004-11-12 16:03:48 +000014488 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014489 desret_xmlDocPtr(ret_val);
14490 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014491 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014492 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014493 xmlResetLastError();
14494 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014495 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014497 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014498 printf(" %d", n_buffer);
14499 printf(" %d", n_size);
14500 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014501 }
14502 }
14503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014504 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014505#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014506#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014507
Daniel Veillard42595322004-11-08 10:52:06 +000014508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014509}
14510
14511
14512static int
14513test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014515
William M. Brack21e4ef22005-01-02 09:53:13 +000014516#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014517#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014518 int mem_base;
14519 xmlDtdPtr ret_val;
14520 xmlSAXHandlerPtr sax; /* the SAX handler block */
14521 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014522 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014523 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014524 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014525 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014526
Daniel Veillard34099b42004-11-04 17:34:35 +000014527 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14528 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14529 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14530 mem_base = xmlMemBlocks();
14531 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14532 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14533 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14534
William M. Brackf13f77f2004-11-12 16:03:48 +000014535 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014536 desret_xmlDtdPtr(ret_val);
14537 call_tests++;
14538 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014539 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14540 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014541 xmlResetLastError();
14542 if (mem_base != xmlMemBlocks()) {
14543 printf("Leak of %d blocks found in xmlSAXParseDTD",
14544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014545 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014546 printf(" %d", n_sax);
14547 printf(" %d", n_ExternalID);
14548 printf(" %d", n_SystemID);
14549 printf("\n");
14550 }
14551 }
14552 }
14553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014554 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014555#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014556#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014557
Daniel Veillard42595322004-11-08 10:52:06 +000014558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014559}
14560
14561
14562static int
14563test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014565
William M. Brack21e4ef22005-01-02 09:53:13 +000014566#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014567#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014568 int mem_base;
14569 xmlDocPtr ret_val;
14570 xmlSAXHandlerPtr sax; /* the SAX handler block */
14571 int n_sax;
14572 xmlChar * cur; /* a pointer to an array of xmlChar */
14573 int n_cur;
14574 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14575 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014576
Daniel Veillard34099b42004-11-04 17:34:35 +000014577 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014578 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000014579 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14580 mem_base = xmlMemBlocks();
14581 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014582 cur = gen_const_xmlChar_ptr(n_cur, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014583 recovery = gen_int(n_recovery, 2);
14584
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014585 ret_val = xmlSAXParseDoc(sax, (const xmlChar *)cur, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014586 desret_xmlDocPtr(ret_val);
14587 call_tests++;
14588 des_xmlSAXHandlerPtr(n_sax, sax, 0);
Daniel Veillard5d4644e2005-04-01 13:11:58 +000014589 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014590 des_int(n_recovery, recovery, 2);
14591 xmlResetLastError();
14592 if (mem_base != xmlMemBlocks()) {
14593 printf("Leak of %d blocks found in xmlSAXParseDoc",
14594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014595 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014596 printf(" %d", n_sax);
14597 printf(" %d", n_cur);
14598 printf(" %d", n_recovery);
14599 printf("\n");
14600 }
14601 }
14602 }
14603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014604 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014605#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014606#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014607
Daniel Veillard42595322004-11-08 10:52:06 +000014608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014609}
14610
14611
14612static int
14613test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014615
William M. Brack21e4ef22005-01-02 09:53:13 +000014616#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014617#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014618 int mem_base;
14619 xmlDocPtr ret_val;
14620 xmlSAXHandlerPtr sax; /* the SAX handler block */
14621 int n_sax;
14622 const char * filename; /* the filename */
14623 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014624
Daniel Veillard34099b42004-11-04 17:34:35 +000014625 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14626 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14627 mem_base = xmlMemBlocks();
14628 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14629 filename = gen_filepath(n_filename, 1);
14630
14631 ret_val = xmlSAXParseEntity(sax, filename);
14632 desret_xmlDocPtr(ret_val);
14633 call_tests++;
14634 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14635 des_filepath(n_filename, filename, 1);
14636 xmlResetLastError();
14637 if (mem_base != xmlMemBlocks()) {
14638 printf("Leak of %d blocks found in xmlSAXParseEntity",
14639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014640 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014641 printf(" %d", n_sax);
14642 printf(" %d", n_filename);
14643 printf("\n");
14644 }
14645 }
14646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014647 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014648#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014649#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014650
Daniel Veillard42595322004-11-08 10:52:06 +000014651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014652}
14653
14654
14655static int
14656test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014658
William M. Brack21e4ef22005-01-02 09:53:13 +000014659#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014660#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014661 int mem_base;
14662 xmlDocPtr ret_val;
14663 xmlSAXHandlerPtr sax; /* the SAX handler block */
14664 int n_sax;
14665 const char * filename; /* the filename */
14666 int n_filename;
14667 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14668 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014669
Daniel Veillard34099b42004-11-04 17:34:35 +000014670 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14671 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14672 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14673 mem_base = xmlMemBlocks();
14674 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14675 filename = gen_filepath(n_filename, 1);
14676 recovery = gen_int(n_recovery, 2);
14677
14678 ret_val = xmlSAXParseFile(sax, filename, recovery);
14679 desret_xmlDocPtr(ret_val);
14680 call_tests++;
14681 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14682 des_filepath(n_filename, filename, 1);
14683 des_int(n_recovery, recovery, 2);
14684 xmlResetLastError();
14685 if (mem_base != xmlMemBlocks()) {
14686 printf("Leak of %d blocks found in xmlSAXParseFile",
14687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014688 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014689 printf(" %d", n_sax);
14690 printf(" %d", n_filename);
14691 printf(" %d", n_recovery);
14692 printf("\n");
14693 }
14694 }
14695 }
14696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014697 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014698#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014699#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014700
Daniel Veillard42595322004-11-08 10:52:06 +000014701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014702}
14703
14704
14705static int
14706test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014708
William M. Brack21e4ef22005-01-02 09:53:13 +000014709#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014710#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014711 int mem_base;
14712 xmlDocPtr ret_val;
14713 xmlSAXHandlerPtr sax; /* the SAX handler block */
14714 int n_sax;
14715 const char * filename; /* the filename */
14716 int n_filename;
14717 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14718 int n_recovery;
14719 void * data; /* the userdata */
14720 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014721
Daniel Veillard34099b42004-11-04 17:34:35 +000014722 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14723 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14724 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14725 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14726 mem_base = xmlMemBlocks();
14727 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14728 filename = gen_filepath(n_filename, 1);
14729 recovery = gen_int(n_recovery, 2);
14730 data = gen_userdata(n_data, 3);
14731
14732 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14733 desret_xmlDocPtr(ret_val);
14734 call_tests++;
14735 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14736 des_filepath(n_filename, filename, 1);
14737 des_int(n_recovery, recovery, 2);
14738 des_userdata(n_data, data, 3);
14739 xmlResetLastError();
14740 if (mem_base != xmlMemBlocks()) {
14741 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014743 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014744 printf(" %d", n_sax);
14745 printf(" %d", n_filename);
14746 printf(" %d", n_recovery);
14747 printf(" %d", n_data);
14748 printf("\n");
14749 }
14750 }
14751 }
14752 }
14753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014754 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014755#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014756#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014757
Daniel Veillard42595322004-11-08 10:52:06 +000014758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014759}
14760
14761
14762static int
14763test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014765
William M. Brack21e4ef22005-01-02 09:53:13 +000014766#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014767#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014768 int mem_base;
14769 xmlDocPtr ret_val;
14770 xmlSAXHandlerPtr sax; /* the SAX handler block */
14771 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014772 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014773 int n_buffer;
14774 int size; /* the size of the array */
14775 int n_size;
14776 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14777 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014778
Daniel Veillard34099b42004-11-04 17:34:35 +000014779 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14780 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14781 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14782 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14783 mem_base = xmlMemBlocks();
14784 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14785 buffer = gen_const_char_ptr(n_buffer, 1);
14786 size = gen_int(n_size, 2);
14787 recovery = gen_int(n_recovery, 3);
14788
William M. Brackf13f77f2004-11-12 16:03:48 +000014789 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014790 desret_xmlDocPtr(ret_val);
14791 call_tests++;
14792 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014793 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014794 des_int(n_size, size, 2);
14795 des_int(n_recovery, recovery, 3);
14796 xmlResetLastError();
14797 if (mem_base != xmlMemBlocks()) {
14798 printf("Leak of %d blocks found in xmlSAXParseMemory",
14799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014800 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014801 printf(" %d", n_sax);
14802 printf(" %d", n_buffer);
14803 printf(" %d", n_size);
14804 printf(" %d", n_recovery);
14805 printf("\n");
14806 }
14807 }
14808 }
14809 }
14810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014811 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014812#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014813#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014814
Daniel Veillard42595322004-11-08 10:52:06 +000014815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014816}
14817
14818
14819static int
14820test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014822
William M. Brack21e4ef22005-01-02 09:53:13 +000014823#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014824#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014825 int mem_base;
14826 xmlDocPtr ret_val;
14827 xmlSAXHandlerPtr sax; /* the SAX handler block */
14828 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014829 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014830 int n_buffer;
14831 int size; /* the size of the array */
14832 int n_size;
14833 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14834 int n_recovery;
14835 void * data; /* the userdata */
14836 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014837
Daniel Veillard34099b42004-11-04 17:34:35 +000014838 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14839 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14840 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14841 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14842 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14843 mem_base = xmlMemBlocks();
14844 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14845 buffer = gen_const_char_ptr(n_buffer, 1);
14846 size = gen_int(n_size, 2);
14847 recovery = gen_int(n_recovery, 3);
14848 data = gen_userdata(n_data, 4);
14849
William M. Brackf13f77f2004-11-12 16:03:48 +000014850 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014851 desret_xmlDocPtr(ret_val);
14852 call_tests++;
14853 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014854 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014855 des_int(n_size, size, 2);
14856 des_int(n_recovery, recovery, 3);
14857 des_userdata(n_data, data, 4);
14858 xmlResetLastError();
14859 if (mem_base != xmlMemBlocks()) {
14860 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014862 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014863 printf(" %d", n_sax);
14864 printf(" %d", n_buffer);
14865 printf(" %d", n_size);
14866 printf(" %d", n_recovery);
14867 printf(" %d", n_data);
14868 printf("\n");
14869 }
14870 }
14871 }
14872 }
14873 }
14874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014875 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014876#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014877#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014878
Daniel Veillard42595322004-11-08 10:52:06 +000014879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014880}
14881
14882
14883static int
14884test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014886
William M. Brack21e4ef22005-01-02 09:53:13 +000014887#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014888#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014889 int mem_base;
14890 int ret_val;
14891 xmlSAXHandlerPtr sax; /* a SAX handler */
14892 int n_sax;
14893 void * user_data; /* The user data returned on SAX callbacks */
14894 int n_user_data;
14895 const char * filename; /* a file name */
14896 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014897
Daniel Veillard34099b42004-11-04 17:34:35 +000014898 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14899 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14900 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14901 mem_base = xmlMemBlocks();
14902 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14903 user_data = gen_userdata(n_user_data, 1);
14904 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014905
14906#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014907 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014908#endif
14909
Daniel Veillard34099b42004-11-04 17:34:35 +000014910
14911 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14912 desret_int(ret_val);
14913 call_tests++;
14914 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14915 des_userdata(n_user_data, user_data, 1);
14916 des_filepath(n_filename, filename, 2);
14917 xmlResetLastError();
14918 if (mem_base != xmlMemBlocks()) {
14919 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014921 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014922 printf(" %d", n_sax);
14923 printf(" %d", n_user_data);
14924 printf(" %d", n_filename);
14925 printf("\n");
14926 }
14927 }
14928 }
14929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014930 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014931#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014932#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014933
Daniel Veillard42595322004-11-08 10:52:06 +000014934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014935}
14936
14937
14938static int
14939test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014941
William M. Brack21e4ef22005-01-02 09:53:13 +000014942#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014943#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014944 int mem_base;
14945 int ret_val;
14946 xmlSAXHandlerPtr sax; /* a SAX handler */
14947 int n_sax;
14948 void * user_data; /* The user data returned on SAX callbacks */
14949 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014950 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014951 int n_buffer;
14952 int size; /* the length of the XML document in bytes */
14953 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014954
Daniel Veillard34099b42004-11-04 17:34:35 +000014955 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14956 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14957 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14958 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14959 mem_base = xmlMemBlocks();
14960 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14961 user_data = gen_userdata(n_user_data, 1);
14962 buffer = gen_const_char_ptr(n_buffer, 2);
14963 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014964
14965#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014966 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014967#endif
14968
Daniel Veillard34099b42004-11-04 17:34:35 +000014969
William M. Brackf13f77f2004-11-12 16:03:48 +000014970 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014971 desret_int(ret_val);
14972 call_tests++;
14973 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14974 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014975 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014976 des_int(n_size, size, 3);
14977 xmlResetLastError();
14978 if (mem_base != xmlMemBlocks()) {
14979 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014981 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014982 printf(" %d", n_sax);
14983 printf(" %d", n_user_data);
14984 printf(" %d", n_buffer);
14985 printf(" %d", n_size);
14986 printf("\n");
14987 }
14988 }
14989 }
14990 }
14991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014992 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014993#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014994#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014995
Daniel Veillard42595322004-11-08 10:52:06 +000014996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014997}
14998
14999
15000static int
15001test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015003
15004
15005 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015007}
15008
15009
15010static int
15011test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015013
William M. Brack21e4ef22005-01-02 09:53:13 +000015014#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015015#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015016 int mem_base;
15017 int ret_val;
15018 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15019 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015020 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015021 int n_name;
15022 void * value; /* pointer to the location of the new value */
15023 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015024
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015025 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15026 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15027 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15028 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015029 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15030 name = gen_const_char_ptr(n_name, 1);
15031 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015032
William M. Brackf13f77f2004-11-12 16:03:48 +000015033 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015034 desret_int(ret_val);
15035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015036 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015037 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015038 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015039 xmlResetLastError();
15040 if (mem_base != xmlMemBlocks()) {
15041 printf("Leak of %d blocks found in xmlSetFeature",
15042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015043 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015044 printf(" %d", n_ctxt);
15045 printf(" %d", n_name);
15046 printf(" %d", n_value);
15047 printf("\n");
15048 }
15049 }
15050 }
15051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015052 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015053#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015054#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015055
Daniel Veillard42595322004-11-08 10:52:06 +000015056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015057}
15058
15059
15060static int
15061test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015063
William M. Brack21e4ef22005-01-02 09:53:13 +000015064#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015065#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015066 int mem_base;
15067 xmlParserCtxtPtr ctxt; /* an XML parser context */
15068 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015069 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015070 int n_buffer;
15071 const char * filename; /* a file name */
15072 int n_filename;
15073
15074 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15075 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15076 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015078 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15079 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15080 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015081
William M. Brackf13f77f2004-11-12 16:03:48 +000015082 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015084 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015085 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015086 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015087 xmlResetLastError();
15088 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015089 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015091 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015092 printf(" %d", n_ctxt);
15093 printf(" %d", n_buffer);
15094 printf(" %d", n_filename);
15095 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015096 }
15097 }
15098 }
15099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015100 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015101#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015102#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015103
Daniel Veillard42595322004-11-08 10:52:06 +000015104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015105}
15106
15107
15108static int
15109test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015111
William M. Brack21e4ef22005-01-02 09:53:13 +000015112#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015113#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015114 int mem_base;
15115 xmlParserCtxtPtr ctxt; /* an XML parser context */
15116 int n_ctxt;
15117
15118 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15119 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015120 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015121
15122 xmlStopParser(ctxt);
15123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015124 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015125 xmlResetLastError();
15126 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015127 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015129 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015130 printf(" %d", n_ctxt);
15131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015132 }
15133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015134 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015135#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015136#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015137
Daniel Veillard42595322004-11-08 10:52:06 +000015138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015139}
15140
15141
15142static int
15143test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145
15146 int mem_base;
15147 int ret_val;
15148 int val; /* int 0 or 1 */
15149 int n_val;
15150
15151 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015153 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015154
15155 ret_val = xmlSubstituteEntitiesDefault(val);
15156 desret_int(ret_val);
15157 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015158 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015159 xmlResetLastError();
15160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015161 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015164 printf(" %d", n_val);
15165 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015166 }
15167 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015169
Daniel Veillard42595322004-11-08 10:52:06 +000015170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015171}
15172
15173static int
15174test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015176
William M. Brack094dd862004-11-14 14:28:34 +000015177 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015178 test_ret += test_xmlByteConsumed();
15179 test_ret += test_xmlClearNodeInfoSeq();
15180 test_ret += test_xmlClearParserCtxt();
15181 test_ret += test_xmlCreateDocParserCtxt();
15182 test_ret += test_xmlCreatePushParserCtxt();
15183 test_ret += test_xmlCtxtReadDoc();
15184 test_ret += test_xmlCtxtReadFile();
15185 test_ret += test_xmlCtxtReadMemory();
15186 test_ret += test_xmlCtxtReset();
15187 test_ret += test_xmlCtxtResetPush();
15188 test_ret += test_xmlCtxtUseOptions();
15189 test_ret += test_xmlGetExternalEntityLoader();
15190 test_ret += test_xmlGetFeature();
15191 test_ret += test_xmlGetFeaturesList();
15192 test_ret += test_xmlIOParseDTD();
15193 test_ret += test_xmlInitNodeInfoSeq();
15194 test_ret += test_xmlInitParser();
15195 test_ret += test_xmlInitParserCtxt();
15196 test_ret += test_xmlKeepBlanksDefault();
15197 test_ret += test_xmlLineNumbersDefault();
15198 test_ret += test_xmlLoadExternalEntity();
15199 test_ret += test_xmlNewIOInputStream();
15200 test_ret += test_xmlNewParserCtxt();
15201 test_ret += test_xmlParseBalancedChunkMemory();
15202 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15203 test_ret += test_xmlParseChunk();
15204 test_ret += test_xmlParseCtxtExternalEntity();
15205 test_ret += test_xmlParseDTD();
15206 test_ret += test_xmlParseDoc();
15207 test_ret += test_xmlParseDocument();
15208 test_ret += test_xmlParseEntity();
15209 test_ret += test_xmlParseExtParsedEnt();
15210 test_ret += test_xmlParseExternalEntity();
15211 test_ret += test_xmlParseFile();
15212 test_ret += test_xmlParseInNodeContext();
15213 test_ret += test_xmlParseMemory();
15214 test_ret += test_xmlParserAddNodeInfo();
15215 test_ret += test_xmlParserFindNodeInfo();
15216 test_ret += test_xmlParserFindNodeInfoIndex();
15217 test_ret += test_xmlParserInputGrow();
15218 test_ret += test_xmlParserInputRead();
15219 test_ret += test_xmlPedanticParserDefault();
15220 test_ret += test_xmlReadDoc();
15221 test_ret += test_xmlReadFile();
15222 test_ret += test_xmlReadMemory();
15223 test_ret += test_xmlRecoverDoc();
15224 test_ret += test_xmlRecoverFile();
15225 test_ret += test_xmlRecoverMemory();
15226 test_ret += test_xmlSAXParseDTD();
15227 test_ret += test_xmlSAXParseDoc();
15228 test_ret += test_xmlSAXParseEntity();
15229 test_ret += test_xmlSAXParseFile();
15230 test_ret += test_xmlSAXParseFileWithData();
15231 test_ret += test_xmlSAXParseMemory();
15232 test_ret += test_xmlSAXParseMemoryWithData();
15233 test_ret += test_xmlSAXUserParseFile();
15234 test_ret += test_xmlSAXUserParseMemory();
15235 test_ret += test_xmlSetExternalEntityLoader();
15236 test_ret += test_xmlSetFeature();
15237 test_ret += test_xmlSetupParserForBuffer();
15238 test_ret += test_xmlStopParser();
15239 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015240
Daniel Veillard42595322004-11-08 10:52:06 +000015241 if (test_ret != 0)
15242 printf("Module parser: %d errors\n", test_ret);
15243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015244}
15245
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015246static int
15247test_htmlCreateFileParserCtxt(void) {
15248 int test_ret = 0;
15249
William M. Brack21e4ef22005-01-02 09:53:13 +000015250#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015251 int mem_base;
15252 htmlParserCtxtPtr ret_val;
15253 const char * filename; /* the filename */
15254 int n_filename;
15255 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15256 int n_encoding;
15257
15258 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15259 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15260 mem_base = xmlMemBlocks();
15261 filename = gen_fileoutput(n_filename, 0);
15262 encoding = gen_const_char_ptr(n_encoding, 1);
15263
William M. Brackf13f77f2004-11-12 16:03:48 +000015264 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015265 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015266 call_tests++;
15267 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015268 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015269 xmlResetLastError();
15270 if (mem_base != xmlMemBlocks()) {
15271 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15272 xmlMemBlocks() - mem_base);
15273 test_ret++;
15274 printf(" %d", n_filename);
15275 printf(" %d", n_encoding);
15276 printf("\n");
15277 }
15278 }
15279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015280 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015281#endif
15282
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015283 return(test_ret);
15284}
15285
15286
15287static int
15288test_htmlInitAutoClose(void) {
15289 int test_ret = 0;
15290
William M. Brack21e4ef22005-01-02 09:53:13 +000015291#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015292 int mem_base;
15293
15294 mem_base = xmlMemBlocks();
15295
15296 htmlInitAutoClose();
15297 call_tests++;
15298 xmlResetLastError();
15299 if (mem_base != xmlMemBlocks()) {
15300 printf("Leak of %d blocks found in htmlInitAutoClose",
15301 xmlMemBlocks() - mem_base);
15302 test_ret++;
15303 printf("\n");
15304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015305 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015306#endif
15307
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015308 return(test_ret);
15309}
15310
15311
15312static int
15313test_inputPop(void) {
15314 int test_ret = 0;
15315
15316 int mem_base;
15317 xmlParserInputPtr ret_val;
15318 xmlParserCtxtPtr ctxt; /* an XML parser context */
15319 int n_ctxt;
15320
15321 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15322 mem_base = xmlMemBlocks();
15323 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15324
15325 ret_val = inputPop(ctxt);
15326 desret_xmlParserInputPtr(ret_val);
15327 call_tests++;
15328 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15329 xmlResetLastError();
15330 if (mem_base != xmlMemBlocks()) {
15331 printf("Leak of %d blocks found in inputPop",
15332 xmlMemBlocks() - mem_base);
15333 test_ret++;
15334 printf(" %d", n_ctxt);
15335 printf("\n");
15336 }
15337 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015339
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015340 return(test_ret);
15341}
15342
15343
15344static int
15345test_inputPush(void) {
15346 int test_ret = 0;
15347
15348 int mem_base;
15349 int ret_val;
15350 xmlParserCtxtPtr ctxt; /* an XML parser context */
15351 int n_ctxt;
15352 xmlParserInputPtr value; /* the parser input */
15353 int n_value;
15354
15355 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15356 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15357 mem_base = xmlMemBlocks();
15358 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15359 value = gen_xmlParserInputPtr(n_value, 1);
15360
15361 ret_val = inputPush(ctxt, value);
15362 desret_int(ret_val);
15363 call_tests++;
15364 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15365 des_xmlParserInputPtr(n_value, value, 1);
15366 xmlResetLastError();
15367 if (mem_base != xmlMemBlocks()) {
15368 printf("Leak of %d blocks found in inputPush",
15369 xmlMemBlocks() - mem_base);
15370 test_ret++;
15371 printf(" %d", n_ctxt);
15372 printf(" %d", n_value);
15373 printf("\n");
15374 }
15375 }
15376 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015377 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015378
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015379 return(test_ret);
15380}
15381
15382
15383static int
15384test_namePop(void) {
15385 int test_ret = 0;
15386
15387 int mem_base;
15388 const xmlChar * ret_val;
15389 xmlParserCtxtPtr ctxt; /* an XML parser context */
15390 int n_ctxt;
15391
15392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15393 mem_base = xmlMemBlocks();
15394 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15395
15396 ret_val = namePop(ctxt);
15397 desret_const_xmlChar_ptr(ret_val);
15398 call_tests++;
15399 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15400 xmlResetLastError();
15401 if (mem_base != xmlMemBlocks()) {
15402 printf("Leak of %d blocks found in namePop",
15403 xmlMemBlocks() - mem_base);
15404 test_ret++;
15405 printf(" %d", n_ctxt);
15406 printf("\n");
15407 }
15408 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015409 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015410
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015411 return(test_ret);
15412}
15413
15414
15415static int
15416test_namePush(void) {
15417 int test_ret = 0;
15418
15419 int mem_base;
15420 int ret_val;
15421 xmlParserCtxtPtr ctxt; /* an XML parser context */
15422 int n_ctxt;
15423 xmlChar * value; /* the element name */
15424 int n_value;
15425
15426 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15427 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15428 mem_base = xmlMemBlocks();
15429 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15430 value = gen_const_xmlChar_ptr(n_value, 1);
15431
William M. Brackf13f77f2004-11-12 16:03:48 +000015432 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015433 desret_int(ret_val);
15434 call_tests++;
15435 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015436 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015437 xmlResetLastError();
15438 if (mem_base != xmlMemBlocks()) {
15439 printf("Leak of %d blocks found in namePush",
15440 xmlMemBlocks() - mem_base);
15441 test_ret++;
15442 printf(" %d", n_ctxt);
15443 printf(" %d", n_value);
15444 printf("\n");
15445 }
15446 }
15447 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015449
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015450 return(test_ret);
15451}
15452
15453
15454static int
15455test_nodePop(void) {
15456 int test_ret = 0;
15457
15458 int mem_base;
15459 xmlNodePtr ret_val;
15460 xmlParserCtxtPtr ctxt; /* an XML parser context */
15461 int n_ctxt;
15462
15463 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15464 mem_base = xmlMemBlocks();
15465 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15466
15467 ret_val = nodePop(ctxt);
15468 desret_xmlNodePtr(ret_val);
15469 call_tests++;
15470 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15471 xmlResetLastError();
15472 if (mem_base != xmlMemBlocks()) {
15473 printf("Leak of %d blocks found in nodePop",
15474 xmlMemBlocks() - mem_base);
15475 test_ret++;
15476 printf(" %d", n_ctxt);
15477 printf("\n");
15478 }
15479 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015481
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015482 return(test_ret);
15483}
15484
15485
15486static int
15487test_nodePush(void) {
15488 int test_ret = 0;
15489
15490 int mem_base;
15491 int ret_val;
15492 xmlParserCtxtPtr ctxt; /* an XML parser context */
15493 int n_ctxt;
15494 xmlNodePtr value; /* the element node */
15495 int n_value;
15496
15497 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15498 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15499 mem_base = xmlMemBlocks();
15500 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15501 value = gen_xmlNodePtr(n_value, 1);
15502
15503 ret_val = nodePush(ctxt, value);
15504 desret_int(ret_val);
15505 call_tests++;
15506 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15507 des_xmlNodePtr(n_value, value, 1);
15508 xmlResetLastError();
15509 if (mem_base != xmlMemBlocks()) {
15510 printf("Leak of %d blocks found in nodePush",
15511 xmlMemBlocks() - mem_base);
15512 test_ret++;
15513 printf(" %d", n_ctxt);
15514 printf(" %d", n_value);
15515 printf("\n");
15516 }
15517 }
15518 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015520
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015521 return(test_ret);
15522}
15523
15524
15525static int
15526test_xmlCheckLanguageID(void) {
15527 int test_ret = 0;
15528
15529 int mem_base;
15530 int ret_val;
15531 xmlChar * lang; /* pointer to the string value */
15532 int n_lang;
15533
15534 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15535 mem_base = xmlMemBlocks();
15536 lang = gen_const_xmlChar_ptr(n_lang, 0);
15537
William M. Brackf13f77f2004-11-12 16:03:48 +000015538 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015539 desret_int(ret_val);
15540 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015541 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015542 xmlResetLastError();
15543 if (mem_base != xmlMemBlocks()) {
15544 printf("Leak of %d blocks found in xmlCheckLanguageID",
15545 xmlMemBlocks() - mem_base);
15546 test_ret++;
15547 printf(" %d", n_lang);
15548 printf("\n");
15549 }
15550 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015551 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015552
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015553 return(test_ret);
15554}
15555
15556
15557static int
15558test_xmlCopyChar(void) {
15559 int test_ret = 0;
15560
15561 int mem_base;
15562 int ret_val;
15563 int len; /* Ignored, compatibility */
15564 int n_len;
15565 xmlChar * out; /* pointer to an array of xmlChar */
15566 int n_out;
15567 int val; /* the char value */
15568 int n_val;
15569
15570 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15571 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15572 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15573 mem_base = xmlMemBlocks();
15574 len = gen_int(n_len, 0);
15575 out = gen_xmlChar_ptr(n_out, 1);
15576 val = gen_int(n_val, 2);
15577
15578 ret_val = xmlCopyChar(len, out, val);
15579 desret_int(ret_val);
15580 call_tests++;
15581 des_int(n_len, len, 0);
15582 des_xmlChar_ptr(n_out, out, 1);
15583 des_int(n_val, val, 2);
15584 xmlResetLastError();
15585 if (mem_base != xmlMemBlocks()) {
15586 printf("Leak of %d blocks found in xmlCopyChar",
15587 xmlMemBlocks() - mem_base);
15588 test_ret++;
15589 printf(" %d", n_len);
15590 printf(" %d", n_out);
15591 printf(" %d", n_val);
15592 printf("\n");
15593 }
15594 }
15595 }
15596 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015597 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015598
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015599 return(test_ret);
15600}
15601
15602
15603static int
15604test_xmlCopyCharMultiByte(void) {
15605 int test_ret = 0;
15606
15607 int mem_base;
15608 int ret_val;
15609 xmlChar * out; /* pointer to an array of xmlChar */
15610 int n_out;
15611 int val; /* the char value */
15612 int n_val;
15613
15614 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15615 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15616 mem_base = xmlMemBlocks();
15617 out = gen_xmlChar_ptr(n_out, 0);
15618 val = gen_int(n_val, 1);
15619
15620 ret_val = xmlCopyCharMultiByte(out, val);
15621 desret_int(ret_val);
15622 call_tests++;
15623 des_xmlChar_ptr(n_out, out, 0);
15624 des_int(n_val, val, 1);
15625 xmlResetLastError();
15626 if (mem_base != xmlMemBlocks()) {
15627 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15628 xmlMemBlocks() - mem_base);
15629 test_ret++;
15630 printf(" %d", n_out);
15631 printf(" %d", n_val);
15632 printf("\n");
15633 }
15634 }
15635 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015637
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015638 return(test_ret);
15639}
15640
15641
15642static int
15643test_xmlCreateEntityParserCtxt(void) {
15644 int test_ret = 0;
15645
15646 int mem_base;
15647 xmlParserCtxtPtr ret_val;
15648 xmlChar * URL; /* the entity URL */
15649 int n_URL;
15650 xmlChar * ID; /* the entity PUBLIC ID */
15651 int n_ID;
15652 xmlChar * base; /* a possible base for the target URI */
15653 int n_base;
15654
15655 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15656 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15657 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15658 mem_base = xmlMemBlocks();
15659 URL = gen_const_xmlChar_ptr(n_URL, 0);
15660 ID = gen_const_xmlChar_ptr(n_ID, 1);
15661 base = gen_const_xmlChar_ptr(n_base, 2);
15662
William M. Brackf13f77f2004-11-12 16:03:48 +000015663 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015664 desret_xmlParserCtxtPtr(ret_val);
15665 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015666 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15667 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15668 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015669 xmlResetLastError();
15670 if (mem_base != xmlMemBlocks()) {
15671 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15672 xmlMemBlocks() - mem_base);
15673 test_ret++;
15674 printf(" %d", n_URL);
15675 printf(" %d", n_ID);
15676 printf(" %d", n_base);
15677 printf("\n");
15678 }
15679 }
15680 }
15681 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015683
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015684 return(test_ret);
15685}
15686
15687
15688static int
15689test_xmlCreateFileParserCtxt(void) {
15690 int test_ret = 0;
15691
15692 int mem_base;
15693 xmlParserCtxtPtr ret_val;
15694 const char * filename; /* the filename */
15695 int n_filename;
15696
15697 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15698 mem_base = xmlMemBlocks();
15699 filename = gen_fileoutput(n_filename, 0);
15700
15701 ret_val = xmlCreateFileParserCtxt(filename);
15702 desret_xmlParserCtxtPtr(ret_val);
15703 call_tests++;
15704 des_fileoutput(n_filename, filename, 0);
15705 xmlResetLastError();
15706 if (mem_base != xmlMemBlocks()) {
15707 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15708 xmlMemBlocks() - mem_base);
15709 test_ret++;
15710 printf(" %d", n_filename);
15711 printf("\n");
15712 }
15713 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015714 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015715
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015716 return(test_ret);
15717}
15718
15719
15720static int
15721test_xmlCreateMemoryParserCtxt(void) {
15722 int test_ret = 0;
15723
15724 int mem_base;
15725 xmlParserCtxtPtr ret_val;
15726 char * buffer; /* a pointer to a char array */
15727 int n_buffer;
15728 int size; /* the size of the array */
15729 int n_size;
15730
15731 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15732 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15733 mem_base = xmlMemBlocks();
15734 buffer = gen_const_char_ptr(n_buffer, 0);
15735 size = gen_int(n_size, 1);
15736
William M. Brackf13f77f2004-11-12 16:03:48 +000015737 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015738 desret_xmlParserCtxtPtr(ret_val);
15739 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015740 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015741 des_int(n_size, size, 1);
15742 xmlResetLastError();
15743 if (mem_base != xmlMemBlocks()) {
15744 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15745 xmlMemBlocks() - mem_base);
15746 test_ret++;
15747 printf(" %d", n_buffer);
15748 printf(" %d", n_size);
15749 printf("\n");
15750 }
15751 }
15752 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015754
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015755 return(test_ret);
15756}
15757
15758
15759static int
15760test_xmlCreateURLParserCtxt(void) {
15761 int test_ret = 0;
15762
15763 int mem_base;
15764 xmlParserCtxtPtr ret_val;
15765 const char * filename; /* the filename or URL */
15766 int n_filename;
15767 int options; /* a combination of xmlParserOption */
15768 int n_options;
15769
15770 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15771 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15772 mem_base = xmlMemBlocks();
15773 filename = gen_fileoutput(n_filename, 0);
15774 options = gen_int(n_options, 1);
15775
15776 ret_val = xmlCreateURLParserCtxt(filename, options);
15777 desret_xmlParserCtxtPtr(ret_val);
15778 call_tests++;
15779 des_fileoutput(n_filename, filename, 0);
15780 des_int(n_options, options, 1);
15781 xmlResetLastError();
15782 if (mem_base != xmlMemBlocks()) {
15783 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15784 xmlMemBlocks() - mem_base);
15785 test_ret++;
15786 printf(" %d", n_filename);
15787 printf(" %d", n_options);
15788 printf("\n");
15789 }
15790 }
15791 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015793
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015794 return(test_ret);
15795}
15796
15797
15798static int
15799test_xmlCurrentChar(void) {
15800 int test_ret = 0;
15801
15802 int mem_base;
15803 int ret_val;
15804 xmlParserCtxtPtr ctxt; /* the XML parser context */
15805 int n_ctxt;
15806 int * len; /* pointer to the length of the char read */
15807 int n_len;
15808
15809 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15810 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15811 mem_base = xmlMemBlocks();
15812 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15813 len = gen_int_ptr(n_len, 1);
15814
15815 ret_val = xmlCurrentChar(ctxt, len);
15816 desret_int(ret_val);
15817 call_tests++;
15818 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15819 des_int_ptr(n_len, len, 1);
15820 xmlResetLastError();
15821 if (mem_base != xmlMemBlocks()) {
15822 printf("Leak of %d blocks found in xmlCurrentChar",
15823 xmlMemBlocks() - mem_base);
15824 test_ret++;
15825 printf(" %d", n_ctxt);
15826 printf(" %d", n_len);
15827 printf("\n");
15828 }
15829 }
15830 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015832
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015833 return(test_ret);
15834}
15835
15836
15837static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015838test_xmlErrMemory(void) {
15839 int test_ret = 0;
15840
15841 int mem_base;
15842 xmlParserCtxtPtr ctxt; /* an XML parser context */
15843 int n_ctxt;
15844 char * extra; /* extra informations */
15845 int n_extra;
15846
15847 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15848 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15849 mem_base = xmlMemBlocks();
15850 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15851 extra = gen_const_char_ptr(n_extra, 1);
15852
William M. Brackf13f77f2004-11-12 16:03:48 +000015853 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015854 call_tests++;
15855 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015856 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015857 xmlResetLastError();
15858 if (mem_base != xmlMemBlocks()) {
15859 printf("Leak of %d blocks found in xmlErrMemory",
15860 xmlMemBlocks() - mem_base);
15861 test_ret++;
15862 printf(" %d", n_ctxt);
15863 printf(" %d", n_extra);
15864 printf("\n");
15865 }
15866 }
15867 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015868 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015869
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015870 return(test_ret);
15871}
15872
15873
15874static int
15875test_xmlIsLetter(void) {
15876 int test_ret = 0;
15877
15878 int mem_base;
15879 int ret_val;
15880 int c; /* an unicode character (int) */
15881 int n_c;
15882
15883 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15884 mem_base = xmlMemBlocks();
15885 c = gen_int(n_c, 0);
15886
15887 ret_val = xmlIsLetter(c);
15888 desret_int(ret_val);
15889 call_tests++;
15890 des_int(n_c, c, 0);
15891 xmlResetLastError();
15892 if (mem_base != xmlMemBlocks()) {
15893 printf("Leak of %d blocks found in xmlIsLetter",
15894 xmlMemBlocks() - mem_base);
15895 test_ret++;
15896 printf(" %d", n_c);
15897 printf("\n");
15898 }
15899 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015900 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015901
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015902 return(test_ret);
15903}
15904
15905
15906static int
15907test_xmlNewEntityInputStream(void) {
15908 int test_ret = 0;
15909
15910 int mem_base;
15911 xmlParserInputPtr ret_val;
15912 xmlParserCtxtPtr ctxt; /* an XML parser context */
15913 int n_ctxt;
15914 xmlEntityPtr entity; /* an Entity pointer */
15915 int n_entity;
15916
15917 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15918 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15919 mem_base = xmlMemBlocks();
15920 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15921 entity = gen_xmlEntityPtr(n_entity, 1);
15922
15923 ret_val = xmlNewEntityInputStream(ctxt, entity);
15924 desret_xmlParserInputPtr(ret_val);
15925 call_tests++;
15926 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15927 des_xmlEntityPtr(n_entity, entity, 1);
15928 xmlResetLastError();
15929 if (mem_base != xmlMemBlocks()) {
15930 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15931 xmlMemBlocks() - mem_base);
15932 test_ret++;
15933 printf(" %d", n_ctxt);
15934 printf(" %d", n_entity);
15935 printf("\n");
15936 }
15937 }
15938 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015939 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015940
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015941 return(test_ret);
15942}
15943
15944
15945static int
15946test_xmlNewInputFromFile(void) {
15947 int test_ret = 0;
15948
15949 int mem_base;
15950 xmlParserInputPtr ret_val;
15951 xmlParserCtxtPtr ctxt; /* an XML parser context */
15952 int n_ctxt;
15953 const char * filename; /* the filename to use as entity */
15954 int n_filename;
15955
15956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15957 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15958 mem_base = xmlMemBlocks();
15959 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15960 filename = gen_filepath(n_filename, 1);
15961
15962 ret_val = xmlNewInputFromFile(ctxt, filename);
15963 desret_xmlParserInputPtr(ret_val);
15964 call_tests++;
15965 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15966 des_filepath(n_filename, filename, 1);
15967 xmlResetLastError();
15968 if (mem_base != xmlMemBlocks()) {
15969 printf("Leak of %d blocks found in xmlNewInputFromFile",
15970 xmlMemBlocks() - mem_base);
15971 test_ret++;
15972 printf(" %d", n_ctxt);
15973 printf(" %d", n_filename);
15974 printf("\n");
15975 }
15976 }
15977 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015978 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015979
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015980 return(test_ret);
15981}
15982
15983
15984static int
15985test_xmlNewInputStream(void) {
15986 int test_ret = 0;
15987
15988 int mem_base;
15989 xmlParserInputPtr ret_val;
15990 xmlParserCtxtPtr ctxt; /* an XML parser context */
15991 int n_ctxt;
15992
15993 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15994 mem_base = xmlMemBlocks();
15995 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15996
15997 ret_val = xmlNewInputStream(ctxt);
15998 desret_xmlParserInputPtr(ret_val);
15999 call_tests++;
16000 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16001 xmlResetLastError();
16002 if (mem_base != xmlMemBlocks()) {
16003 printf("Leak of %d blocks found in xmlNewInputStream",
16004 xmlMemBlocks() - mem_base);
16005 test_ret++;
16006 printf(" %d", n_ctxt);
16007 printf("\n");
16008 }
16009 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016011
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016012 return(test_ret);
16013}
16014
16015
16016static int
16017test_xmlNewStringInputStream(void) {
16018 int test_ret = 0;
16019
16020 int mem_base;
16021 xmlParserInputPtr ret_val;
16022 xmlParserCtxtPtr ctxt; /* an XML parser context */
16023 int n_ctxt;
16024 xmlChar * buffer; /* an memory buffer */
16025 int n_buffer;
16026
16027 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16028 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16029 mem_base = xmlMemBlocks();
16030 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16031 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16032
William M. Brackf13f77f2004-11-12 16:03:48 +000016033 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016034 desret_xmlParserInputPtr(ret_val);
16035 call_tests++;
16036 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016037 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016038 xmlResetLastError();
16039 if (mem_base != xmlMemBlocks()) {
16040 printf("Leak of %d blocks found in xmlNewStringInputStream",
16041 xmlMemBlocks() - mem_base);
16042 test_ret++;
16043 printf(" %d", n_ctxt);
16044 printf(" %d", n_buffer);
16045 printf("\n");
16046 }
16047 }
16048 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016049 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016050
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016051 return(test_ret);
16052}
16053
16054
16055static int
16056test_xmlNextChar(void) {
16057 int test_ret = 0;
16058
16059 int mem_base;
16060 xmlParserCtxtPtr ctxt; /* the XML parser context */
16061 int n_ctxt;
16062
16063 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16064 mem_base = xmlMemBlocks();
16065 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16066
16067 xmlNextChar(ctxt);
16068 call_tests++;
16069 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16070 xmlResetLastError();
16071 if (mem_base != xmlMemBlocks()) {
16072 printf("Leak of %d blocks found in xmlNextChar",
16073 xmlMemBlocks() - mem_base);
16074 test_ret++;
16075 printf(" %d", n_ctxt);
16076 printf("\n");
16077 }
16078 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016079 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016080
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016081 return(test_ret);
16082}
16083
16084
16085static int
16086test_xmlParserInputShrink(void) {
16087 int test_ret = 0;
16088
16089 int mem_base;
16090 xmlParserInputPtr in; /* an XML parser input */
16091 int n_in;
16092
16093 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16094 mem_base = xmlMemBlocks();
16095 in = gen_xmlParserInputPtr(n_in, 0);
16096
16097 xmlParserInputShrink(in);
16098 call_tests++;
16099 des_xmlParserInputPtr(n_in, in, 0);
16100 xmlResetLastError();
16101 if (mem_base != xmlMemBlocks()) {
16102 printf("Leak of %d blocks found in xmlParserInputShrink",
16103 xmlMemBlocks() - mem_base);
16104 test_ret++;
16105 printf(" %d", n_in);
16106 printf("\n");
16107 }
16108 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016110
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016111 return(test_ret);
16112}
16113
16114
16115static int
16116test_xmlPopInput(void) {
16117 int test_ret = 0;
16118
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016119 int mem_base;
16120 xmlChar ret_val;
16121 xmlParserCtxtPtr ctxt; /* an XML parser context */
16122 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016123
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16125 mem_base = xmlMemBlocks();
16126 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16127
16128 ret_val = xmlPopInput(ctxt);
16129 desret_xmlChar(ret_val);
16130 call_tests++;
16131 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16132 xmlResetLastError();
16133 if (mem_base != xmlMemBlocks()) {
16134 printf("Leak of %d blocks found in xmlPopInput",
16135 xmlMemBlocks() - mem_base);
16136 test_ret++;
16137 printf(" %d", n_ctxt);
16138 printf("\n");
16139 }
16140 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016141 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016142
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016143 return(test_ret);
16144}
16145
16146
16147static int
16148test_xmlPushInput(void) {
16149 int test_ret = 0;
16150
16151 int mem_base;
16152 xmlParserCtxtPtr ctxt; /* an XML parser context */
16153 int n_ctxt;
16154 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16155 int n_input;
16156
16157 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16158 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16159 mem_base = xmlMemBlocks();
16160 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16161 input = gen_xmlParserInputPtr(n_input, 1);
16162
16163 xmlPushInput(ctxt, input);
16164 call_tests++;
16165 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16166 des_xmlParserInputPtr(n_input, input, 1);
16167 xmlResetLastError();
16168 if (mem_base != xmlMemBlocks()) {
16169 printf("Leak of %d blocks found in xmlPushInput",
16170 xmlMemBlocks() - mem_base);
16171 test_ret++;
16172 printf(" %d", n_ctxt);
16173 printf(" %d", n_input);
16174 printf("\n");
16175 }
16176 }
16177 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016179
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016180 return(test_ret);
16181}
16182
16183
16184static int
16185test_xmlSetEntityReferenceFunc(void) {
16186 int test_ret = 0;
16187
16188
16189 /* missing type support */
16190 return(test_ret);
16191}
16192
16193
16194static int
16195test_xmlSplitQName(void) {
16196 int test_ret = 0;
16197
16198 int mem_base;
16199 xmlChar * ret_val;
16200 xmlParserCtxtPtr ctxt; /* an XML parser context */
16201 int n_ctxt;
16202 xmlChar * name; /* an XML parser context */
16203 int n_name;
16204 xmlChar ** prefix; /* a xmlChar ** */
16205 int n_prefix;
16206
16207 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16208 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16209 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16210 mem_base = xmlMemBlocks();
16211 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16212 name = gen_const_xmlChar_ptr(n_name, 1);
16213 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16214
William M. Brackf13f77f2004-11-12 16:03:48 +000016215 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016216 desret_xmlChar_ptr(ret_val);
16217 call_tests++;
16218 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016219 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016220 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16221 xmlResetLastError();
16222 if (mem_base != xmlMemBlocks()) {
16223 printf("Leak of %d blocks found in xmlSplitQName",
16224 xmlMemBlocks() - mem_base);
16225 test_ret++;
16226 printf(" %d", n_ctxt);
16227 printf(" %d", n_name);
16228 printf(" %d", n_prefix);
16229 printf("\n");
16230 }
16231 }
16232 }
16233 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016234 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016235
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016236 return(test_ret);
16237}
16238
16239
16240static int
16241test_xmlStringCurrentChar(void) {
16242 int test_ret = 0;
16243
16244 int mem_base;
16245 int ret_val;
16246 xmlParserCtxtPtr ctxt; /* the XML parser context */
16247 int n_ctxt;
16248 xmlChar * cur; /* pointer to the beginning of the char */
16249 int n_cur;
16250 int * len; /* pointer to the length of the char read */
16251 int n_len;
16252
16253 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16254 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16255 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16256 mem_base = xmlMemBlocks();
16257 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16258 cur = gen_const_xmlChar_ptr(n_cur, 1);
16259 len = gen_int_ptr(n_len, 2);
16260
William M. Brackf13f77f2004-11-12 16:03:48 +000016261 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016262 desret_int(ret_val);
16263 call_tests++;
16264 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016265 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016266 des_int_ptr(n_len, len, 2);
16267 xmlResetLastError();
16268 if (mem_base != xmlMemBlocks()) {
16269 printf("Leak of %d blocks found in xmlStringCurrentChar",
16270 xmlMemBlocks() - mem_base);
16271 test_ret++;
16272 printf(" %d", n_ctxt);
16273 printf(" %d", n_cur);
16274 printf(" %d", n_len);
16275 printf("\n");
16276 }
16277 }
16278 }
16279 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016280 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016281
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016282 return(test_ret);
16283}
16284
16285
16286static int
16287test_xmlStringDecodeEntities(void) {
16288 int test_ret = 0;
16289
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016290 int mem_base;
16291 xmlChar * ret_val;
16292 xmlParserCtxtPtr ctxt; /* the parser context */
16293 int n_ctxt;
16294 xmlChar * str; /* the input string */
16295 int n_str;
16296 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16297 int n_what;
16298 xmlChar end; /* an end marker xmlChar, 0 if none */
16299 int n_end;
16300 xmlChar end2; /* an end marker xmlChar, 0 if none */
16301 int n_end2;
16302 xmlChar end3; /* an end marker xmlChar, 0 if none */
16303 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016304
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016305 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16306 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16307 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16308 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16309 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16310 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16311 mem_base = xmlMemBlocks();
16312 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16313 str = gen_const_xmlChar_ptr(n_str, 1);
16314 what = gen_int(n_what, 2);
16315 end = gen_xmlChar(n_end, 3);
16316 end2 = gen_xmlChar(n_end2, 4);
16317 end3 = gen_xmlChar(n_end3, 5);
16318
William M. Brackf13f77f2004-11-12 16:03:48 +000016319 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016320 desret_xmlChar_ptr(ret_val);
16321 call_tests++;
16322 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016323 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016324 des_int(n_what, what, 2);
16325 des_xmlChar(n_end, end, 3);
16326 des_xmlChar(n_end2, end2, 4);
16327 des_xmlChar(n_end3, end3, 5);
16328 xmlResetLastError();
16329 if (mem_base != xmlMemBlocks()) {
16330 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16331 xmlMemBlocks() - mem_base);
16332 test_ret++;
16333 printf(" %d", n_ctxt);
16334 printf(" %d", n_str);
16335 printf(" %d", n_what);
16336 printf(" %d", n_end);
16337 printf(" %d", n_end2);
16338 printf(" %d", n_end3);
16339 printf("\n");
16340 }
16341 }
16342 }
16343 }
16344 }
16345 }
16346 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016347 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016348
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016349 return(test_ret);
16350}
16351
16352
16353static int
16354test_xmlStringLenDecodeEntities(void) {
16355 int test_ret = 0;
16356
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016357 int mem_base;
16358 xmlChar * ret_val;
16359 xmlParserCtxtPtr ctxt; /* the parser context */
16360 int n_ctxt;
16361 xmlChar * str; /* the input string */
16362 int n_str;
16363 int len; /* the string length */
16364 int n_len;
16365 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16366 int n_what;
16367 xmlChar end; /* an end marker xmlChar, 0 if none */
16368 int n_end;
16369 xmlChar end2; /* an end marker xmlChar, 0 if none */
16370 int n_end2;
16371 xmlChar end3; /* an end marker xmlChar, 0 if none */
16372 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016373
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016374 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16375 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16376 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16377 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16378 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16379 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16380 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16381 mem_base = xmlMemBlocks();
16382 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16383 str = gen_const_xmlChar_ptr(n_str, 1);
16384 len = gen_int(n_len, 2);
16385 what = gen_int(n_what, 3);
16386 end = gen_xmlChar(n_end, 4);
16387 end2 = gen_xmlChar(n_end2, 5);
16388 end3 = gen_xmlChar(n_end3, 6);
16389
William M. Brackf13f77f2004-11-12 16:03:48 +000016390 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016391 desret_xmlChar_ptr(ret_val);
16392 call_tests++;
16393 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016394 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016395 des_int(n_len, len, 2);
16396 des_int(n_what, what, 3);
16397 des_xmlChar(n_end, end, 4);
16398 des_xmlChar(n_end2, end2, 5);
16399 des_xmlChar(n_end3, end3, 6);
16400 xmlResetLastError();
16401 if (mem_base != xmlMemBlocks()) {
16402 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16403 xmlMemBlocks() - mem_base);
16404 test_ret++;
16405 printf(" %d", n_ctxt);
16406 printf(" %d", n_str);
16407 printf(" %d", n_len);
16408 printf(" %d", n_what);
16409 printf(" %d", n_end);
16410 printf(" %d", n_end2);
16411 printf(" %d", n_end3);
16412 printf("\n");
16413 }
16414 }
16415 }
16416 }
16417 }
16418 }
16419 }
16420 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016421 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016422
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016423 return(test_ret);
16424}
16425
16426
16427static int
16428test_xmlSwitchEncoding(void) {
16429 int test_ret = 0;
16430
16431 int mem_base;
16432 int ret_val;
16433 xmlParserCtxtPtr ctxt; /* the parser context */
16434 int n_ctxt;
16435 xmlCharEncoding enc; /* the encoding value (number) */
16436 int n_enc;
16437
16438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16439 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16440 mem_base = xmlMemBlocks();
16441 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16442 enc = gen_xmlCharEncoding(n_enc, 1);
16443
16444 ret_val = xmlSwitchEncoding(ctxt, enc);
16445 desret_int(ret_val);
16446 call_tests++;
16447 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16448 des_xmlCharEncoding(n_enc, enc, 1);
16449 xmlResetLastError();
16450 if (mem_base != xmlMemBlocks()) {
16451 printf("Leak of %d blocks found in xmlSwitchEncoding",
16452 xmlMemBlocks() - mem_base);
16453 test_ret++;
16454 printf(" %d", n_ctxt);
16455 printf(" %d", n_enc);
16456 printf("\n");
16457 }
16458 }
16459 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016460 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016461
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016462 return(test_ret);
16463}
16464
16465
16466static int
16467test_xmlSwitchInputEncoding(void) {
16468 int test_ret = 0;
16469
16470 int mem_base;
16471 int ret_val;
16472 xmlParserCtxtPtr ctxt; /* the parser context */
16473 int n_ctxt;
16474 xmlParserInputPtr input; /* the input stream */
16475 int n_input;
16476 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16477 int n_handler;
16478
16479 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16480 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16481 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16482 mem_base = xmlMemBlocks();
16483 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16484 input = gen_xmlParserInputPtr(n_input, 1);
16485 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16486
16487 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16488 desret_int(ret_val);
16489 call_tests++;
16490 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16491 des_xmlParserInputPtr(n_input, input, 1);
16492 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16493 xmlResetLastError();
16494 if (mem_base != xmlMemBlocks()) {
16495 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16496 xmlMemBlocks() - mem_base);
16497 test_ret++;
16498 printf(" %d", n_ctxt);
16499 printf(" %d", n_input);
16500 printf(" %d", n_handler);
16501 printf("\n");
16502 }
16503 }
16504 }
16505 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016506 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016507
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016508 return(test_ret);
16509}
16510
16511
16512static int
16513test_xmlSwitchToEncoding(void) {
16514 int test_ret = 0;
16515
16516 int mem_base;
16517 int ret_val;
16518 xmlParserCtxtPtr ctxt; /* the parser context */
16519 int n_ctxt;
16520 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16521 int n_handler;
16522
16523 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16524 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16525 mem_base = xmlMemBlocks();
16526 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16527 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16528
16529 ret_val = xmlSwitchToEncoding(ctxt, handler);
16530 desret_int(ret_val);
16531 call_tests++;
16532 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16533 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16534 xmlResetLastError();
16535 if (mem_base != xmlMemBlocks()) {
16536 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16537 xmlMemBlocks() - mem_base);
16538 test_ret++;
16539 printf(" %d", n_ctxt);
16540 printf(" %d", n_handler);
16541 printf("\n");
16542 }
16543 }
16544 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016546
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016547 return(test_ret);
16548}
16549
16550static int
16551test_parserInternals(void) {
16552 int test_ret = 0;
16553
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016554 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016555 test_ret += test_htmlCreateFileParserCtxt();
16556 test_ret += test_htmlInitAutoClose();
16557 test_ret += test_inputPop();
16558 test_ret += test_inputPush();
16559 test_ret += test_namePop();
16560 test_ret += test_namePush();
16561 test_ret += test_nodePop();
16562 test_ret += test_nodePush();
16563 test_ret += test_xmlCheckLanguageID();
16564 test_ret += test_xmlCopyChar();
16565 test_ret += test_xmlCopyCharMultiByte();
16566 test_ret += test_xmlCreateEntityParserCtxt();
16567 test_ret += test_xmlCreateFileParserCtxt();
16568 test_ret += test_xmlCreateMemoryParserCtxt();
16569 test_ret += test_xmlCreateURLParserCtxt();
16570 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016571 test_ret += test_xmlErrMemory();
16572 test_ret += test_xmlIsLetter();
16573 test_ret += test_xmlNewEntityInputStream();
16574 test_ret += test_xmlNewInputFromFile();
16575 test_ret += test_xmlNewInputStream();
16576 test_ret += test_xmlNewStringInputStream();
16577 test_ret += test_xmlNextChar();
16578 test_ret += test_xmlParserInputShrink();
16579 test_ret += test_xmlPopInput();
16580 test_ret += test_xmlPushInput();
16581 test_ret += test_xmlSetEntityReferenceFunc();
16582 test_ret += test_xmlSplitQName();
16583 test_ret += test_xmlStringCurrentChar();
16584 test_ret += test_xmlStringDecodeEntities();
16585 test_ret += test_xmlStringLenDecodeEntities();
16586 test_ret += test_xmlSwitchEncoding();
16587 test_ret += test_xmlSwitchInputEncoding();
16588 test_ret += test_xmlSwitchToEncoding();
16589
16590 if (test_ret != 0)
16591 printf("Module parserInternals: %d errors\n", test_ret);
16592 return(test_ret);
16593}
16594
Daniel Veillardd93f6252004-11-02 15:53:51 +000016595static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016596test_xmlPatternFromRoot(void) {
16597 int test_ret = 0;
16598
16599#if defined(LIBXML_PATTERN_ENABLED)
16600 int mem_base;
16601 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016602 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016603 int n_comp;
16604
16605 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16606 mem_base = xmlMemBlocks();
16607 comp = gen_xmlPatternPtr(n_comp, 0);
16608
16609 ret_val = xmlPatternFromRoot(comp);
16610 desret_int(ret_val);
16611 call_tests++;
16612 des_xmlPatternPtr(n_comp, comp, 0);
16613 xmlResetLastError();
16614 if (mem_base != xmlMemBlocks()) {
16615 printf("Leak of %d blocks found in xmlPatternFromRoot",
16616 xmlMemBlocks() - mem_base);
16617 test_ret++;
16618 printf(" %d", n_comp);
16619 printf("\n");
16620 }
16621 }
16622 function_tests++;
16623#endif
16624
16625 return(test_ret);
16626}
16627
16628
16629static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016630test_xmlPatternGetStreamCtxt(void) {
16631 int test_ret = 0;
16632
16633
16634 /* missing type support */
16635 return(test_ret);
16636}
16637
16638
16639static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016640test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016642
William M. Brack21e4ef22005-01-02 09:53:13 +000016643#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016644 int mem_base;
16645 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016646 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016647 int n_comp;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016648 xmlNodePtr node; /* a node */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016649 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016650
Daniel Veillardce682bc2004-11-05 17:22:25 +000016651 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16652 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16653 mem_base = xmlMemBlocks();
16654 comp = gen_xmlPatternPtr(n_comp, 0);
16655 node = gen_xmlNodePtr(n_node, 1);
16656
16657 ret_val = xmlPatternMatch(comp, node);
16658 desret_int(ret_val);
16659 call_tests++;
16660 des_xmlPatternPtr(n_comp, comp, 0);
16661 des_xmlNodePtr(n_node, node, 1);
16662 xmlResetLastError();
16663 if (mem_base != xmlMemBlocks()) {
16664 printf("Leak of %d blocks found in xmlPatternMatch",
16665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016667 printf(" %d", n_comp);
16668 printf(" %d", n_node);
16669 printf("\n");
16670 }
16671 }
16672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016673 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016674#endif
16675
Daniel Veillard42595322004-11-08 10:52:06 +000016676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016677}
16678
16679
16680static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016681test_xmlPatternMaxDepth(void) {
16682 int test_ret = 0;
16683
16684#if defined(LIBXML_PATTERN_ENABLED)
16685 int mem_base;
16686 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016687 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016688 int n_comp;
16689
16690 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16691 mem_base = xmlMemBlocks();
16692 comp = gen_xmlPatternPtr(n_comp, 0);
16693
16694 ret_val = xmlPatternMaxDepth(comp);
16695 desret_int(ret_val);
16696 call_tests++;
16697 des_xmlPatternPtr(n_comp, comp, 0);
16698 xmlResetLastError();
16699 if (mem_base != xmlMemBlocks()) {
16700 printf("Leak of %d blocks found in xmlPatternMaxDepth",
16701 xmlMemBlocks() - mem_base);
16702 test_ret++;
16703 printf(" %d", n_comp);
16704 printf("\n");
16705 }
16706 }
16707 function_tests++;
16708#endif
16709
16710 return(test_ret);
16711}
16712
16713
16714static int
16715test_xmlPatternStreamable(void) {
16716 int test_ret = 0;
16717
16718#if defined(LIBXML_PATTERN_ENABLED)
16719 int mem_base;
16720 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016721 xmlPatternPtr comp; /* the precompiled pattern */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016722 int n_comp;
16723
16724 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16725 mem_base = xmlMemBlocks();
16726 comp = gen_xmlPatternPtr(n_comp, 0);
16727
16728 ret_val = xmlPatternStreamable(comp);
16729 desret_int(ret_val);
16730 call_tests++;
16731 des_xmlPatternPtr(n_comp, comp, 0);
16732 xmlResetLastError();
16733 if (mem_base != xmlMemBlocks()) {
16734 printf("Leak of %d blocks found in xmlPatternStreamable",
16735 xmlMemBlocks() - mem_base);
16736 test_ret++;
16737 printf(" %d", n_comp);
16738 printf("\n");
16739 }
16740 }
16741 function_tests++;
16742#endif
16743
16744 return(test_ret);
16745}
16746
16747
16748static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016749test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016751
16752
16753 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016755}
16756
William M. Brackba1d3172005-03-25 03:05:46 +000016757#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016758
16759#define gen_nb_xmlStreamCtxtPtr 1
16760static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16761 return(NULL);
16762}
16763static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16764}
William M. Brackba1d3172005-03-25 03:05:46 +000016765#endif
16766
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016767
16768static int
16769test_xmlStreamPop(void) {
16770 int test_ret = 0;
16771
16772#if defined(LIBXML_PATTERN_ENABLED)
16773 int mem_base;
16774 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016775 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016776 int n_stream;
16777
16778 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16779 mem_base = xmlMemBlocks();
16780 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16781
16782 ret_val = xmlStreamPop(stream);
16783 desret_int(ret_val);
16784 call_tests++;
16785 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16786 xmlResetLastError();
16787 if (mem_base != xmlMemBlocks()) {
16788 printf("Leak of %d blocks found in xmlStreamPop",
16789 xmlMemBlocks() - mem_base);
16790 test_ret++;
16791 printf(" %d", n_stream);
16792 printf("\n");
16793 }
16794 }
16795 function_tests++;
16796#endif
16797
16798 return(test_ret);
16799}
16800
16801
16802static int
16803test_xmlStreamPush(void) {
16804 int test_ret = 0;
16805
16806#if defined(LIBXML_PATTERN_ENABLED)
16807 int mem_base;
16808 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016809 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016810 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016811 xmlChar * name; /* the current name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016812 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016813 xmlChar * ns; /* the namespace name */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016814 int n_ns;
16815
16816 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16817 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16818 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16819 mem_base = xmlMemBlocks();
16820 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16821 name = gen_const_xmlChar_ptr(n_name, 1);
16822 ns = gen_const_xmlChar_ptr(n_ns, 2);
16823
16824 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16825 desret_int(ret_val);
16826 call_tests++;
16827 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16828 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16829 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16830 xmlResetLastError();
16831 if (mem_base != xmlMemBlocks()) {
16832 printf("Leak of %d blocks found in xmlStreamPush",
16833 xmlMemBlocks() - mem_base);
16834 test_ret++;
16835 printf(" %d", n_stream);
16836 printf(" %d", n_name);
16837 printf(" %d", n_ns);
16838 printf("\n");
16839 }
16840 }
16841 }
16842 }
16843 function_tests++;
16844#endif
16845
16846 return(test_ret);
16847}
16848
Daniel Veillardb5839c32005-02-19 18:27:14 +000016849
16850static int
16851test_xmlStreamPushAttr(void) {
16852 int test_ret = 0;
16853
16854#if defined(LIBXML_PATTERN_ENABLED)
16855 int mem_base;
16856 int ret_val;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016857 xmlStreamCtxtPtr stream; /* the stream context */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016858 int n_stream;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016859 xmlChar * name; /* the current name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016860 int n_name;
Daniel Veillard57c000e2005-03-13 18:34:29 +000016861 xmlChar * ns; /* the namespace name */
Daniel Veillardb5839c32005-02-19 18:27:14 +000016862 int n_ns;
16863
16864 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16865 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16866 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16867 mem_base = xmlMemBlocks();
16868 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16869 name = gen_const_xmlChar_ptr(n_name, 1);
16870 ns = gen_const_xmlChar_ptr(n_ns, 2);
16871
16872 ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
16873 desret_int(ret_val);
16874 call_tests++;
16875 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16876 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16877 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16878 xmlResetLastError();
16879 if (mem_base != xmlMemBlocks()) {
16880 printf("Leak of %d blocks found in xmlStreamPushAttr",
16881 xmlMemBlocks() - mem_base);
16882 test_ret++;
16883 printf(" %d", n_stream);
16884 printf(" %d", n_name);
16885 printf(" %d", n_ns);
16886 printf("\n");
16887 }
16888 }
16889 }
16890 }
16891 function_tests++;
16892#endif
16893
16894 return(test_ret);
16895}
16896
Daniel Veillardd93f6252004-11-02 15:53:51 +000016897static int
16898test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016900
Daniel Veillardb5839c32005-02-19 18:27:14 +000016901 if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n");
16902 test_ret += test_xmlPatternFromRoot();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016903 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016904 test_ret += test_xmlPatternMatch();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016905 test_ret += test_xmlPatternMaxDepth();
16906 test_ret += test_xmlPatternStreamable();
Daniel Veillard42595322004-11-08 10:52:06 +000016907 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016908 test_ret += test_xmlStreamPop();
16909 test_ret += test_xmlStreamPush();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016910 test_ret += test_xmlStreamPushAttr();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016911
Daniel Veillard42595322004-11-08 10:52:06 +000016912 if (test_ret != 0)
16913 printf("Module pattern: %d errors\n", test_ret);
16914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016915}
Daniel Veillarda521d282004-11-09 14:59:59 +000016916#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016917
Daniel Veillardce682bc2004-11-05 17:22:25 +000016918#define gen_nb_xmlRelaxNGPtr 1
16919static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16920 return(NULL);
16921}
16922static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16923}
Daniel Veillarda521d282004-11-09 14:59:59 +000016924#endif
16925
Daniel Veillardce682bc2004-11-05 17:22:25 +000016926
Daniel Veillardd93f6252004-11-02 15:53:51 +000016927static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016928test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016930
William M. Brack21e4ef22005-01-02 09:53:13 +000016931#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016932 int mem_base;
16933 FILE * output; /* the file output */
16934 int n_output;
16935 xmlRelaxNGPtr schema; /* a schema structure */
16936 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016937
Daniel Veillardce682bc2004-11-05 17:22:25 +000016938 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16939 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16940 mem_base = xmlMemBlocks();
16941 output = gen_FILE_ptr(n_output, 0);
16942 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16943
16944 xmlRelaxNGDump(output, schema);
16945 call_tests++;
16946 des_FILE_ptr(n_output, output, 0);
16947 des_xmlRelaxNGPtr(n_schema, schema, 1);
16948 xmlResetLastError();
16949 if (mem_base != xmlMemBlocks()) {
16950 printf("Leak of %d blocks found in xmlRelaxNGDump",
16951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016952 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016953 printf(" %d", n_output);
16954 printf(" %d", n_schema);
16955 printf("\n");
16956 }
16957 }
16958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016959 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016960#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016961
Daniel Veillard42595322004-11-08 10:52:06 +000016962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016963}
16964
16965
16966static int
16967test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016969
William M. Brack21e4ef22005-01-02 09:53:13 +000016970#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016971 int mem_base;
16972 FILE * output; /* the file output */
16973 int n_output;
16974 xmlRelaxNGPtr schema; /* a schema structure */
16975 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016976
Daniel Veillardce682bc2004-11-05 17:22:25 +000016977 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16978 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16979 mem_base = xmlMemBlocks();
16980 output = gen_FILE_ptr(n_output, 0);
16981 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16982
16983 xmlRelaxNGDumpTree(output, schema);
16984 call_tests++;
16985 des_FILE_ptr(n_output, output, 0);
16986 des_xmlRelaxNGPtr(n_schema, schema, 1);
16987 xmlResetLastError();
16988 if (mem_base != xmlMemBlocks()) {
16989 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016991 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016992 printf(" %d", n_output);
16993 printf(" %d", n_schema);
16994 printf("\n");
16995 }
16996 }
16997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016998 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016999#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000017000
Daniel Veillard42595322004-11-08 10:52:06 +000017001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017002}
17003
Daniel Veillarda521d282004-11-09 14:59:59 +000017004#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017005
Daniel Veillardce682bc2004-11-05 17:22:25 +000017006#define gen_nb_xmlRelaxNGParserCtxtPtr 1
17007static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17008 return(NULL);
17009}
17010static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17011}
Daniel Veillarda521d282004-11-09 14:59:59 +000017012#endif
17013
17014#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017015
17016#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17017static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17018 return(NULL);
17019}
17020static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17021}
Daniel Veillarda521d282004-11-09 14:59:59 +000017022#endif
17023
17024#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017025
17026#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17027static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17028 return(NULL);
17029}
17030static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17031}
Daniel Veillarda521d282004-11-09 14:59:59 +000017032#endif
17033
17034#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017035
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017036#define gen_nb_void_ptr_ptr 1
17037static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17038 return(NULL);
17039}
17040static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17041}
Daniel Veillarda521d282004-11-09 14:59:59 +000017042#endif
17043
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017044
Daniel Veillardd93f6252004-11-02 15:53:51 +000017045static int
17046test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017048
William M. Brack21e4ef22005-01-02 09:53:13 +000017049#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017050 int mem_base;
17051 int ret_val;
17052 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17053 int n_ctxt;
17054 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17055 int n_err;
17056 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17057 int n_warn;
17058 void ** ctx; /* contextual data for the callbacks result */
17059 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017060
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017061 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17062 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17063 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17064 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17065 mem_base = xmlMemBlocks();
17066 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17067 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17068 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17069 ctx = gen_void_ptr_ptr(n_ctx, 3);
17070
17071 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17072 desret_int(ret_val);
17073 call_tests++;
17074 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17075 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17076 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17077 des_void_ptr_ptr(n_ctx, ctx, 3);
17078 xmlResetLastError();
17079 if (mem_base != xmlMemBlocks()) {
17080 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017082 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017083 printf(" %d", n_ctxt);
17084 printf(" %d", n_err);
17085 printf(" %d", n_warn);
17086 printf(" %d", n_ctx);
17087 printf("\n");
17088 }
17089 }
17090 }
17091 }
17092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017093 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017094#endif
17095
Daniel Veillard42595322004-11-08 10:52:06 +000017096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017097}
17098
Daniel Veillarda521d282004-11-09 14:59:59 +000017099#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017100
Daniel Veillardce682bc2004-11-05 17:22:25 +000017101#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17102static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17103 return(NULL);
17104}
17105static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17106}
Daniel Veillarda521d282004-11-09 14:59:59 +000017107#endif
17108
Daniel Veillardce682bc2004-11-05 17:22:25 +000017109
Daniel Veillardd93f6252004-11-02 15:53:51 +000017110static int
17111test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017113
William M. Brack21e4ef22005-01-02 09:53:13 +000017114#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017115 int mem_base;
17116 int ret_val;
17117 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17118 int n_ctxt;
17119 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17120 int n_err;
17121 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17122 int n_warn;
17123 void ** ctx; /* the functions context result */
17124 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017125
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017126 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17127 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17128 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17129 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17130 mem_base = xmlMemBlocks();
17131 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17132 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17133 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17134 ctx = gen_void_ptr_ptr(n_ctx, 3);
17135
17136 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17137 desret_int(ret_val);
17138 call_tests++;
17139 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17140 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17141 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17142 des_void_ptr_ptr(n_ctx, ctx, 3);
17143 xmlResetLastError();
17144 if (mem_base != xmlMemBlocks()) {
17145 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017147 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017148 printf(" %d", n_ctxt);
17149 printf(" %d", n_err);
17150 printf(" %d", n_warn);
17151 printf(" %d", n_ctx);
17152 printf("\n");
17153 }
17154 }
17155 }
17156 }
17157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017158 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017159#endif
17160
Daniel Veillard42595322004-11-08 10:52:06 +000017161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017162}
17163
17164
17165static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017166test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017167 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017168
William M. Brack21e4ef22005-01-02 09:53:13 +000017169#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017170 int mem_base;
17171 int ret_val;
17172
17173 mem_base = xmlMemBlocks();
17174
17175 ret_val = xmlRelaxNGInitTypes();
17176 desret_int(ret_val);
17177 call_tests++;
17178 xmlResetLastError();
17179 if (mem_base != xmlMemBlocks()) {
17180 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017182 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017183 printf("\n");
17184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017185 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017186#endif
17187
Daniel Veillard42595322004-11-08 10:52:06 +000017188 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017189}
17190
17191
17192static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017193test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017195
William M. Brack21e4ef22005-01-02 09:53:13 +000017196#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017197 int mem_base;
17198 xmlRelaxNGParserCtxtPtr ret_val;
17199 xmlDocPtr doc; /* a preparsed document tree */
17200 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017201
Daniel Veillard42595322004-11-08 10:52:06 +000017202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17203 mem_base = xmlMemBlocks();
17204 doc = gen_xmlDocPtr(n_doc, 0);
17205
17206 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17207 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17208 call_tests++;
17209 des_xmlDocPtr(n_doc, doc, 0);
17210 xmlResetLastError();
17211 if (mem_base != xmlMemBlocks()) {
17212 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17213 xmlMemBlocks() - mem_base);
17214 test_ret++;
17215 printf(" %d", n_doc);
17216 printf("\n");
17217 }
17218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017219 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017220#endif
17221
Daniel Veillard42595322004-11-08 10:52:06 +000017222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017223}
17224
17225
17226static int
17227test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017229
William M. Brack21e4ef22005-01-02 09:53:13 +000017230#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017231 int mem_base;
17232 xmlRelaxNGParserCtxtPtr ret_val;
17233 char * buffer; /* a pointer to a char array containing the schemas */
17234 int n_buffer;
17235 int size; /* the size of the array */
17236 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017237
Daniel Veillard42595322004-11-08 10:52:06 +000017238 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17239 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17240 mem_base = xmlMemBlocks();
17241 buffer = gen_const_char_ptr(n_buffer, 0);
17242 size = gen_int(n_size, 1);
17243
William M. Brackf13f77f2004-11-12 16:03:48 +000017244 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017245 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17246 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017247 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017248 des_int(n_size, size, 1);
17249 xmlResetLastError();
17250 if (mem_base != xmlMemBlocks()) {
17251 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17252 xmlMemBlocks() - mem_base);
17253 test_ret++;
17254 printf(" %d", n_buffer);
17255 printf(" %d", n_size);
17256 printf("\n");
17257 }
17258 }
17259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017261#endif
17262
Daniel Veillard42595322004-11-08 10:52:06 +000017263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017264}
17265
17266
17267static int
17268test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017270
William M. Brack21e4ef22005-01-02 09:53:13 +000017271#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017272 int mem_base;
17273 xmlRelaxNGParserCtxtPtr ret_val;
17274 char * URL; /* the location of the schema */
17275 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017276
Daniel Veillard42595322004-11-08 10:52:06 +000017277 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17278 mem_base = xmlMemBlocks();
17279 URL = gen_const_char_ptr(n_URL, 0);
17280
William M. Brackf13f77f2004-11-12 16:03:48 +000017281 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017282 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17283 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017284 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017285 xmlResetLastError();
17286 if (mem_base != xmlMemBlocks()) {
17287 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17288 xmlMemBlocks() - mem_base);
17289 test_ret++;
17290 printf(" %d", n_URL);
17291 printf("\n");
17292 }
17293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017294 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017295#endif
17296
Daniel Veillard42595322004-11-08 10:52:06 +000017297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017298}
17299
17300
17301static int
17302test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017304
17305
17306 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017308}
17309
17310
17311static int
17312test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017314
17315
17316 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017318}
17319
17320
17321static int
17322test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017324
17325
17326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017328}
17329
17330
17331static int
17332test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017334
17335
17336 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017338}
17339
17340
17341static int
17342test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017344
William M. Brack21e4ef22005-01-02 09:53:13 +000017345#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017346 int mem_base;
17347 int ret_val;
17348 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17349 int n_ctxt;
17350 xmlDocPtr doc; /* a parsed document tree */
17351 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017352
Daniel Veillardce682bc2004-11-05 17:22:25 +000017353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17354 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17355 mem_base = xmlMemBlocks();
17356 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17357 doc = gen_xmlDocPtr(n_doc, 1);
17358
17359 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17360 desret_int(ret_val);
17361 call_tests++;
17362 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17363 des_xmlDocPtr(n_doc, doc, 1);
17364 xmlResetLastError();
17365 if (mem_base != xmlMemBlocks()) {
17366 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017368 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017369 printf(" %d", n_ctxt);
17370 printf(" %d", n_doc);
17371 printf("\n");
17372 }
17373 }
17374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017375 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017376#endif
17377
Daniel Veillard42595322004-11-08 10:52:06 +000017378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017379}
17380
17381
17382static int
17383test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017385
William M. Brack21e4ef22005-01-02 09:53:13 +000017386#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017387 int mem_base;
17388 int ret_val;
17389 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17390 int n_ctxt;
17391 xmlDocPtr doc; /* a document instance */
17392 int n_doc;
17393 xmlNodePtr elem; /* an element instance */
17394 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017395
Daniel Veillardce682bc2004-11-05 17:22:25 +000017396 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17397 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17398 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17399 mem_base = xmlMemBlocks();
17400 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17401 doc = gen_xmlDocPtr(n_doc, 1);
17402 elem = gen_xmlNodePtr(n_elem, 2);
17403
17404 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17405 desret_int(ret_val);
17406 call_tests++;
17407 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17408 des_xmlDocPtr(n_doc, doc, 1);
17409 des_xmlNodePtr(n_elem, elem, 2);
17410 xmlResetLastError();
17411 if (mem_base != xmlMemBlocks()) {
17412 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017414 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017415 printf(" %d", n_ctxt);
17416 printf(" %d", n_doc);
17417 printf(" %d", n_elem);
17418 printf("\n");
17419 }
17420 }
17421 }
17422 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017423 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017424#endif
17425
Daniel Veillard42595322004-11-08 10:52:06 +000017426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017427}
17428
17429
17430static int
17431test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017433
William M. Brack21e4ef22005-01-02 09:53:13 +000017434#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017435 int mem_base;
17436 int ret_val;
17437 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17438 int n_ctxt;
17439 xmlDocPtr doc; /* a document instance */
17440 int n_doc;
17441 xmlNodePtr elem; /* an element instance */
17442 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017443
Daniel Veillardce682bc2004-11-05 17:22:25 +000017444 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17445 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17446 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17447 mem_base = xmlMemBlocks();
17448 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17449 doc = gen_xmlDocPtr(n_doc, 1);
17450 elem = gen_xmlNodePtr(n_elem, 2);
17451
17452 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17453 desret_int(ret_val);
17454 call_tests++;
17455 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17456 des_xmlDocPtr(n_doc, doc, 1);
17457 des_xmlNodePtr(n_elem, elem, 2);
17458 xmlResetLastError();
17459 if (mem_base != xmlMemBlocks()) {
17460 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017462 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017463 printf(" %d", n_ctxt);
17464 printf(" %d", n_doc);
17465 printf(" %d", n_elem);
17466 printf("\n");
17467 }
17468 }
17469 }
17470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017471 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017472#endif
17473
Daniel Veillard42595322004-11-08 10:52:06 +000017474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017475}
17476
17477
17478static int
17479test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481
William M. Brack21e4ef22005-01-02 09:53:13 +000017482#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017483 int mem_base;
17484 int ret_val;
17485 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17486 int n_ctxt;
17487 xmlChar * data; /* some character data read */
17488 int n_data;
17489 int len; /* the lenght of the data */
17490 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017491
Daniel Veillardce682bc2004-11-05 17:22:25 +000017492 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17493 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17494 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17495 mem_base = xmlMemBlocks();
17496 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17497 data = gen_const_xmlChar_ptr(n_data, 1);
17498 len = gen_int(n_len, 2);
17499
William M. Brackf13f77f2004-11-12 16:03:48 +000017500 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017501 desret_int(ret_val);
17502 call_tests++;
17503 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017504 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017505 des_int(n_len, len, 2);
17506 xmlResetLastError();
17507 if (mem_base != xmlMemBlocks()) {
17508 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017511 printf(" %d", n_ctxt);
17512 printf(" %d", n_data);
17513 printf(" %d", n_len);
17514 printf("\n");
17515 }
17516 }
17517 }
17518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017519 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017520#endif
17521
Daniel Veillard42595322004-11-08 10:52:06 +000017522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017523}
17524
17525
17526static int
17527test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017529
William M. Brack21e4ef22005-01-02 09:53:13 +000017530#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017531 int mem_base;
17532 int ret_val;
17533 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17534 int n_ctxt;
17535 xmlDocPtr doc; /* a document instance */
17536 int n_doc;
17537 xmlNodePtr elem; /* an element instance */
17538 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017539
Daniel Veillardce682bc2004-11-05 17:22:25 +000017540 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17541 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17542 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17543 mem_base = xmlMemBlocks();
17544 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17545 doc = gen_xmlDocPtr(n_doc, 1);
17546 elem = gen_xmlNodePtr(n_elem, 2);
17547
17548 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17549 desret_int(ret_val);
17550 call_tests++;
17551 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17552 des_xmlDocPtr(n_doc, doc, 1);
17553 des_xmlNodePtr(n_elem, elem, 2);
17554 xmlResetLastError();
17555 if (mem_base != xmlMemBlocks()) {
17556 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017559 printf(" %d", n_ctxt);
17560 printf(" %d", n_doc);
17561 printf(" %d", n_elem);
17562 printf("\n");
17563 }
17564 }
17565 }
17566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017567 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017568#endif
17569
Daniel Veillard42595322004-11-08 10:52:06 +000017570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017571}
17572
17573
17574static int
17575test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017577
William M. Brack21e4ef22005-01-02 09:53:13 +000017578#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017579 int mem_base;
17580 int ret_val;
17581 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17582 int n_ctxt;
17583 int flags; /* a set of flags values */
17584 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017585
Daniel Veillardce682bc2004-11-05 17:22:25 +000017586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17587 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17588 mem_base = xmlMemBlocks();
17589 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17590 flags = gen_int(n_flags, 1);
17591
17592 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17593 desret_int(ret_val);
17594 call_tests++;
17595 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17596 des_int(n_flags, flags, 1);
17597 xmlResetLastError();
17598 if (mem_base != xmlMemBlocks()) {
17599 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017601 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017602 printf(" %d", n_ctxt);
17603 printf(" %d", n_flags);
17604 printf("\n");
17605 }
17606 }
17607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017608 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017609#endif
17610
Daniel Veillard42595322004-11-08 10:52:06 +000017611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017612}
17613
17614static int
17615test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017617
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017618 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017619 test_ret += test_xmlRelaxNGDump();
17620 test_ret += test_xmlRelaxNGDumpTree();
17621 test_ret += test_xmlRelaxNGGetParserErrors();
17622 test_ret += test_xmlRelaxNGGetValidErrors();
17623 test_ret += test_xmlRelaxNGInitTypes();
17624 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17625 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17626 test_ret += test_xmlRelaxNGNewParserCtxt();
17627 test_ret += test_xmlRelaxNGNewValidCtxt();
17628 test_ret += test_xmlRelaxNGParse();
17629 test_ret += test_xmlRelaxNGSetParserErrors();
17630 test_ret += test_xmlRelaxNGSetValidErrors();
17631 test_ret += test_xmlRelaxNGValidateDoc();
17632 test_ret += test_xmlRelaxNGValidateFullElement();
17633 test_ret += test_xmlRelaxNGValidatePopElement();
17634 test_ret += test_xmlRelaxNGValidatePushCData();
17635 test_ret += test_xmlRelaxNGValidatePushElement();
17636 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017637
Daniel Veillard42595322004-11-08 10:52:06 +000017638 if (test_ret != 0)
17639 printf("Module relaxng: %d errors\n", test_ret);
17640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017641}
17642static int
17643test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017646 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017647
Daniel Veillard42595322004-11-08 10:52:06 +000017648 if (test_ret != 0)
17649 printf("Module schemasInternals: %d errors\n", test_ret);
17650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651}
17652
17653static int
17654test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017656
17657 int mem_base;
17658 xmlNodePtr ret_val;
17659 xmlNodePtr parent; /* the parent node */
17660 int n_parent;
17661 xmlNodePtr cur; /* the child node */
17662 int n_cur;
17663
Daniel Veillarda03e3652004-11-02 18:45:30 +000017664 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017665 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017667 parent = gen_xmlNodePtr(n_parent, 0);
17668 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017669
17670 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017671 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672 desret_xmlNodePtr(ret_val);
17673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017674 des_xmlNodePtr(n_parent, parent, 0);
17675 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017676 xmlResetLastError();
17677 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017678 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017680 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017681 printf(" %d", n_parent);
17682 printf(" %d", n_cur);
17683 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017684 }
17685 }
17686 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017687 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017688
Daniel Veillard42595322004-11-08 10:52:06 +000017689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017690}
17691
17692
17693static int
17694test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017696
17697 int mem_base;
17698 xmlNodePtr ret_val;
17699 xmlNodePtr parent; /* the parent node */
17700 int n_parent;
17701 xmlNodePtr cur; /* the first node in the list */
17702 int n_cur;
17703
Daniel Veillarda03e3652004-11-02 18:45:30 +000017704 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017705 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017707 parent = gen_xmlNodePtr(n_parent, 0);
17708 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017709
17710 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017711 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712 desret_xmlNodePtr(ret_val);
17713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017714 des_xmlNodePtr(n_parent, parent, 0);
17715 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017716 xmlResetLastError();
17717 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017718 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017720 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017721 printf(" %d", n_parent);
17722 printf(" %d", n_cur);
17723 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017724 }
17725 }
17726 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017727 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017728
Daniel Veillard42595322004-11-08 10:52:06 +000017729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017730}
17731
17732
17733static int
17734test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017736
17737 int mem_base;
17738 xmlNodePtr ret_val;
17739 xmlNodePtr cur; /* the child node */
17740 int n_cur;
17741 xmlNodePtr elem; /* the new node */
17742 int n_elem;
17743
17744 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017745 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017747 cur = gen_xmlNodePtr(n_cur, 0);
17748 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017749
17750 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017751 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017752 desret_xmlNodePtr(ret_val);
17753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017754 des_xmlNodePtr(n_cur, cur, 0);
17755 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017756 xmlResetLastError();
17757 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017758 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017760 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017761 printf(" %d", n_cur);
17762 printf(" %d", n_elem);
17763 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017764 }
17765 }
17766 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017767 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017768
Daniel Veillard42595322004-11-08 10:52:06 +000017769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017770}
17771
17772
17773static int
17774test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776
William M. Brack21e4ef22005-01-02 09:53:13 +000017777#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017778 int mem_base;
17779 xmlNodePtr ret_val;
17780 xmlNodePtr cur; /* the child node */
17781 int n_cur;
17782 xmlNodePtr elem; /* the new node */
17783 int n_elem;
17784
17785 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017786 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017788 cur = gen_xmlNodePtr(n_cur, 0);
17789 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017790
17791 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017792 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017793 desret_xmlNodePtr(ret_val);
17794 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017795 des_xmlNodePtr(n_cur, cur, 0);
17796 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017797 xmlResetLastError();
17798 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017799 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017801 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017802 printf(" %d", n_cur);
17803 printf(" %d", n_elem);
17804 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017805 }
17806 }
17807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017808 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017809#endif
17810
Daniel Veillard42595322004-11-08 10:52:06 +000017811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017812}
17813
17814
17815static int
17816test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017818
17819 int mem_base;
17820 xmlNodePtr ret_val;
17821 xmlNodePtr cur; /* the child node */
17822 int n_cur;
17823 xmlNodePtr elem; /* the new node */
17824 int n_elem;
17825
17826 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017827 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017829 cur = gen_xmlNodePtr(n_cur, 0);
17830 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017831
17832 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017833 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017834 desret_xmlNodePtr(ret_val);
17835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017836 des_xmlNodePtr(n_cur, cur, 0);
17837 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017838 xmlResetLastError();
17839 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017840 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017842 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017843 printf(" %d", n_cur);
17844 printf(" %d", n_elem);
17845 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017846 }
17847 }
17848 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017849 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017850
Daniel Veillard42595322004-11-08 10:52:06 +000017851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017852}
17853
17854
17855static int
17856test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017858
William M. Brack21e4ef22005-01-02 09:53:13 +000017859#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017860#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017861 int mem_base;
17862 xmlBufferPtr buf; /* the XML buffer output */
17863 int n_buf;
17864 xmlDocPtr doc; /* the document */
17865 int n_doc;
17866 xmlAttrPtr attr; /* the attribute node */
17867 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017868 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017869 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017870
Daniel Veillardce244ad2004-11-05 10:03:46 +000017871 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17872 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17873 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17874 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17875 mem_base = xmlMemBlocks();
17876 buf = gen_xmlBufferPtr(n_buf, 0);
17877 doc = gen_xmlDocPtr(n_doc, 1);
17878 attr = gen_xmlAttrPtr(n_attr, 2);
17879 string = gen_const_xmlChar_ptr(n_string, 3);
17880
William M. Brackf13f77f2004-11-12 16:03:48 +000017881 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017882 call_tests++;
17883 des_xmlBufferPtr(n_buf, buf, 0);
17884 des_xmlDocPtr(n_doc, doc, 1);
17885 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017886 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017887 xmlResetLastError();
17888 if (mem_base != xmlMemBlocks()) {
17889 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017891 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017892 printf(" %d", n_buf);
17893 printf(" %d", n_doc);
17894 printf(" %d", n_attr);
17895 printf(" %d", n_string);
17896 printf("\n");
17897 }
17898 }
17899 }
17900 }
17901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017902 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017903#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017904#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017905
Daniel Veillard42595322004-11-08 10:52:06 +000017906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017907}
17908
17909
17910static int
17911test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017913
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017914 int mem_base;
17915 int ret_val;
17916 xmlBufferPtr buf; /* the buffer to dump */
17917 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017918 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017919 int n_str;
17920 int len; /* the number of #xmlChar to add */
17921 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017922
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017923 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17924 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17925 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017927 buf = gen_xmlBufferPtr(n_buf, 0);
17928 str = gen_const_xmlChar_ptr(n_str, 1);
17929 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017930
William M. Brackf13f77f2004-11-12 16:03:48 +000017931 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017932 desret_int(ret_val);
17933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017934 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017935 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017936 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017937 xmlResetLastError();
17938 if (mem_base != xmlMemBlocks()) {
17939 printf("Leak of %d blocks found in xmlBufferAdd",
17940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017941 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017942 printf(" %d", n_buf);
17943 printf(" %d", n_str);
17944 printf(" %d", n_len);
17945 printf("\n");
17946 }
17947 }
17948 }
17949 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017950 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017951
Daniel Veillard42595322004-11-08 10:52:06 +000017952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017953}
17954
17955
17956static int
17957test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017959
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017960 int mem_base;
17961 int ret_val;
17962 xmlBufferPtr buf; /* the buffer */
17963 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017964 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017965 int n_str;
17966 int len; /* the number of #xmlChar to add */
17967 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017968
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017969 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17970 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17971 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17972 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017973 buf = gen_xmlBufferPtr(n_buf, 0);
17974 str = gen_const_xmlChar_ptr(n_str, 1);
17975 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017976
William M. Brackf13f77f2004-11-12 16:03:48 +000017977 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017978 desret_int(ret_val);
17979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017980 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017981 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017982 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017983 xmlResetLastError();
17984 if (mem_base != xmlMemBlocks()) {
17985 printf("Leak of %d blocks found in xmlBufferAddHead",
17986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017987 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017988 printf(" %d", n_buf);
17989 printf(" %d", n_str);
17990 printf(" %d", n_len);
17991 printf("\n");
17992 }
17993 }
17994 }
17995 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017996 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017997
Daniel Veillard42595322004-11-08 10:52:06 +000017998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017999}
18000
18001
18002static int
18003test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018005
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018006 int mem_base;
18007 int ret_val;
18008 xmlBufferPtr buf; /* the buffer to dump */
18009 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018010 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018011 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018012
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018013 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18014 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018016 buf = gen_xmlBufferPtr(n_buf, 0);
18017 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018018
William M. Brackf13f77f2004-11-12 16:03:48 +000018019 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018020 desret_int(ret_val);
18021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018022 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018023 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018024 xmlResetLastError();
18025 if (mem_base != xmlMemBlocks()) {
18026 printf("Leak of %d blocks found in xmlBufferCCat",
18027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018028 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018029 printf(" %d", n_buf);
18030 printf(" %d", n_str);
18031 printf("\n");
18032 }
18033 }
18034 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018035 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018036
Daniel Veillard42595322004-11-08 10:52:06 +000018037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018038}
18039
18040
18041static int
18042test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018044
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018045 int mem_base;
18046 int ret_val;
18047 xmlBufferPtr buf; /* the buffer to add to */
18048 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018049 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018050 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018051
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018052 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18053 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18054 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018055 buf = gen_xmlBufferPtr(n_buf, 0);
18056 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018057
William M. Brackf13f77f2004-11-12 16:03:48 +000018058 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018059 desret_int(ret_val);
18060 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018061 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018062 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018063 xmlResetLastError();
18064 if (mem_base != xmlMemBlocks()) {
18065 printf("Leak of %d blocks found in xmlBufferCat",
18066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018067 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018068 printf(" %d", n_buf);
18069 printf(" %d", n_str);
18070 printf("\n");
18071 }
18072 }
18073 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018074 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018075
Daniel Veillard42595322004-11-08 10:52:06 +000018076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018077}
18078
18079
Daniel Veillardce682bc2004-11-05 17:22:25 +000018080#define gen_nb_const_xmlBufferPtr 1
18081static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18082 return(NULL);
18083}
18084static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18085}
18086
Daniel Veillardd93f6252004-11-02 15:53:51 +000018087static int
18088test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018090
Daniel Veillardce682bc2004-11-05 17:22:25 +000018091 int mem_base;
18092 const xmlChar * ret_val;
18093 xmlBufferPtr buf; /* the buffer */
18094 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018095
Daniel Veillardce682bc2004-11-05 17:22:25 +000018096 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18097 mem_base = xmlMemBlocks();
18098 buf = gen_const_xmlBufferPtr(n_buf, 0);
18099
William M. Brackf13f77f2004-11-12 16:03:48 +000018100 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018101 desret_const_xmlChar_ptr(ret_val);
18102 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018103 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018104 xmlResetLastError();
18105 if (mem_base != xmlMemBlocks()) {
18106 printf("Leak of %d blocks found in xmlBufferContent",
18107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018108 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018109 printf(" %d", n_buf);
18110 printf("\n");
18111 }
18112 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018114
Daniel Veillard42595322004-11-08 10:52:06 +000018115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018116}
18117
18118
18119static int
18120test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018122
Daniel Veillard3d95c732004-11-06 22:25:14 +000018123 int mem_base;
18124 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018125
Daniel Veillard3d95c732004-11-06 22:25:14 +000018126 mem_base = xmlMemBlocks();
18127
18128 ret_val = xmlBufferCreate();
18129 desret_xmlBufferPtr(ret_val);
18130 call_tests++;
18131 xmlResetLastError();
18132 if (mem_base != xmlMemBlocks()) {
18133 printf("Leak of %d blocks found in xmlBufferCreate",
18134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018135 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018136 printf("\n");
18137 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018139
Daniel Veillard42595322004-11-08 10:52:06 +000018140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141}
18142
18143
18144static int
18145test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018147
18148
18149 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018151}
18152
18153
18154static int
18155test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018157
18158
18159 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018161}
18162
18163
18164static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018165test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018167
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018168 int mem_base;
18169 xmlBufferPtr buf; /* the buffer */
18170 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018171
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018172 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018174 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018175
18176 xmlBufferEmpty(buf);
18177 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018178 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018179 xmlResetLastError();
18180 if (mem_base != xmlMemBlocks()) {
18181 printf("Leak of %d blocks found in xmlBufferEmpty",
18182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018183 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018184 printf(" %d", n_buf);
18185 printf("\n");
18186 }
18187 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018188 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018189
Daniel Veillard42595322004-11-08 10:52:06 +000018190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191}
18192
18193
18194static int
18195test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018197
Daniel Veillard3d97e662004-11-04 10:49:00 +000018198 int mem_base;
18199 int ret_val;
18200 xmlBufferPtr buf; /* the buffer */
18201 int n_buf;
18202 unsigned int len; /* the minimum free size to allocate */
18203 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018204
Daniel Veillard3d97e662004-11-04 10:49:00 +000018205 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18206 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18207 mem_base = xmlMemBlocks();
18208 buf = gen_xmlBufferPtr(n_buf, 0);
18209 len = gen_unsigned_int(n_len, 1);
18210
18211 ret_val = xmlBufferGrow(buf, len);
18212 desret_int(ret_val);
18213 call_tests++;
18214 des_xmlBufferPtr(n_buf, buf, 0);
18215 des_unsigned_int(n_len, len, 1);
18216 xmlResetLastError();
18217 if (mem_base != xmlMemBlocks()) {
18218 printf("Leak of %d blocks found in xmlBufferGrow",
18219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018220 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018221 printf(" %d", n_buf);
18222 printf(" %d", n_len);
18223 printf("\n");
18224 }
18225 }
18226 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018228
Daniel Veillard42595322004-11-08 10:52:06 +000018229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018230}
18231
18232
18233static int
18234test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018236
Daniel Veillardce682bc2004-11-05 17:22:25 +000018237 int mem_base;
18238 int ret_val;
18239 xmlBufferPtr buf; /* the buffer */
18240 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018241
Daniel Veillardce682bc2004-11-05 17:22:25 +000018242 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18243 mem_base = xmlMemBlocks();
18244 buf = gen_const_xmlBufferPtr(n_buf, 0);
18245
William M. Brackf13f77f2004-11-12 16:03:48 +000018246 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018247 desret_int(ret_val);
18248 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018249 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018250 xmlResetLastError();
18251 if (mem_base != xmlMemBlocks()) {
18252 printf("Leak of %d blocks found in xmlBufferLength",
18253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018254 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018255 printf(" %d", n_buf);
18256 printf("\n");
18257 }
18258 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018260
Daniel Veillard42595322004-11-08 10:52:06 +000018261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018262}
18263
18264
18265static int
18266test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018268
Daniel Veillard3d97e662004-11-04 10:49:00 +000018269 int mem_base;
18270 int ret_val;
18271 xmlBufferPtr buf; /* the buffer to resize */
18272 int n_buf;
18273 unsigned int size; /* the desired size */
18274 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018275
Daniel Veillard3d97e662004-11-04 10:49:00 +000018276 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18277 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18278 mem_base = xmlMemBlocks();
18279 buf = gen_xmlBufferPtr(n_buf, 0);
18280 size = gen_unsigned_int(n_size, 1);
18281
18282 ret_val = xmlBufferResize(buf, size);
18283 desret_int(ret_val);
18284 call_tests++;
18285 des_xmlBufferPtr(n_buf, buf, 0);
18286 des_unsigned_int(n_size, size, 1);
18287 xmlResetLastError();
18288 if (mem_base != xmlMemBlocks()) {
18289 printf("Leak of %d blocks found in xmlBufferResize",
18290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018291 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018292 printf(" %d", n_buf);
18293 printf(" %d", n_size);
18294 printf("\n");
18295 }
18296 }
18297 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018299
Daniel Veillard42595322004-11-08 10:52:06 +000018300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018301}
18302
18303
18304static int
18305test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018307
Daniel Veillard57b25162004-11-06 14:50:18 +000018308 int mem_base;
18309 xmlBufferPtr buf; /* the buffer to tune */
18310 int n_buf;
18311 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18312 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018313
Daniel Veillard57b25162004-11-06 14:50:18 +000018314 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18315 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18316 mem_base = xmlMemBlocks();
18317 buf = gen_xmlBufferPtr(n_buf, 0);
18318 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18319
18320 xmlBufferSetAllocationScheme(buf, scheme);
18321 call_tests++;
18322 des_xmlBufferPtr(n_buf, buf, 0);
18323 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18324 xmlResetLastError();
18325 if (mem_base != xmlMemBlocks()) {
18326 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018328 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018329 printf(" %d", n_buf);
18330 printf(" %d", n_scheme);
18331 printf("\n");
18332 }
18333 }
18334 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018336
Daniel Veillard42595322004-11-08 10:52:06 +000018337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018338}
18339
18340
18341static int
18342test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018344
Daniel Veillard3d97e662004-11-04 10:49:00 +000018345 int mem_base;
18346 int ret_val;
18347 xmlBufferPtr buf; /* the buffer to dump */
18348 int n_buf;
18349 unsigned int len; /* the number of xmlChar to remove */
18350 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018351
Daniel Veillard3d97e662004-11-04 10:49:00 +000018352 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18353 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18354 mem_base = xmlMemBlocks();
18355 buf = gen_xmlBufferPtr(n_buf, 0);
18356 len = gen_unsigned_int(n_len, 1);
18357
18358 ret_val = xmlBufferShrink(buf, len);
18359 desret_int(ret_val);
18360 call_tests++;
18361 des_xmlBufferPtr(n_buf, buf, 0);
18362 des_unsigned_int(n_len, len, 1);
18363 xmlResetLastError();
18364 if (mem_base != xmlMemBlocks()) {
18365 printf("Leak of %d blocks found in xmlBufferShrink",
18366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018367 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018368 printf(" %d", n_buf);
18369 printf(" %d", n_len);
18370 printf("\n");
18371 }
18372 }
18373 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018375
Daniel Veillard42595322004-11-08 10:52:06 +000018376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018377}
18378
18379
18380static int
18381test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018383
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018384 int mem_base;
18385 xmlBufferPtr buf; /* the XML buffer */
18386 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018387 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018388 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018389
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018390 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18391 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018393 buf = gen_xmlBufferPtr(n_buf, 0);
18394 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018395
William M. Brackf13f77f2004-11-12 16:03:48 +000018396 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018398 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018399 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018400 xmlResetLastError();
18401 if (mem_base != xmlMemBlocks()) {
18402 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018404 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018405 printf(" %d", n_buf);
18406 printf(" %d", n_string);
18407 printf("\n");
18408 }
18409 }
18410 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018412
Daniel Veillard42595322004-11-08 10:52:06 +000018413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018414}
18415
18416
18417static int
18418test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018420
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018421 int mem_base;
18422 xmlBufferPtr buf; /* the XML buffer output */
18423 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018424 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018425 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018426
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018427 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18428 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18429 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018430 buf = gen_xmlBufferPtr(n_buf, 0);
18431 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018432
William M. Brackf13f77f2004-11-12 16:03:48 +000018433 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018434 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018435 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018436 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018437 xmlResetLastError();
18438 if (mem_base != xmlMemBlocks()) {
18439 printf("Leak of %d blocks found in xmlBufferWriteChar",
18440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018441 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018442 printf(" %d", n_buf);
18443 printf(" %d", n_string);
18444 printf("\n");
18445 }
18446 }
18447 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018449
Daniel Veillard42595322004-11-08 10:52:06 +000018450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018451}
18452
18453
18454static int
18455test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018457
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018458 int mem_base;
18459 xmlBufferPtr buf; /* the XML buffer output */
18460 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018461 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018462 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018463
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018464 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18465 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018467 buf = gen_xmlBufferPtr(n_buf, 0);
18468 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018469
William M. Brackf13f77f2004-11-12 16:03:48 +000018470 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018472 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018473 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018474 xmlResetLastError();
18475 if (mem_base != xmlMemBlocks()) {
18476 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018478 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018479 printf(" %d", n_buf);
18480 printf(" %d", n_string);
18481 printf("\n");
18482 }
18483 }
18484 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018486
Daniel Veillard42595322004-11-08 10:52:06 +000018487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018488}
18489
18490
18491static int
18492test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018494
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018495 int mem_base;
18496 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018497 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018498 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018499 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018500 int n_prefix;
18501 xmlChar * memory; /* preallocated memory */
18502 int n_memory;
18503 int len; /* preallocated memory length */
18504 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018505
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018506 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18507 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18508 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18509 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18510 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018511 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18512 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18513 memory = gen_xmlChar_ptr(n_memory, 2);
18514 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018515
William M. Brackf13f77f2004-11-12 16:03:48 +000018516 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018517 if ((ret_val != NULL) && (ret_val != ncname) &&
18518 (ret_val != prefix) && (ret_val != memory))
18519 xmlFree(ret_val);
18520 ret_val = NULL;
18521 desret_xmlChar_ptr(ret_val);
18522 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018523 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18524 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018525 des_xmlChar_ptr(n_memory, memory, 2);
18526 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018527 xmlResetLastError();
18528 if (mem_base != xmlMemBlocks()) {
18529 printf("Leak of %d blocks found in xmlBuildQName",
18530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018531 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018532 printf(" %d", n_ncname);
18533 printf(" %d", n_prefix);
18534 printf(" %d", n_memory);
18535 printf(" %d", n_len);
18536 printf("\n");
18537 }
18538 }
18539 }
18540 }
18541 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018542 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018543
Daniel Veillard42595322004-11-08 10:52:06 +000018544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018545}
18546
18547
18548static int
18549test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018551
William M. Brack21e4ef22005-01-02 09:53:13 +000018552#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018553 int mem_base;
18554 xmlDocPtr ret_val;
18555 xmlDocPtr doc; /* the document */
18556 int n_doc;
18557 int recursive; /* if not zero do a recursive copy. */
18558 int n_recursive;
18559
18560 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18561 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018563 doc = gen_xmlDocPtr(n_doc, 0);
18564 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018565
18566 ret_val = xmlCopyDoc(doc, recursive);
18567 desret_xmlDocPtr(ret_val);
18568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018569 des_xmlDocPtr(n_doc, doc, 0);
18570 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018571 xmlResetLastError();
18572 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018573 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018575 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018576 printf(" %d", n_doc);
18577 printf(" %d", n_recursive);
18578 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018579 }
18580 }
18581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018582 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018583#endif
18584
Daniel Veillard42595322004-11-08 10:52:06 +000018585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018586}
18587
18588
18589static int
18590test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018592
William M. Brack21e4ef22005-01-02 09:53:13 +000018593#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018594 int mem_base;
18595 xmlDtdPtr ret_val;
18596 xmlDtdPtr dtd; /* the dtd */
18597 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018598
Daniel Veillard27f20102004-11-05 11:50:11 +000018599 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18600 mem_base = xmlMemBlocks();
18601 dtd = gen_xmlDtdPtr(n_dtd, 0);
18602
18603 ret_val = xmlCopyDtd(dtd);
18604 desret_xmlDtdPtr(ret_val);
18605 call_tests++;
18606 des_xmlDtdPtr(n_dtd, dtd, 0);
18607 xmlResetLastError();
18608 if (mem_base != xmlMemBlocks()) {
18609 printf("Leak of %d blocks found in xmlCopyDtd",
18610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018611 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018612 printf(" %d", n_dtd);
18613 printf("\n");
18614 }
18615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018616 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018617#endif
18618
Daniel Veillard42595322004-11-08 10:52:06 +000018619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018620}
18621
18622
18623static int
18624test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018626
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018627 int mem_base;
18628 xmlNsPtr ret_val;
18629 xmlNsPtr cur; /* the namespace */
18630 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018631
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018632 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18633 mem_base = xmlMemBlocks();
18634 cur = gen_xmlNsPtr(n_cur, 0);
18635
18636 ret_val = xmlCopyNamespace(cur);
18637 if (ret_val != NULL) xmlFreeNs(ret_val);
18638 desret_xmlNsPtr(ret_val);
18639 call_tests++;
18640 des_xmlNsPtr(n_cur, cur, 0);
18641 xmlResetLastError();
18642 if (mem_base != xmlMemBlocks()) {
18643 printf("Leak of %d blocks found in xmlCopyNamespace",
18644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018645 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018646 printf(" %d", n_cur);
18647 printf("\n");
18648 }
18649 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018651
Daniel Veillard42595322004-11-08 10:52:06 +000018652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018653}
18654
18655
18656static int
18657test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018659
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018660 int mem_base;
18661 xmlNsPtr ret_val;
18662 xmlNsPtr cur; /* the first namespace */
18663 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018664
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018665 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18666 mem_base = xmlMemBlocks();
18667 cur = gen_xmlNsPtr(n_cur, 0);
18668
18669 ret_val = xmlCopyNamespaceList(cur);
18670 if (ret_val != NULL) xmlFreeNsList(ret_val);
18671 desret_xmlNsPtr(ret_val);
18672 call_tests++;
18673 des_xmlNsPtr(n_cur, cur, 0);
18674 xmlResetLastError();
18675 if (mem_base != xmlMemBlocks()) {
18676 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018678 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018679 printf(" %d", n_cur);
18680 printf("\n");
18681 }
18682 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018683 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018684
Daniel Veillard42595322004-11-08 10:52:06 +000018685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018686}
18687
18688
18689static int
18690test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018692
Daniel Veillardce682bc2004-11-05 17:22:25 +000018693 int mem_base;
18694 xmlNodePtr ret_val;
18695 xmlNodePtr node; /* the node */
18696 int n_node;
18697 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18698 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018699
Daniel Veillardce682bc2004-11-05 17:22:25 +000018700 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18701 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18702 mem_base = xmlMemBlocks();
18703 node = gen_const_xmlNodePtr(n_node, 0);
18704 extended = gen_int(n_extended, 1);
18705
William M. Brackf13f77f2004-11-12 16:03:48 +000018706 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018707 desret_xmlNodePtr(ret_val);
18708 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018709 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018710 des_int(n_extended, extended, 1);
18711 xmlResetLastError();
18712 if (mem_base != xmlMemBlocks()) {
18713 printf("Leak of %d blocks found in xmlCopyNode",
18714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018715 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018716 printf(" %d", n_node);
18717 printf(" %d", n_extended);
18718 printf("\n");
18719 }
18720 }
18721 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018723
Daniel Veillard42595322004-11-08 10:52:06 +000018724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018725}
18726
18727
18728static int
18729test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018731
Daniel Veillardce682bc2004-11-05 17:22:25 +000018732 int mem_base;
18733 xmlNodePtr ret_val;
18734 xmlNodePtr node; /* the first node in the list. */
18735 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018736
Daniel Veillardce682bc2004-11-05 17:22:25 +000018737 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18738 mem_base = xmlMemBlocks();
18739 node = gen_const_xmlNodePtr(n_node, 0);
18740
William M. Brackf13f77f2004-11-12 16:03:48 +000018741 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018742 desret_xmlNodePtr(ret_val);
18743 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018744 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018745 xmlResetLastError();
18746 if (mem_base != xmlMemBlocks()) {
18747 printf("Leak of %d blocks found in xmlCopyNodeList",
18748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018749 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018750 printf(" %d", n_node);
18751 printf("\n");
18752 }
18753 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018754 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018755
Daniel Veillard42595322004-11-08 10:52:06 +000018756 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018757}
18758
18759
18760static int
18761test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018763
Daniel Veillard57b25162004-11-06 14:50:18 +000018764 int mem_base;
18765 xmlAttrPtr ret_val;
18766 xmlNodePtr target; /* the element where the attribute will be grafted */
18767 int n_target;
18768 xmlAttrPtr cur; /* the attribute */
18769 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018770
Daniel Veillard57b25162004-11-06 14:50:18 +000018771 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18772 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18773 mem_base = xmlMemBlocks();
18774 target = gen_xmlNodePtr(n_target, 0);
18775 cur = gen_xmlAttrPtr(n_cur, 1);
18776
18777 ret_val = xmlCopyProp(target, cur);
18778 desret_xmlAttrPtr(ret_val);
18779 call_tests++;
18780 des_xmlNodePtr(n_target, target, 0);
18781 des_xmlAttrPtr(n_cur, cur, 1);
18782 xmlResetLastError();
18783 if (mem_base != xmlMemBlocks()) {
18784 printf("Leak of %d blocks found in xmlCopyProp",
18785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018786 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018787 printf(" %d", n_target);
18788 printf(" %d", n_cur);
18789 printf("\n");
18790 }
18791 }
18792 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018793 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018794
Daniel Veillard42595322004-11-08 10:52:06 +000018795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018796}
18797
18798
18799static int
18800test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018802
Daniel Veillard57b25162004-11-06 14:50:18 +000018803 int mem_base;
18804 xmlAttrPtr ret_val;
18805 xmlNodePtr target; /* the element where the attributes will be grafted */
18806 int n_target;
18807 xmlAttrPtr cur; /* the first attribute */
18808 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018809
Daniel Veillard57b25162004-11-06 14:50:18 +000018810 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18811 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18812 mem_base = xmlMemBlocks();
18813 target = gen_xmlNodePtr(n_target, 0);
18814 cur = gen_xmlAttrPtr(n_cur, 1);
18815
18816 ret_val = xmlCopyPropList(target, cur);
18817 desret_xmlAttrPtr(ret_val);
18818 call_tests++;
18819 des_xmlNodePtr(n_target, target, 0);
18820 des_xmlAttrPtr(n_cur, cur, 1);
18821 xmlResetLastError();
18822 if (mem_base != xmlMemBlocks()) {
18823 printf("Leak of %d blocks found in xmlCopyPropList",
18824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018825 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018826 printf(" %d", n_target);
18827 printf(" %d", n_cur);
18828 printf("\n");
18829 }
18830 }
18831 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018833
Daniel Veillard42595322004-11-08 10:52:06 +000018834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018835}
18836
18837
18838static int
18839test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018841
Daniel Veillard34099b42004-11-04 17:34:35 +000018842 int mem_base;
18843 xmlDtdPtr ret_val;
18844 xmlDocPtr doc; /* the document pointer */
18845 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018846 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018847 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018848 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018849 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018850 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018851 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018852
Daniel Veillard34099b42004-11-04 17:34:35 +000018853 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18854 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18855 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18856 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18857 mem_base = xmlMemBlocks();
18858 doc = gen_xmlDocPtr(n_doc, 0);
18859 name = gen_const_xmlChar_ptr(n_name, 1);
18860 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18861 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18862
William M. Brackf13f77f2004-11-12 16:03:48 +000018863 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018864 desret_xmlDtdPtr(ret_val);
18865 call_tests++;
18866 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018867 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18868 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18869 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018870 xmlResetLastError();
18871 if (mem_base != xmlMemBlocks()) {
18872 printf("Leak of %d blocks found in xmlCreateIntSubset",
18873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018874 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018875 printf(" %d", n_doc);
18876 printf(" %d", n_name);
18877 printf(" %d", n_ExternalID);
18878 printf(" %d", n_SystemID);
18879 printf("\n");
18880 }
18881 }
18882 }
18883 }
18884 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018885 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018886
Daniel Veillard42595322004-11-08 10:52:06 +000018887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018888}
18889
18890
Daniel Veillard95175012005-07-03 16:09:51 +000018891#define gen_nb_xmlDOMWrapCtxtPtr 1
18892static xmlDOMWrapCtxtPtr gen_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18893 return(NULL);
18894}
18895static void des_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, xmlDOMWrapCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18896}
18897
18898static int
18899test_xmlDOMWrapAdoptNode(void) {
18900 int test_ret = 0;
18901
18902 int mem_base;
18903 int ret_val;
18904 xmlDOMWrapCtxtPtr ctxt; /* the optional context for custom processing */
18905 int n_ctxt;
18906 xmlDocPtr sourceDoc; /* the optional sourceDoc */
18907 int n_sourceDoc;
18908 xmlNodePtr node; /* the node to start with */
18909 int n_node;
18910 xmlDocPtr destDoc; /* the destination doc */
18911 int n_destDoc;
18912 xmlNodePtr destParent; /* the optional new parent of @node in @destDoc */
18913 int n_destParent;
18914 int options; /* option flags */
18915 int n_options;
18916
18917 for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
18918 for (n_sourceDoc = 0;n_sourceDoc < gen_nb_xmlDocPtr;n_sourceDoc++) {
18919 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
18920 for (n_destDoc = 0;n_destDoc < gen_nb_xmlDocPtr;n_destDoc++) {
18921 for (n_destParent = 0;n_destParent < gen_nb_xmlNodePtr;n_destParent++) {
18922 for (n_options = 0;n_options < gen_nb_int;n_options++) {
18923 mem_base = xmlMemBlocks();
18924 ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
18925 sourceDoc = gen_xmlDocPtr(n_sourceDoc, 1);
18926 node = gen_xmlNodePtr(n_node, 2);
18927 destDoc = gen_xmlDocPtr(n_destDoc, 3);
18928 destParent = gen_xmlNodePtr(n_destParent, 4);
18929 options = gen_int(n_options, 5);
18930
18931 ret_val = xmlDOMWrapAdoptNode(ctxt, sourceDoc, node, destDoc, destParent, options);
Daniel Veillard7e33dba2005-07-03 22:40:26 +000018932 if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;}
Daniel Veillard95175012005-07-03 16:09:51 +000018933 desret_int(ret_val);
18934 call_tests++;
18935 des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
18936 des_xmlDocPtr(n_sourceDoc, sourceDoc, 1);
18937 des_xmlNodePtr(n_node, node, 2);
18938 des_xmlDocPtr(n_destDoc, destDoc, 3);
18939 des_xmlNodePtr(n_destParent, destParent, 4);
18940 des_int(n_options, options, 5);
18941 xmlResetLastError();
18942 if (mem_base != xmlMemBlocks()) {
18943 printf("Leak of %d blocks found in xmlDOMWrapAdoptNode",
18944 xmlMemBlocks() - mem_base);
18945 test_ret++;
18946 printf(" %d", n_ctxt);
18947 printf(" %d", n_sourceDoc);
18948 printf(" %d", n_node);
18949 printf(" %d", n_destDoc);
18950 printf(" %d", n_destParent);
18951 printf(" %d", n_options);
18952 printf("\n");
18953 }
18954 }
18955 }
18956 }
18957 }
18958 }
18959 }
18960 function_tests++;
18961
18962 return(test_ret);
18963}
18964
18965
18966static int
18967test_xmlDOMWrapNewCtxt(void) {
18968 int test_ret = 0;
18969
18970
18971 /* missing type support */
18972 return(test_ret);
18973}
18974
18975
18976static int
18977test_xmlDOMWrapReconcileNamespaces(void) {
18978 int test_ret = 0;
18979
18980 int mem_base;
18981 int ret_val;
Daniel Veillard304e78c2005-07-03 16:19:41 +000018982 xmlDOMWrapCtxtPtr ctxt; /* DOM wrapper context, unused at the moment */
Daniel Veillard95175012005-07-03 16:09:51 +000018983 int n_ctxt;
18984 xmlNodePtr elem; /* the element-node */
18985 int n_elem;
18986 int options; /* option flags */
18987 int n_options;
18988
18989 for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
18990 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
18991 for (n_options = 0;n_options < gen_nb_int;n_options++) {
18992 mem_base = xmlMemBlocks();
18993 ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
18994 elem = gen_xmlNodePtr(n_elem, 1);
18995 options = gen_int(n_options, 2);
18996
18997 ret_val = xmlDOMWrapReconcileNamespaces(ctxt, elem, options);
18998 desret_int(ret_val);
18999 call_tests++;
19000 des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19001 des_xmlNodePtr(n_elem, elem, 1);
19002 des_int(n_options, options, 2);
19003 xmlResetLastError();
19004 if (mem_base != xmlMemBlocks()) {
19005 printf("Leak of %d blocks found in xmlDOMWrapReconcileNamespaces",
19006 xmlMemBlocks() - mem_base);
19007 test_ret++;
19008 printf(" %d", n_ctxt);
19009 printf(" %d", n_elem);
19010 printf(" %d", n_options);
19011 printf("\n");
19012 }
19013 }
19014 }
19015 }
19016 function_tests++;
19017
19018 return(test_ret);
19019}
19020
19021
19022static int
19023test_xmlDOMWrapRemoveNode(void) {
19024 int test_ret = 0;
19025
19026 int mem_base;
19027 int ret_val;
Daniel Veillard304e78c2005-07-03 16:19:41 +000019028 xmlDOMWrapCtxtPtr ctxt; /* a DOM wrapper context */
Daniel Veillard95175012005-07-03 16:09:51 +000019029 int n_ctxt;
19030 xmlDocPtr doc; /* the doc */
19031 int n_doc;
19032 xmlNodePtr node; /* the node to be removed. */
19033 int n_node;
Daniel Veillard304e78c2005-07-03 16:19:41 +000019034 int options; /* set of options, unused at the moment */
Daniel Veillard95175012005-07-03 16:09:51 +000019035 int n_options;
19036
19037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
19038 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19039 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19040 for (n_options = 0;n_options < gen_nb_int;n_options++) {
19041 mem_base = xmlMemBlocks();
19042 ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
19043 doc = gen_xmlDocPtr(n_doc, 1);
19044 node = gen_xmlNodePtr(n_node, 2);
19045 options = gen_int(n_options, 3);
19046
19047 ret_val = xmlDOMWrapRemoveNode(ctxt, doc, node, options);
19048 desret_int(ret_val);
19049 call_tests++;
19050 des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19051 des_xmlDocPtr(n_doc, doc, 1);
19052 des_xmlNodePtr(n_node, node, 2);
19053 des_int(n_options, options, 3);
19054 xmlResetLastError();
19055 if (mem_base != xmlMemBlocks()) {
19056 printf("Leak of %d blocks found in xmlDOMWrapRemoveNode",
19057 xmlMemBlocks() - mem_base);
19058 test_ret++;
19059 printf(" %d", n_ctxt);
19060 printf(" %d", n_doc);
19061 printf(" %d", n_node);
19062 printf(" %d", n_options);
19063 printf("\n");
19064 }
19065 }
19066 }
19067 }
19068 }
19069 function_tests++;
19070
19071 return(test_ret);
19072}
19073
19074
Daniel Veillardd93f6252004-11-02 15:53:51 +000019075static int
19076test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019078
Daniel Veillardce682bc2004-11-05 17:22:25 +000019079 int mem_base;
19080 xmlNodePtr ret_val;
19081 xmlNodePtr node; /* the node */
19082 int n_node;
19083 xmlDocPtr doc; /* the document */
19084 int n_doc;
19085 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
19086 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019087
Daniel Veillardce682bc2004-11-05 17:22:25 +000019088 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
19089 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19090 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
19091 mem_base = xmlMemBlocks();
19092 node = gen_const_xmlNodePtr(n_node, 0);
19093 doc = gen_xmlDocPtr(n_doc, 1);
19094 extended = gen_int(n_extended, 2);
19095
William M. Brackf13f77f2004-11-12 16:03:48 +000019096 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019097 desret_xmlNodePtr(ret_val);
19098 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019099 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019100 des_xmlDocPtr(n_doc, doc, 1);
19101 des_int(n_extended, extended, 2);
19102 xmlResetLastError();
19103 if (mem_base != xmlMemBlocks()) {
19104 printf("Leak of %d blocks found in xmlDocCopyNode",
19105 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019106 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019107 printf(" %d", n_node);
19108 printf(" %d", n_doc);
19109 printf(" %d", n_extended);
19110 printf("\n");
19111 }
19112 }
19113 }
19114 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000019115 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019116
Daniel Veillard42595322004-11-08 10:52:06 +000019117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019118}
19119
19120
19121static int
19122test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019124
Daniel Veillardce682bc2004-11-05 17:22:25 +000019125 int mem_base;
19126 xmlNodePtr ret_val;
19127 xmlDocPtr doc; /* the target document */
19128 int n_doc;
19129 xmlNodePtr node; /* the first node in the list. */
19130 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131
Daniel Veillardce682bc2004-11-05 17:22:25 +000019132 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19133 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
19134 mem_base = xmlMemBlocks();
19135 doc = gen_xmlDocPtr(n_doc, 0);
19136 node = gen_const_xmlNodePtr(n_node, 1);
19137
William M. Brackf13f77f2004-11-12 16:03:48 +000019138 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019139 desret_xmlNodePtr(ret_val);
19140 call_tests++;
19141 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019142 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000019143 xmlResetLastError();
19144 if (mem_base != xmlMemBlocks()) {
19145 printf("Leak of %d blocks found in xmlDocCopyNodeList",
19146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019147 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019148 printf(" %d", n_doc);
19149 printf(" %d", n_node);
19150 printf("\n");
19151 }
19152 }
19153 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000019154 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019155
Daniel Veillard42595322004-11-08 10:52:06 +000019156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019157}
19158
19159
19160static int
19161test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019163
William M. Brack21e4ef22005-01-02 09:53:13 +000019164#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019165 int mem_base;
19166 int ret_val;
19167 FILE * f; /* the FILE* */
19168 int n_f;
19169 xmlDocPtr cur; /* the document */
19170 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019171
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019172 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19173 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19174 mem_base = xmlMemBlocks();
19175 f = gen_FILE_ptr(n_f, 0);
19176 cur = gen_xmlDocPtr(n_cur, 1);
19177
19178 ret_val = xmlDocDump(f, cur);
19179 desret_int(ret_val);
19180 call_tests++;
19181 des_FILE_ptr(n_f, f, 0);
19182 des_xmlDocPtr(n_cur, cur, 1);
19183 xmlResetLastError();
19184 if (mem_base != xmlMemBlocks()) {
19185 printf("Leak of %d blocks found in xmlDocDump",
19186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019187 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019188 printf(" %d", n_f);
19189 printf(" %d", n_cur);
19190 printf("\n");
19191 }
19192 }
19193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019194 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019195#endif
19196
Daniel Veillard42595322004-11-08 10:52:06 +000019197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019198}
19199
19200
19201static int
19202test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019204
William M. Brack21e4ef22005-01-02 09:53:13 +000019205#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019206 int mem_base;
19207 xmlDocPtr cur; /* the document */
19208 int n_cur;
19209 xmlChar ** mem; /* OUT: the memory pointer */
19210 int n_mem;
19211 int * size; /* OUT: the memory length */
19212 int n_size;
19213 int format; /* should formatting spaces been added */
19214 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019215
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019216 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19217 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19218 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19219 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19220 mem_base = xmlMemBlocks();
19221 cur = gen_xmlDocPtr(n_cur, 0);
19222 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19223 size = gen_int_ptr(n_size, 2);
19224 format = gen_int(n_format, 3);
19225
19226 xmlDocDumpFormatMemory(cur, mem, size, format);
19227 call_tests++;
19228 des_xmlDocPtr(n_cur, cur, 0);
19229 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19230 des_int_ptr(n_size, size, 2);
19231 des_int(n_format, format, 3);
19232 xmlResetLastError();
19233 if (mem_base != xmlMemBlocks()) {
19234 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019236 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019237 printf(" %d", n_cur);
19238 printf(" %d", n_mem);
19239 printf(" %d", n_size);
19240 printf(" %d", n_format);
19241 printf("\n");
19242 }
19243 }
19244 }
19245 }
19246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019247 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019248#endif
19249
Daniel Veillard42595322004-11-08 10:52:06 +000019250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019251}
19252
19253
19254static int
19255test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019257
William M. Brack21e4ef22005-01-02 09:53:13 +000019258#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019259 int mem_base;
19260 xmlDocPtr out_doc; /* Document to generate XML text from */
19261 int n_out_doc;
19262 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19263 int n_doc_txt_ptr;
19264 int * doc_txt_len; /* Length of the generated XML text */
19265 int n_doc_txt_len;
19266 char * txt_encoding; /* Character encoding to use when generating XML text */
19267 int n_txt_encoding;
19268 int format; /* should formatting spaces been added */
19269 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019270
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019271 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19272 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19273 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19274 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19275 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19276 mem_base = xmlMemBlocks();
19277 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19278 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19279 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19280 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19281 format = gen_int(n_format, 4);
19282
William M. Brackf13f77f2004-11-12 16:03:48 +000019283 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019284 call_tests++;
19285 des_xmlDocPtr(n_out_doc, out_doc, 0);
19286 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19287 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019288 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019289 des_int(n_format, format, 4);
19290 xmlResetLastError();
19291 if (mem_base != xmlMemBlocks()) {
19292 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019294 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019295 printf(" %d", n_out_doc);
19296 printf(" %d", n_doc_txt_ptr);
19297 printf(" %d", n_doc_txt_len);
19298 printf(" %d", n_txt_encoding);
19299 printf(" %d", n_format);
19300 printf("\n");
19301 }
19302 }
19303 }
19304 }
19305 }
19306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019307 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019308#endif
19309
Daniel Veillard42595322004-11-08 10:52:06 +000019310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019311}
19312
19313
19314static int
19315test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019317
William M. Brack21e4ef22005-01-02 09:53:13 +000019318#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019319 int mem_base;
19320 xmlDocPtr cur; /* the document */
19321 int n_cur;
19322 xmlChar ** mem; /* OUT: the memory pointer */
19323 int n_mem;
19324 int * size; /* OUT: the memory length */
19325 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019326
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019327 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19328 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19329 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19330 mem_base = xmlMemBlocks();
19331 cur = gen_xmlDocPtr(n_cur, 0);
19332 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19333 size = gen_int_ptr(n_size, 2);
19334
19335 xmlDocDumpMemory(cur, mem, size);
19336 call_tests++;
19337 des_xmlDocPtr(n_cur, cur, 0);
19338 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19339 des_int_ptr(n_size, size, 2);
19340 xmlResetLastError();
19341 if (mem_base != xmlMemBlocks()) {
19342 printf("Leak of %d blocks found in xmlDocDumpMemory",
19343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019344 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019345 printf(" %d", n_cur);
19346 printf(" %d", n_mem);
19347 printf(" %d", n_size);
19348 printf("\n");
19349 }
19350 }
19351 }
19352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019353 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019354#endif
19355
Daniel Veillard42595322004-11-08 10:52:06 +000019356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019357}
19358
19359
19360static int
19361test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019363
William M. Brack21e4ef22005-01-02 09:53:13 +000019364#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019365 int mem_base;
19366 xmlDocPtr out_doc; /* Document to generate XML text from */
19367 int n_out_doc;
19368 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19369 int n_doc_txt_ptr;
19370 int * doc_txt_len; /* Length of the generated XML text */
19371 int n_doc_txt_len;
19372 char * txt_encoding; /* Character encoding to use when generating XML text */
19373 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019374
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019375 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19376 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19377 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19378 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19379 mem_base = xmlMemBlocks();
19380 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19381 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19382 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19383 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19384
William M. Brackf13f77f2004-11-12 16:03:48 +000019385 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019386 call_tests++;
19387 des_xmlDocPtr(n_out_doc, out_doc, 0);
19388 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19389 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019390 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019391 xmlResetLastError();
19392 if (mem_base != xmlMemBlocks()) {
19393 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019395 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019396 printf(" %d", n_out_doc);
19397 printf(" %d", n_doc_txt_ptr);
19398 printf(" %d", n_doc_txt_len);
19399 printf(" %d", n_txt_encoding);
19400 printf("\n");
19401 }
19402 }
19403 }
19404 }
19405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019406 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019407#endif
19408
Daniel Veillard42595322004-11-08 10:52:06 +000019409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019410}
19411
19412
19413static int
19414test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416
William M. Brack21e4ef22005-01-02 09:53:13 +000019417#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019418 int mem_base;
19419 int ret_val;
19420 FILE * f; /* the FILE* */
19421 int n_f;
19422 xmlDocPtr cur; /* the document */
19423 int n_cur;
19424 int format; /* should formatting spaces been added */
19425 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019426
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019427 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19428 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19429 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19430 mem_base = xmlMemBlocks();
19431 f = gen_FILE_ptr(n_f, 0);
19432 cur = gen_xmlDocPtr(n_cur, 1);
19433 format = gen_int(n_format, 2);
19434
19435 ret_val = xmlDocFormatDump(f, cur, format);
19436 desret_int(ret_val);
19437 call_tests++;
19438 des_FILE_ptr(n_f, f, 0);
19439 des_xmlDocPtr(n_cur, cur, 1);
19440 des_int(n_format, format, 2);
19441 xmlResetLastError();
19442 if (mem_base != xmlMemBlocks()) {
19443 printf("Leak of %d blocks found in xmlDocFormatDump",
19444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019445 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019446 printf(" %d", n_f);
19447 printf(" %d", n_cur);
19448 printf(" %d", n_format);
19449 printf("\n");
19450 }
19451 }
19452 }
19453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019454 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019455#endif
19456
Daniel Veillard42595322004-11-08 10:52:06 +000019457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458}
19459
19460
19461static int
19462test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019464
19465 int mem_base;
19466 xmlNodePtr ret_val;
19467 xmlDocPtr doc; /* the document */
19468 int n_doc;
19469
19470 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019472 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019473
19474 ret_val = xmlDocGetRootElement(doc);
19475 desret_xmlNodePtr(ret_val);
19476 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019477 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019478 xmlResetLastError();
19479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019480 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019483 printf(" %d", n_doc);
19484 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019485 }
19486 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019488
Daniel Veillard42595322004-11-08 10:52:06 +000019489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019490}
19491
19492
19493static int
19494test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019496
William M. Brack21e4ef22005-01-02 09:53:13 +000019497#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019498 int mem_base;
19499 xmlNodePtr ret_val;
19500 xmlDocPtr doc; /* the document */
19501 int n_doc;
19502 xmlNodePtr root; /* the new document root element */
19503 int n_root;
19504
19505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019506 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019508 doc = gen_xmlDocPtr(n_doc, 0);
19509 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019510
19511 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019512 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019513 desret_xmlNodePtr(ret_val);
19514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019515 des_xmlDocPtr(n_doc, doc, 0);
19516 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019517 xmlResetLastError();
19518 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019519 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019521 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019522 printf(" %d", n_doc);
19523 printf(" %d", n_root);
19524 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019525 }
19526 }
19527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019528 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019529#endif
19530
Daniel Veillard42595322004-11-08 10:52:06 +000019531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019532}
19533
19534
19535static int
19536test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019538
William M. Brack21e4ef22005-01-02 09:53:13 +000019539#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019540 int mem_base;
19541 FILE * f; /* the FILE * for the output */
19542 int n_f;
19543 xmlDocPtr doc; /* the document */
19544 int n_doc;
19545 xmlNodePtr cur; /* the current node */
19546 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019547
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019548 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19549 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19550 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19551 mem_base = xmlMemBlocks();
19552 f = gen_FILE_ptr(n_f, 0);
19553 doc = gen_xmlDocPtr(n_doc, 1);
19554 cur = gen_xmlNodePtr(n_cur, 2);
19555
19556 xmlElemDump(f, doc, cur);
19557 call_tests++;
19558 des_FILE_ptr(n_f, f, 0);
19559 des_xmlDocPtr(n_doc, doc, 1);
19560 des_xmlNodePtr(n_cur, cur, 2);
19561 xmlResetLastError();
19562 if (mem_base != xmlMemBlocks()) {
19563 printf("Leak of %d blocks found in xmlElemDump",
19564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019565 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019566 printf(" %d", n_f);
19567 printf(" %d", n_doc);
19568 printf(" %d", n_cur);
19569 printf("\n");
19570 }
19571 }
19572 }
19573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019574 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019575#endif
19576
Daniel Veillard42595322004-11-08 10:52:06 +000019577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019578}
19579
19580
19581static int
19582test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019584
Daniel Veillard57b25162004-11-06 14:50:18 +000019585 int mem_base;
19586 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587
Daniel Veillard57b25162004-11-06 14:50:18 +000019588 mem_base = xmlMemBlocks();
19589
19590 ret_val = xmlGetBufferAllocationScheme();
19591 desret_xmlBufferAllocationScheme(ret_val);
19592 call_tests++;
19593 xmlResetLastError();
19594 if (mem_base != xmlMemBlocks()) {
19595 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019597 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019598 printf("\n");
19599 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019601
Daniel Veillard42595322004-11-08 10:52:06 +000019602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019603}
19604
19605
19606static int
19607test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019609
19610 int mem_base;
19611 int ret_val;
19612
19613 mem_base = xmlMemBlocks();
19614
19615 ret_val = xmlGetCompressMode();
19616 desret_int(ret_val);
19617 call_tests++;
19618 xmlResetLastError();
19619 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019620 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019622 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019623 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019624 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019625 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019626
Daniel Veillard42595322004-11-08 10:52:06 +000019627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019628}
19629
19630
19631static int
19632test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019634
19635 int mem_base;
19636 int ret_val;
19637 xmlDocPtr doc; /* the document */
19638 int n_doc;
19639
19640 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19641 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019642 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019643
19644 ret_val = xmlGetDocCompressMode(doc);
19645 desret_int(ret_val);
19646 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019647 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019648 xmlResetLastError();
19649 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019650 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019652 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019653 printf(" %d", n_doc);
19654 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019655 }
19656 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019657 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019658
Daniel Veillard42595322004-11-08 10:52:06 +000019659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019660}
19661
19662
19663static int
19664test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019666
Daniel Veillard34099b42004-11-04 17:34:35 +000019667 int mem_base;
19668 xmlDtdPtr ret_val;
19669 xmlDocPtr doc; /* the document pointer */
19670 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019671
Daniel Veillard34099b42004-11-04 17:34:35 +000019672 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19673 mem_base = xmlMemBlocks();
19674 doc = gen_xmlDocPtr(n_doc, 0);
19675
19676 ret_val = xmlGetIntSubset(doc);
19677 desret_xmlDtdPtr(ret_val);
19678 call_tests++;
19679 des_xmlDocPtr(n_doc, doc, 0);
19680 xmlResetLastError();
19681 if (mem_base != xmlMemBlocks()) {
19682 printf("Leak of %d blocks found in xmlGetIntSubset",
19683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019684 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019685 printf(" %d", n_doc);
19686 printf("\n");
19687 }
19688 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019689 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019690
Daniel Veillard42595322004-11-08 10:52:06 +000019691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692}
19693
19694
19695static int
19696test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019698
19699 int mem_base;
19700 xmlNodePtr ret_val;
19701 xmlNodePtr parent; /* the parent node */
19702 int n_parent;
19703
19704 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019706 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019707
19708 ret_val = xmlGetLastChild(parent);
19709 desret_xmlNodePtr(ret_val);
19710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019711 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019712 xmlResetLastError();
19713 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019714 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019716 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019717 printf(" %d", n_parent);
19718 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019719 }
19720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019722
Daniel Veillard42595322004-11-08 10:52:06 +000019723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019724}
19725
19726
19727static int
19728test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019730
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019731 int mem_base;
19732 long ret_val;
19733 xmlNodePtr node; /* valid node */
19734 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019735
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019736 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19737 mem_base = xmlMemBlocks();
19738 node = gen_xmlNodePtr(n_node, 0);
19739
19740 ret_val = xmlGetLineNo(node);
19741 desret_long(ret_val);
19742 call_tests++;
19743 des_xmlNodePtr(n_node, node, 0);
19744 xmlResetLastError();
19745 if (mem_base != xmlMemBlocks()) {
19746 printf("Leak of %d blocks found in xmlGetLineNo",
19747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019748 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019749 printf(" %d", n_node);
19750 printf("\n");
19751 }
19752 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019754
Daniel Veillard42595322004-11-08 10:52:06 +000019755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019756}
19757
19758
19759static int
19760test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019762
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019763 int mem_base;
19764 xmlChar * ret_val;
19765 xmlNodePtr node; /* the node */
19766 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019767 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019768 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019769
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019770 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19771 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019773 node = gen_xmlNodePtr(n_node, 0);
19774 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019775
William M. Brackf13f77f2004-11-12 16:03:48 +000019776 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019777 desret_xmlChar_ptr(ret_val);
19778 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019779 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019780 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019781 xmlResetLastError();
19782 if (mem_base != xmlMemBlocks()) {
19783 printf("Leak of %d blocks found in xmlGetNoNsProp",
19784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019785 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019786 printf(" %d", n_node);
19787 printf(" %d", n_name);
19788 printf("\n");
19789 }
19790 }
19791 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019793
Daniel Veillard42595322004-11-08 10:52:06 +000019794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019795}
19796
19797
19798static int
19799test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019801
William M. Brack21e4ef22005-01-02 09:53:13 +000019802#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019803 int mem_base;
19804 xmlChar * ret_val;
19805 xmlNodePtr node; /* a node */
19806 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019807
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019808 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19809 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019810 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019811
19812 ret_val = xmlGetNodePath(node);
19813 desret_xmlChar_ptr(ret_val);
19814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019815 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019816 xmlResetLastError();
19817 if (mem_base != xmlMemBlocks()) {
19818 printf("Leak of %d blocks found in xmlGetNodePath",
19819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019820 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019821 printf(" %d", n_node);
19822 printf("\n");
19823 }
19824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019825 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019826#endif
19827
Daniel Veillard42595322004-11-08 10:52:06 +000019828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019829}
19830
19831
19832static int
19833test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019835
19836
19837 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019839}
19840
19841
19842static int
19843test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019845
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019846 int mem_base;
19847 xmlChar * ret_val;
19848 xmlNodePtr node; /* the node */
19849 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019850 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019851 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019852 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019853 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019854
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019855 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19857 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019859 node = gen_xmlNodePtr(n_node, 0);
19860 name = gen_const_xmlChar_ptr(n_name, 1);
19861 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019862
William M. Brackf13f77f2004-11-12 16:03:48 +000019863 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019864 desret_xmlChar_ptr(ret_val);
19865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019866 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019867 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19868 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019869 xmlResetLastError();
19870 if (mem_base != xmlMemBlocks()) {
19871 printf("Leak of %d blocks found in xmlGetNsProp",
19872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019873 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019874 printf(" %d", n_node);
19875 printf(" %d", n_name);
19876 printf(" %d", n_nameSpace);
19877 printf("\n");
19878 }
19879 }
19880 }
19881 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019882 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019883
Daniel Veillard42595322004-11-08 10:52:06 +000019884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019885}
19886
19887
19888static int
19889test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019891
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019892 int mem_base;
19893 xmlChar * ret_val;
19894 xmlNodePtr node; /* the node */
19895 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019896 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019897 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019899 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19900 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19901 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019902 node = gen_xmlNodePtr(n_node, 0);
19903 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019904
William M. Brackf13f77f2004-11-12 16:03:48 +000019905 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019906 desret_xmlChar_ptr(ret_val);
19907 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019908 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019909 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019910 xmlResetLastError();
19911 if (mem_base != xmlMemBlocks()) {
19912 printf("Leak of %d blocks found in xmlGetProp",
19913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019914 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019915 printf(" %d", n_node);
19916 printf(" %d", n_name);
19917 printf("\n");
19918 }
19919 }
19920 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019921 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019922
Daniel Veillard42595322004-11-08 10:52:06 +000019923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019924}
19925
19926
19927static int
19928test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930
Daniel Veillard57b25162004-11-06 14:50:18 +000019931 int mem_base;
19932 xmlAttrPtr ret_val;
19933 xmlNodePtr node; /* the node */
19934 int n_node;
19935 xmlChar * name; /* the attribute name */
19936 int n_name;
19937 xmlChar * nameSpace; /* the URI of the namespace */
19938 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019939
Daniel Veillard57b25162004-11-06 14:50:18 +000019940 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19941 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19942 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19943 mem_base = xmlMemBlocks();
19944 node = gen_xmlNodePtr(n_node, 0);
19945 name = gen_const_xmlChar_ptr(n_name, 1);
19946 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19947
William M. Brackf13f77f2004-11-12 16:03:48 +000019948 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019949 desret_xmlAttrPtr(ret_val);
19950 call_tests++;
19951 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019952 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19953 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019954 xmlResetLastError();
19955 if (mem_base != xmlMemBlocks()) {
19956 printf("Leak of %d blocks found in xmlHasNsProp",
19957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019958 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019959 printf(" %d", n_node);
19960 printf(" %d", n_name);
19961 printf(" %d", n_nameSpace);
19962 printf("\n");
19963 }
19964 }
19965 }
19966 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019967 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019968
Daniel Veillard42595322004-11-08 10:52:06 +000019969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019970}
19971
19972
19973static int
19974test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019976
Daniel Veillard57b25162004-11-06 14:50:18 +000019977 int mem_base;
19978 xmlAttrPtr ret_val;
19979 xmlNodePtr node; /* the node */
19980 int n_node;
19981 xmlChar * name; /* the attribute name */
19982 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019983
Daniel Veillard57b25162004-11-06 14:50:18 +000019984 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19985 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19986 mem_base = xmlMemBlocks();
19987 node = gen_xmlNodePtr(n_node, 0);
19988 name = gen_const_xmlChar_ptr(n_name, 1);
19989
William M. Brackf13f77f2004-11-12 16:03:48 +000019990 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019991 desret_xmlAttrPtr(ret_val);
19992 call_tests++;
19993 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019994 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019995 xmlResetLastError();
19996 if (mem_base != xmlMemBlocks()) {
19997 printf("Leak of %d blocks found in xmlHasProp",
19998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019999 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020000 printf(" %d", n_node);
20001 printf(" %d", n_name);
20002 printf("\n");
20003 }
20004 }
20005 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020006 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020007
Daniel Veillard42595322004-11-08 10:52:06 +000020008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020009}
20010
20011
20012static int
20013test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020015
20016 int mem_base;
20017 int ret_val;
20018 xmlNodePtr node; /* the node */
20019 int n_node;
20020
20021 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20022 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020023 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020024
20025 ret_val = xmlIsBlankNode(node);
20026 desret_int(ret_val);
20027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020028 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020029 xmlResetLastError();
20030 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020031 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020033 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020034 printf(" %d", n_node);
20035 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020036 }
20037 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020039
Daniel Veillard42595322004-11-08 10:52:06 +000020040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020041}
20042
20043
20044static int
20045test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020047
20048 int mem_base;
20049 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020050 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020051 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020052 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020053 int n_publicID;
20054
20055 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
20056 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
20057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020058 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
20059 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020060
William M. Brackf13f77f2004-11-12 16:03:48 +000020061 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020062 desret_int(ret_val);
20063 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020064 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
20065 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020066 xmlResetLastError();
20067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020068 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020071 printf(" %d", n_systemID);
20072 printf(" %d", n_publicID);
20073 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020074 }
20075 }
20076 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020078
Daniel Veillard42595322004-11-08 10:52:06 +000020079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020080}
20081
20082
20083static int
20084test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020086
20087 int mem_base;
20088 xmlNodePtr ret_val;
20089 xmlDocPtr doc; /* the document */
20090 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020091 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092 int n_content;
20093 int len; /* the length of the block */
20094 int n_len;
20095
20096 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20097 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20098 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020100 doc = gen_xmlDocPtr(n_doc, 0);
20101 content = gen_const_xmlChar_ptr(n_content, 1);
20102 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020103
William M. Brackf13f77f2004-11-12 16:03:48 +000020104 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020105 desret_xmlNodePtr(ret_val);
20106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020107 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020108 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020109 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020110 xmlResetLastError();
20111 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020112 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020114 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020115 printf(" %d", n_doc);
20116 printf(" %d", n_content);
20117 printf(" %d", n_len);
20118 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020119 }
20120 }
20121 }
20122 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020123 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020124
Daniel Veillard42595322004-11-08 10:52:06 +000020125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020126}
20127
20128
20129static int
20130test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020132
20133 int mem_base;
20134 xmlNodePtr ret_val;
20135 xmlDocPtr doc; /* the document */
20136 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020137 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138 int n_name;
20139
20140 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20141 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20142 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020143 doc = gen_xmlDocPtr(n_doc, 0);
20144 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020145
William M. Brackf13f77f2004-11-12 16:03:48 +000020146 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020147 desret_xmlNodePtr(ret_val);
20148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020149 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020150 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020151 xmlResetLastError();
20152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020153 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020156 printf(" %d", n_doc);
20157 printf(" %d", n_name);
20158 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020159 }
20160 }
20161 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020162 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020163
Daniel Veillard42595322004-11-08 10:52:06 +000020164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020165}
20166
20167
20168static int
20169test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020171
William M. Brack21e4ef22005-01-02 09:53:13 +000020172#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020173#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020174 int mem_base;
20175 xmlNodePtr ret_val;
20176 xmlNodePtr parent; /* the parent node */
20177 int n_parent;
20178 xmlNsPtr ns; /* a namespace if any */
20179 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020180 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020181 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020182 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020183 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020184
Daniel Veillard27f20102004-11-05 11:50:11 +000020185 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20186 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20188 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20189 mem_base = xmlMemBlocks();
20190 parent = gen_xmlNodePtr(n_parent, 0);
20191 ns = gen_xmlNsPtr(n_ns, 1);
20192 name = gen_const_xmlChar_ptr(n_name, 2);
20193 content = gen_const_xmlChar_ptr(n_content, 3);
20194
William M. Brackf13f77f2004-11-12 16:03:48 +000020195 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020196 desret_xmlNodePtr(ret_val);
20197 call_tests++;
20198 des_xmlNodePtr(n_parent, parent, 0);
20199 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020200 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20201 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020202 xmlResetLastError();
20203 if (mem_base != xmlMemBlocks()) {
20204 printf("Leak of %d blocks found in xmlNewChild",
20205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020206 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020207 printf(" %d", n_parent);
20208 printf(" %d", n_ns);
20209 printf(" %d", n_name);
20210 printf(" %d", n_content);
20211 printf("\n");
20212 }
20213 }
20214 }
20215 }
20216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020217 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020218#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020219#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020220
Daniel Veillard42595322004-11-08 10:52:06 +000020221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020222}
20223
20224
20225static int
20226test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020228
20229 int mem_base;
20230 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020231 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020232 int n_content;
20233
20234 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020236 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237
William M. Brackf13f77f2004-11-12 16:03:48 +000020238 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020239 desret_xmlNodePtr(ret_val);
20240 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020241 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020242 xmlResetLastError();
20243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020244 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020247 printf(" %d", n_content);
20248 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020249 }
20250 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020251 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020252
Daniel Veillard42595322004-11-08 10:52:06 +000020253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020254}
20255
20256
20257static int
20258test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020260
20261 int mem_base;
20262 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020263 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020264 int n_version;
20265
20266 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20267 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020268 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020269
William M. Brackf13f77f2004-11-12 16:03:48 +000020270 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020271 desret_xmlDocPtr(ret_val);
20272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020273 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020274 xmlResetLastError();
20275 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020276 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020278 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020279 printf(" %d", n_version);
20280 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020281 }
20282 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020283 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020284
Daniel Veillard42595322004-11-08 10:52:06 +000020285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020286}
20287
20288
20289static int
20290test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020292
20293 int mem_base;
20294 xmlNodePtr ret_val;
20295 xmlDocPtr doc; /* the document */
20296 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020297 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020298 int n_content;
20299
20300 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20301 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20302 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020303 doc = gen_xmlDocPtr(n_doc, 0);
20304 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020305
William M. Brackf13f77f2004-11-12 16:03:48 +000020306 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020307 desret_xmlNodePtr(ret_val);
20308 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020309 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020310 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020311 xmlResetLastError();
20312 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020313 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020315 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020316 printf(" %d", n_doc);
20317 printf(" %d", n_content);
20318 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020319 }
20320 }
20321 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020322 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020323
Daniel Veillard42595322004-11-08 10:52:06 +000020324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020325}
20326
20327
20328static int
20329test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020331
William M. Brack21e4ef22005-01-02 09:53:13 +000020332#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020333 int mem_base;
20334 xmlNodePtr ret_val;
20335 xmlDocPtr doc; /* the document owning the fragment */
20336 int n_doc;
20337
20338 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20339 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020340 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020341
20342 ret_val = xmlNewDocFragment(doc);
20343 desret_xmlNodePtr(ret_val);
20344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020345 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020346 xmlResetLastError();
20347 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020348 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020350 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020351 printf(" %d", n_doc);
20352 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020353 }
20354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020355 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020356#endif
20357
Daniel Veillard42595322004-11-08 10:52:06 +000020358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020359}
20360
20361
20362static int
20363test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020365
Daniel Veillard27f20102004-11-05 11:50:11 +000020366 int mem_base;
20367 xmlNodePtr ret_val;
20368 xmlDocPtr doc; /* the document */
20369 int n_doc;
20370 xmlNsPtr ns; /* namespace if any */
20371 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020372 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020373 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020374 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020375 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020376
Daniel Veillard27f20102004-11-05 11:50:11 +000020377 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20378 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20379 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20380 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20381 mem_base = xmlMemBlocks();
20382 doc = gen_xmlDocPtr(n_doc, 0);
20383 ns = gen_xmlNsPtr(n_ns, 1);
20384 name = gen_const_xmlChar_ptr(n_name, 2);
20385 content = gen_const_xmlChar_ptr(n_content, 3);
20386
William M. Brackf13f77f2004-11-12 16:03:48 +000020387 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020388 desret_xmlNodePtr(ret_val);
20389 call_tests++;
20390 des_xmlDocPtr(n_doc, doc, 0);
20391 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020392 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20393 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020394 xmlResetLastError();
20395 if (mem_base != xmlMemBlocks()) {
20396 printf("Leak of %d blocks found in xmlNewDocNode",
20397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020398 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020399 printf(" %d", n_doc);
20400 printf(" %d", n_ns);
20401 printf(" %d", n_name);
20402 printf(" %d", n_content);
20403 printf("\n");
20404 }
20405 }
20406 }
20407 }
20408 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020409 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020410
Daniel Veillard42595322004-11-08 10:52:06 +000020411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412}
20413
20414
20415static int
20416test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418
Daniel Veillard27f20102004-11-05 11:50:11 +000020419 int mem_base;
20420 xmlNodePtr ret_val;
20421 xmlDocPtr doc; /* the document */
20422 int n_doc;
20423 xmlNsPtr ns; /* namespace if any */
20424 int n_ns;
20425 xmlChar * name; /* the node name */
20426 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020427 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020428 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020429
Daniel Veillard27f20102004-11-05 11:50:11 +000020430 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20431 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20432 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20433 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20434 mem_base = xmlMemBlocks();
20435 doc = gen_xmlDocPtr(n_doc, 0);
20436 ns = gen_xmlNsPtr(n_ns, 1);
20437 name = gen_eaten_name(n_name, 2);
20438 content = gen_const_xmlChar_ptr(n_content, 3);
20439
William M. Brackf13f77f2004-11-12 16:03:48 +000020440 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020441 desret_xmlNodePtr(ret_val);
20442 call_tests++;
20443 des_xmlDocPtr(n_doc, doc, 0);
20444 des_xmlNsPtr(n_ns, ns, 1);
20445 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020446 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020447 xmlResetLastError();
20448 if (mem_base != xmlMemBlocks()) {
20449 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020451 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020452 printf(" %d", n_doc);
20453 printf(" %d", n_ns);
20454 printf(" %d", n_name);
20455 printf(" %d", n_content);
20456 printf("\n");
20457 }
20458 }
20459 }
20460 }
20461 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020463
Daniel Veillard42595322004-11-08 10:52:06 +000020464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020465}
20466
20467
20468static int
20469test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020471
20472 int mem_base;
20473 xmlNodePtr ret_val;
20474 xmlDocPtr doc; /* the target document */
20475 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020476 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020477 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020478 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020479 int n_content;
20480
20481 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20482 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20483 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020485 doc = gen_xmlDocPtr(n_doc, 0);
20486 name = gen_const_xmlChar_ptr(n_name, 1);
20487 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020488
William M. Brackf13f77f2004-11-12 16:03:48 +000020489 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020490 desret_xmlNodePtr(ret_val);
20491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020492 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020493 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20494 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020495 xmlResetLastError();
20496 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020497 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020500 printf(" %d", n_doc);
20501 printf(" %d", n_name);
20502 printf(" %d", n_content);
20503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020504 }
20505 }
20506 }
20507 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020509
Daniel Veillard42595322004-11-08 10:52:06 +000020510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020511}
20512
20513
20514static int
20515test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020517
Daniel Veillard57b25162004-11-06 14:50:18 +000020518 int mem_base;
20519 xmlAttrPtr ret_val;
20520 xmlDocPtr doc; /* the document */
20521 int n_doc;
20522 xmlChar * name; /* the name of the attribute */
20523 int n_name;
20524 xmlChar * value; /* the value of the attribute */
20525 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020526
Daniel Veillard57b25162004-11-06 14:50:18 +000020527 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20528 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20529 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20530 mem_base = xmlMemBlocks();
20531 doc = gen_xmlDocPtr(n_doc, 0);
20532 name = gen_const_xmlChar_ptr(n_name, 1);
20533 value = gen_const_xmlChar_ptr(n_value, 2);
20534
William M. Brackf13f77f2004-11-12 16:03:48 +000020535 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020536 desret_xmlAttrPtr(ret_val);
20537 call_tests++;
20538 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020539 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20540 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020541 xmlResetLastError();
20542 if (mem_base != xmlMemBlocks()) {
20543 printf("Leak of %d blocks found in xmlNewDocProp",
20544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020545 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020546 printf(" %d", n_doc);
20547 printf(" %d", n_name);
20548 printf(" %d", n_value);
20549 printf("\n");
20550 }
20551 }
20552 }
20553 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020554 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020555
Daniel Veillard42595322004-11-08 10:52:06 +000020556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020557}
20558
20559
20560static int
20561test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020563
William M. Brack21e4ef22005-01-02 09:53:13 +000020564#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020565#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020566 int mem_base;
20567 xmlNodePtr ret_val;
20568 xmlDocPtr doc; /* the document */
20569 int n_doc;
20570 xmlNsPtr ns; /* namespace if any */
20571 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020572 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020573 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020574 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020575 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020576
Daniel Veillard27f20102004-11-05 11:50:11 +000020577 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20578 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20579 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20580 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20581 mem_base = xmlMemBlocks();
20582 doc = gen_xmlDocPtr(n_doc, 0);
20583 ns = gen_xmlNsPtr(n_ns, 1);
20584 name = gen_const_xmlChar_ptr(n_name, 2);
20585 content = gen_const_xmlChar_ptr(n_content, 3);
20586
William M. Brackf13f77f2004-11-12 16:03:48 +000020587 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020588 desret_xmlNodePtr(ret_val);
20589 call_tests++;
20590 des_xmlDocPtr(n_doc, doc, 0);
20591 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020592 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20593 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020594 xmlResetLastError();
20595 if (mem_base != xmlMemBlocks()) {
20596 printf("Leak of %d blocks found in xmlNewDocRawNode",
20597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020598 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020599 printf(" %d", n_doc);
20600 printf(" %d", n_ns);
20601 printf(" %d", n_name);
20602 printf(" %d", n_content);
20603 printf("\n");
20604 }
20605 }
20606 }
20607 }
20608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020609 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020610#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020611#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020612
Daniel Veillard42595322004-11-08 10:52:06 +000020613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020614}
20615
20616
20617static int
20618test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020620
20621 int mem_base;
20622 xmlNodePtr ret_val;
20623 xmlDocPtr doc; /* the document */
20624 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020625 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020626 int n_content;
20627
20628 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20629 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20630 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020631 doc = gen_xmlDocPtr(n_doc, 0);
20632 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020633
William M. Brackf13f77f2004-11-12 16:03:48 +000020634 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020635 desret_xmlNodePtr(ret_val);
20636 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020637 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020638 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020639 xmlResetLastError();
20640 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020641 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020643 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020644 printf(" %d", n_doc);
20645 printf(" %d", n_content);
20646 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020647 }
20648 }
20649 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020651
Daniel Veillard42595322004-11-08 10:52:06 +000020652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020653}
20654
20655
20656static int
20657test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020659
20660 int mem_base;
20661 xmlNodePtr ret_val;
20662 xmlDocPtr doc; /* the document */
20663 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020664 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020665 int n_content;
20666 int len; /* the text len. */
20667 int n_len;
20668
20669 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20670 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20671 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20672 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020673 doc = gen_xmlDocPtr(n_doc, 0);
20674 content = gen_const_xmlChar_ptr(n_content, 1);
20675 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020676
William M. Brackf13f77f2004-11-12 16:03:48 +000020677 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020678 desret_xmlNodePtr(ret_val);
20679 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020680 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020681 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020682 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020683 xmlResetLastError();
20684 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020685 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020687 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020688 printf(" %d", n_doc);
20689 printf(" %d", n_content);
20690 printf(" %d", n_len);
20691 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020692 }
20693 }
20694 }
20695 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020696 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020697
Daniel Veillard42595322004-11-08 10:52:06 +000020698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020699}
20700
20701
20702static int
20703test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705
Daniel Veillard34099b42004-11-04 17:34:35 +000020706 int mem_base;
20707 xmlDtdPtr ret_val;
20708 xmlDocPtr doc; /* the document pointer */
20709 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020710 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020711 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020712 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020713 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020714 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020715 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020716
Daniel Veillard34099b42004-11-04 17:34:35 +000020717 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20718 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20719 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20720 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20721 mem_base = xmlMemBlocks();
20722 doc = gen_xmlDocPtr(n_doc, 0);
20723 name = gen_const_xmlChar_ptr(n_name, 1);
20724 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20725 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20726
William M. Brackf13f77f2004-11-12 16:03:48 +000020727 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020728 desret_xmlDtdPtr(ret_val);
20729 call_tests++;
20730 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020731 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20732 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20733 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020734 xmlResetLastError();
20735 if (mem_base != xmlMemBlocks()) {
20736 printf("Leak of %d blocks found in xmlNewDtd",
20737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020738 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020739 printf(" %d", n_doc);
20740 printf(" %d", n_name);
20741 printf(" %d", n_ExternalID);
20742 printf(" %d", n_SystemID);
20743 printf("\n");
20744 }
20745 }
20746 }
20747 }
20748 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020749 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020750
Daniel Veillard42595322004-11-08 10:52:06 +000020751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020752}
20753
20754
20755static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020756test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020758
Daniel Veillard27f20102004-11-05 11:50:11 +000020759 int mem_base;
20760 xmlNodePtr ret_val;
20761 xmlNsPtr ns; /* namespace if any */
20762 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020763 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020764 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020765
Daniel Veillard27f20102004-11-05 11:50:11 +000020766 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20767 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20768 mem_base = xmlMemBlocks();
20769 ns = gen_xmlNsPtr(n_ns, 0);
20770 name = gen_const_xmlChar_ptr(n_name, 1);
20771
William M. Brackf13f77f2004-11-12 16:03:48 +000020772 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020773 desret_xmlNodePtr(ret_val);
20774 call_tests++;
20775 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020776 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020777 xmlResetLastError();
20778 if (mem_base != xmlMemBlocks()) {
20779 printf("Leak of %d blocks found in xmlNewNode",
20780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020781 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020782 printf(" %d", n_ns);
20783 printf(" %d", n_name);
20784 printf("\n");
20785 }
20786 }
20787 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020788 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020789
Daniel Veillard42595322004-11-08 10:52:06 +000020790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020791}
20792
20793
20794static int
20795test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020797
Daniel Veillard27f20102004-11-05 11:50:11 +000020798 int mem_base;
20799 xmlNodePtr ret_val;
20800 xmlNsPtr ns; /* namespace if any */
20801 int n_ns;
20802 xmlChar * name; /* the node name */
20803 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020804
Daniel Veillard27f20102004-11-05 11:50:11 +000020805 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20806 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20807 mem_base = xmlMemBlocks();
20808 ns = gen_xmlNsPtr(n_ns, 0);
20809 name = gen_eaten_name(n_name, 1);
20810
20811 ret_val = xmlNewNodeEatName(ns, name);
20812 desret_xmlNodePtr(ret_val);
20813 call_tests++;
20814 des_xmlNsPtr(n_ns, ns, 0);
20815 des_eaten_name(n_name, name, 1);
20816 xmlResetLastError();
20817 if (mem_base != xmlMemBlocks()) {
20818 printf("Leak of %d blocks found in xmlNewNodeEatName",
20819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020820 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020821 printf(" %d", n_ns);
20822 printf(" %d", n_name);
20823 printf("\n");
20824 }
20825 }
20826 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020828
Daniel Veillard42595322004-11-08 10:52:06 +000020829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020830}
20831
20832
20833static int
20834test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020836
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020837 int mem_base;
20838 xmlNsPtr ret_val;
20839 xmlNodePtr node; /* the element carrying the namespace */
20840 int n_node;
20841 xmlChar * href; /* the URI associated */
20842 int n_href;
20843 xmlChar * prefix; /* the prefix for the namespace */
20844 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020845
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020846 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20847 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20848 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20849 mem_base = xmlMemBlocks();
20850 node = gen_xmlNodePtr(n_node, 0);
20851 href = gen_const_xmlChar_ptr(n_href, 1);
20852 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20853
William M. Brackf13f77f2004-11-12 16:03:48 +000020854 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020855 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20856 desret_xmlNsPtr(ret_val);
20857 call_tests++;
20858 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020859 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20860 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020861 xmlResetLastError();
20862 if (mem_base != xmlMemBlocks()) {
20863 printf("Leak of %d blocks found in xmlNewNs",
20864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020865 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020866 printf(" %d", n_node);
20867 printf(" %d", n_href);
20868 printf(" %d", n_prefix);
20869 printf("\n");
20870 }
20871 }
20872 }
20873 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020874 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020875
Daniel Veillard42595322004-11-08 10:52:06 +000020876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020877}
20878
20879
20880static int
20881test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883
Daniel Veillard57b25162004-11-06 14:50:18 +000020884 int mem_base;
20885 xmlAttrPtr ret_val;
20886 xmlNodePtr node; /* the holding node */
20887 int n_node;
20888 xmlNsPtr ns; /* the namespace */
20889 int n_ns;
20890 xmlChar * name; /* the name of the attribute */
20891 int n_name;
20892 xmlChar * value; /* the value of the attribute */
20893 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020894
Daniel Veillard57b25162004-11-06 14:50:18 +000020895 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20896 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20897 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20898 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20899 mem_base = xmlMemBlocks();
20900 node = gen_xmlNodePtr(n_node, 0);
20901 ns = gen_xmlNsPtr(n_ns, 1);
20902 name = gen_const_xmlChar_ptr(n_name, 2);
20903 value = gen_const_xmlChar_ptr(n_value, 3);
20904
William M. Brackf13f77f2004-11-12 16:03:48 +000020905 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020906 desret_xmlAttrPtr(ret_val);
20907 call_tests++;
20908 des_xmlNodePtr(n_node, node, 0);
20909 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020910 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20911 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020912 xmlResetLastError();
20913 if (mem_base != xmlMemBlocks()) {
20914 printf("Leak of %d blocks found in xmlNewNsProp",
20915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020916 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020917 printf(" %d", n_node);
20918 printf(" %d", n_ns);
20919 printf(" %d", n_name);
20920 printf(" %d", n_value);
20921 printf("\n");
20922 }
20923 }
20924 }
20925 }
20926 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020928
Daniel Veillard42595322004-11-08 10:52:06 +000020929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020930}
20931
20932
20933static int
20934test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020936
Daniel Veillard57b25162004-11-06 14:50:18 +000020937 int mem_base;
20938 xmlAttrPtr ret_val;
20939 xmlNodePtr node; /* the holding node */
20940 int n_node;
20941 xmlNsPtr ns; /* the namespace */
20942 int n_ns;
20943 xmlChar * name; /* the name of the attribute */
20944 int n_name;
20945 xmlChar * value; /* the value of the attribute */
20946 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020947
Daniel Veillard57b25162004-11-06 14:50:18 +000020948 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20949 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20950 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20951 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20952 mem_base = xmlMemBlocks();
20953 node = gen_xmlNodePtr(n_node, 0);
20954 ns = gen_xmlNsPtr(n_ns, 1);
20955 name = gen_eaten_name(n_name, 2);
20956 value = gen_const_xmlChar_ptr(n_value, 3);
20957
William M. Brackf13f77f2004-11-12 16:03:48 +000020958 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020959 desret_xmlAttrPtr(ret_val);
20960 call_tests++;
20961 des_xmlNodePtr(n_node, node, 0);
20962 des_xmlNsPtr(n_ns, ns, 1);
20963 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020964 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020965 xmlResetLastError();
20966 if (mem_base != xmlMemBlocks()) {
20967 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020969 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020970 printf(" %d", n_node);
20971 printf(" %d", n_ns);
20972 printf(" %d", n_name);
20973 printf(" %d", n_value);
20974 printf("\n");
20975 }
20976 }
20977 }
20978 }
20979 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020980 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020981
Daniel Veillard42595322004-11-08 10:52:06 +000020982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020983}
20984
20985
20986static int
20987test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020989
20990 int mem_base;
20991 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020992 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020993 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020994 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020995 int n_content;
20996
20997 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20998 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20999 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021000 name = gen_const_xmlChar_ptr(n_name, 0);
21001 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002
William M. Brackf13f77f2004-11-12 16:03:48 +000021003 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021004 desret_xmlNodePtr(ret_val);
21005 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021006 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
21007 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021008 xmlResetLastError();
21009 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021010 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021012 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021013 printf(" %d", n_name);
21014 printf(" %d", n_content);
21015 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021016 }
21017 }
21018 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021019 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021020
Daniel Veillard42595322004-11-08 10:52:06 +000021021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021022}
21023
21024
21025static int
21026test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021028
William M. Brack21e4ef22005-01-02 09:53:13 +000021029#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021030#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000021031 int mem_base;
21032 xmlAttrPtr ret_val;
21033 xmlNodePtr node; /* the holding node */
21034 int n_node;
21035 xmlChar * name; /* the name of the attribute */
21036 int n_name;
21037 xmlChar * value; /* the value of the attribute */
21038 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021039
Daniel Veillard57b25162004-11-06 14:50:18 +000021040 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21041 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21042 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
21043 mem_base = xmlMemBlocks();
21044 node = gen_xmlNodePtr(n_node, 0);
21045 name = gen_const_xmlChar_ptr(n_name, 1);
21046 value = gen_const_xmlChar_ptr(n_value, 2);
21047
William M. Brackf13f77f2004-11-12 16:03:48 +000021048 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000021049 desret_xmlAttrPtr(ret_val);
21050 call_tests++;
21051 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021052 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
21053 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000021054 xmlResetLastError();
21055 if (mem_base != xmlMemBlocks()) {
21056 printf("Leak of %d blocks found in xmlNewProp",
21057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021058 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000021059 printf(" %d", n_node);
21060 printf(" %d", n_name);
21061 printf(" %d", n_value);
21062 printf("\n");
21063 }
21064 }
21065 }
21066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021067 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021068#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021069#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000021070
Daniel Veillard42595322004-11-08 10:52:06 +000021071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021072}
21073
21074
21075static int
21076test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021078
21079 int mem_base;
21080 xmlNodePtr ret_val;
21081 xmlDocPtr doc; /* the document */
21082 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021083 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021084 int n_name;
21085
21086 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21087 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21088 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021089 doc = gen_xmlDocPtr(n_doc, 0);
21090 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091
William M. Brackf13f77f2004-11-12 16:03:48 +000021092 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021093 desret_xmlNodePtr(ret_val);
21094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021096 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021097 xmlResetLastError();
21098 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021099 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021101 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021102 printf(" %d", n_doc);
21103 printf(" %d", n_name);
21104 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021105 }
21106 }
21107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021109
Daniel Veillard42595322004-11-08 10:52:06 +000021110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021111}
21112
21113
21114static int
21115test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117
21118 int mem_base;
21119 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021120 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021121 int n_content;
21122
21123 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21124 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021125 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021126
William M. Brackf13f77f2004-11-12 16:03:48 +000021127 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021128 desret_xmlNodePtr(ret_val);
21129 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021130 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021131 xmlResetLastError();
21132 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021133 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021135 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021136 printf(" %d", n_content);
21137 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021138 }
21139 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021141
Daniel Veillard42595322004-11-08 10:52:06 +000021142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021143}
21144
21145
21146static int
21147test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021149
William M. Brack21e4ef22005-01-02 09:53:13 +000021150#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021151#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000021152 int mem_base;
21153 xmlNodePtr ret_val;
21154 xmlNodePtr parent; /* the parent node */
21155 int n_parent;
21156 xmlNsPtr ns; /* a namespace if any */
21157 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021158 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000021159 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021160 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000021161 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021162
Daniel Veillard27f20102004-11-05 11:50:11 +000021163 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
21164 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21165 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21166 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21167 mem_base = xmlMemBlocks();
21168 parent = gen_xmlNodePtr(n_parent, 0);
21169 ns = gen_xmlNsPtr(n_ns, 1);
21170 name = gen_const_xmlChar_ptr(n_name, 2);
21171 content = gen_const_xmlChar_ptr(n_content, 3);
21172
William M. Brackf13f77f2004-11-12 16:03:48 +000021173 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000021174 desret_xmlNodePtr(ret_val);
21175 call_tests++;
21176 des_xmlNodePtr(n_parent, parent, 0);
21177 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021178 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
21179 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000021180 xmlResetLastError();
21181 if (mem_base != xmlMemBlocks()) {
21182 printf("Leak of %d blocks found in xmlNewTextChild",
21183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021184 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000021185 printf(" %d", n_parent);
21186 printf(" %d", n_ns);
21187 printf(" %d", n_name);
21188 printf(" %d", n_content);
21189 printf("\n");
21190 }
21191 }
21192 }
21193 }
21194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021195 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021196#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021197#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000021198
Daniel Veillard42595322004-11-08 10:52:06 +000021199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021200}
21201
21202
21203static int
21204test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021206
21207 int mem_base;
21208 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021209 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021210 int n_content;
21211 int len; /* the text len. */
21212 int n_len;
21213
21214 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21215 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021217 content = gen_const_xmlChar_ptr(n_content, 0);
21218 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021219
William M. Brackf13f77f2004-11-12 16:03:48 +000021220 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021221 desret_xmlNodePtr(ret_val);
21222 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021223 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021224 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021225 xmlResetLastError();
21226 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021227 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021229 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021230 printf(" %d", n_content);
21231 printf(" %d", n_len);
21232 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021233 }
21234 }
21235 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021237
Daniel Veillard42595322004-11-08 10:52:06 +000021238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021239}
21240
21241
21242static int
21243test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021245
21246 int mem_base;
21247 xmlNodePtr cur; /* the node being modified */
21248 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021249 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021250 int n_content;
21251
21252 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21253 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021255 cur = gen_xmlNodePtr(n_cur, 0);
21256 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021257
William M. Brackf13f77f2004-11-12 16:03:48 +000021258 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021260 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021261 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021262 xmlResetLastError();
21263 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021264 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021267 printf(" %d", n_cur);
21268 printf(" %d", n_content);
21269 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021270 }
21271 }
21272 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021274
Daniel Veillard42595322004-11-08 10:52:06 +000021275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021276}
21277
21278
21279static int
21280test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021282
21283 int mem_base;
21284 xmlNodePtr cur; /* the node being modified */
21285 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021286 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021287 int n_content;
21288 int len; /* the size of @content */
21289 int n_len;
21290
21291 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21292 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21293 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021295 cur = gen_xmlNodePtr(n_cur, 0);
21296 content = gen_const_xmlChar_ptr(n_content, 1);
21297 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021298
William M. Brackf13f77f2004-11-12 16:03:48 +000021299 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021301 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021302 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021303 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021304 xmlResetLastError();
21305 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021306 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021308 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021309 printf(" %d", n_cur);
21310 printf(" %d", n_content);
21311 printf(" %d", n_len);
21312 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021313 }
21314 }
21315 }
21316 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021318
Daniel Veillard42595322004-11-08 10:52:06 +000021319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021320}
21321
21322
21323static int
21324test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021326
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021327 int mem_base;
21328 int ret_val;
21329 xmlBufferPtr buffer; /* a buffer */
21330 int n_buffer;
21331 xmlNodePtr cur; /* the node being read */
21332 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021333
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021334 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21335 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21336 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021337 buffer = gen_xmlBufferPtr(n_buffer, 0);
21338 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021339
21340 ret_val = xmlNodeBufGetContent(buffer, cur);
21341 desret_int(ret_val);
21342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021343 des_xmlBufferPtr(n_buffer, buffer, 0);
21344 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021345 xmlResetLastError();
21346 if (mem_base != xmlMemBlocks()) {
21347 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021349 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021350 printf(" %d", n_buffer);
21351 printf(" %d", n_cur);
21352 printf("\n");
21353 }
21354 }
21355 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021357
Daniel Veillard42595322004-11-08 10:52:06 +000021358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021359}
21360
21361
21362static int
21363test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021365
William M. Brack21e4ef22005-01-02 09:53:13 +000021366#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021367 int mem_base;
21368 int ret_val;
21369 xmlBufferPtr buf; /* the XML buffer output */
21370 int n_buf;
21371 xmlDocPtr doc; /* the document */
21372 int n_doc;
21373 xmlNodePtr cur; /* the current node */
21374 int n_cur;
21375 int level; /* the imbrication level for indenting */
21376 int n_level;
21377 int format; /* is formatting allowed */
21378 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021379
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021380 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21381 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21382 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21383 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21384 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021386 buf = gen_xmlBufferPtr(n_buf, 0);
21387 doc = gen_xmlDocPtr(n_doc, 1);
21388 cur = gen_xmlNodePtr(n_cur, 2);
21389 level = gen_int(n_level, 3);
21390 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021391
21392 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21393 desret_int(ret_val);
21394 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021395 des_xmlBufferPtr(n_buf, buf, 0);
21396 des_xmlDocPtr(n_doc, doc, 1);
21397 des_xmlNodePtr(n_cur, cur, 2);
21398 des_int(n_level, level, 3);
21399 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021400 xmlResetLastError();
21401 if (mem_base != xmlMemBlocks()) {
21402 printf("Leak of %d blocks found in xmlNodeDump",
21403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021404 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021405 printf(" %d", n_buf);
21406 printf(" %d", n_doc);
21407 printf(" %d", n_cur);
21408 printf(" %d", n_level);
21409 printf(" %d", n_format);
21410 printf("\n");
21411 }
21412 }
21413 }
21414 }
21415 }
21416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021417 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021418#endif
21419
Daniel Veillard42595322004-11-08 10:52:06 +000021420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421}
21422
21423
21424static int
21425test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021427
William M. Brack21e4ef22005-01-02 09:53:13 +000021428#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021429 int mem_base;
21430 xmlOutputBufferPtr buf; /* the XML buffer output */
21431 int n_buf;
21432 xmlDocPtr doc; /* the document */
21433 int n_doc;
21434 xmlNodePtr cur; /* the current node */
21435 int n_cur;
21436 int level; /* the imbrication level for indenting */
21437 int n_level;
21438 int format; /* is formatting allowed */
21439 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021440 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021441 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021442
Daniel Veillard3d97e662004-11-04 10:49:00 +000021443 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21444 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21445 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21446 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21447 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21448 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21449 mem_base = xmlMemBlocks();
21450 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21451 doc = gen_xmlDocPtr(n_doc, 1);
21452 cur = gen_xmlNodePtr(n_cur, 2);
21453 level = gen_int(n_level, 3);
21454 format = gen_int(n_format, 4);
21455 encoding = gen_const_char_ptr(n_encoding, 5);
21456
William M. Brackf13f77f2004-11-12 16:03:48 +000021457 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021458 call_tests++;
21459 des_xmlOutputBufferPtr(n_buf, buf, 0);
21460 des_xmlDocPtr(n_doc, doc, 1);
21461 des_xmlNodePtr(n_cur, cur, 2);
21462 des_int(n_level, level, 3);
21463 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021464 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021465 xmlResetLastError();
21466 if (mem_base != xmlMemBlocks()) {
21467 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021469 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021470 printf(" %d", n_buf);
21471 printf(" %d", n_doc);
21472 printf(" %d", n_cur);
21473 printf(" %d", n_level);
21474 printf(" %d", n_format);
21475 printf(" %d", n_encoding);
21476 printf("\n");
21477 }
21478 }
21479 }
21480 }
21481 }
21482 }
21483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021484 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021485#endif
21486
Daniel Veillard42595322004-11-08 10:52:06 +000021487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021488}
21489
21490
21491static int
21492test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021494
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021495 int mem_base;
21496 xmlChar * ret_val;
21497 xmlDocPtr doc; /* the document the node pertains to */
21498 int n_doc;
21499 xmlNodePtr cur; /* the node being checked */
21500 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021502 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21503 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21504 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021505 doc = gen_xmlDocPtr(n_doc, 0);
21506 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021507
21508 ret_val = xmlNodeGetBase(doc, cur);
21509 desret_xmlChar_ptr(ret_val);
21510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021511 des_xmlDocPtr(n_doc, doc, 0);
21512 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021513 xmlResetLastError();
21514 if (mem_base != xmlMemBlocks()) {
21515 printf("Leak of %d blocks found in xmlNodeGetBase",
21516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021517 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021518 printf(" %d", n_doc);
21519 printf(" %d", n_cur);
21520 printf("\n");
21521 }
21522 }
21523 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021525
Daniel Veillard42595322004-11-08 10:52:06 +000021526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527}
21528
21529
21530static int
21531test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021534 int mem_base;
21535 xmlChar * ret_val;
21536 xmlNodePtr cur; /* the node being read */
21537 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021538
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021539 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021541 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021542
21543 ret_val = xmlNodeGetContent(cur);
21544 desret_xmlChar_ptr(ret_val);
21545 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021546 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021547 xmlResetLastError();
21548 if (mem_base != xmlMemBlocks()) {
21549 printf("Leak of %d blocks found in xmlNodeGetContent",
21550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021551 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021552 printf(" %d", n_cur);
21553 printf("\n");
21554 }
21555 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021557
Daniel Veillard42595322004-11-08 10:52:06 +000021558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021559}
21560
21561
21562static int
21563test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021566 int mem_base;
21567 xmlChar * ret_val;
21568 xmlNodePtr cur; /* the node being checked */
21569 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021570
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021571 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21572 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021573 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021574
21575 ret_val = xmlNodeGetLang(cur);
21576 desret_xmlChar_ptr(ret_val);
21577 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021578 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021579 xmlResetLastError();
21580 if (mem_base != xmlMemBlocks()) {
21581 printf("Leak of %d blocks found in xmlNodeGetLang",
21582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021583 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021584 printf(" %d", n_cur);
21585 printf("\n");
21586 }
21587 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021588 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021589
Daniel Veillard42595322004-11-08 10:52:06 +000021590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591}
21592
21593
21594static int
21595test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021597
21598 int mem_base;
21599 int ret_val;
21600 xmlNodePtr cur; /* the node being checked */
21601 int n_cur;
21602
21603 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21604 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021605 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606
21607 ret_val = xmlNodeGetSpacePreserve(cur);
21608 desret_int(ret_val);
21609 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021610 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611 xmlResetLastError();
21612 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021613 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021615 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021616 printf(" %d", n_cur);
21617 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021618 }
21619 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021620 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021621
Daniel Veillard42595322004-11-08 10:52:06 +000021622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021623}
21624
21625
21626static int
21627test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629
21630 int mem_base;
21631 int ret_val;
21632 xmlNodePtr node; /* the node */
21633 int n_node;
21634
21635 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021638
21639 ret_val = xmlNodeIsText(node);
21640 desret_int(ret_val);
21641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021642 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021643 xmlResetLastError();
21644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021645 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021648 printf(" %d", n_node);
21649 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021650 }
21651 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021653
Daniel Veillard42595322004-11-08 10:52:06 +000021654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021655}
21656
21657
21658static int
21659test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021661
William M. Brack21e4ef22005-01-02 09:53:13 +000021662#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021663 int mem_base;
21664 xmlChar * ret_val;
21665 xmlDocPtr doc; /* the document */
21666 int n_doc;
21667 xmlNodePtr list; /* a Node list */
21668 int n_list;
21669 int inLine; /* should we replace entity contents or show their external form */
21670 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021672 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21673 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21674 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021676 doc = gen_xmlDocPtr(n_doc, 0);
21677 list = gen_xmlNodePtr(n_list, 1);
21678 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021679
21680 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21681 desret_xmlChar_ptr(ret_val);
21682 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021683 des_xmlDocPtr(n_doc, doc, 0);
21684 des_xmlNodePtr(n_list, list, 1);
21685 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021686 xmlResetLastError();
21687 if (mem_base != xmlMemBlocks()) {
21688 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021690 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021691 printf(" %d", n_doc);
21692 printf(" %d", n_list);
21693 printf(" %d", n_inLine);
21694 printf("\n");
21695 }
21696 }
21697 }
21698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021699 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021700#endif
21701
Daniel Veillard42595322004-11-08 10:52:06 +000021702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021703}
21704
21705
21706static int
21707test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021709
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021710 int mem_base;
21711 xmlChar * ret_val;
21712 xmlDocPtr doc; /* the document */
21713 int n_doc;
21714 xmlNodePtr list; /* a Node list */
21715 int n_list;
21716 int inLine; /* should we replace entity contents or show their external form */
21717 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021718
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021719 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21720 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21721 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021723 doc = gen_xmlDocPtr(n_doc, 0);
21724 list = gen_xmlNodePtr(n_list, 1);
21725 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021726
21727 ret_val = xmlNodeListGetString(doc, list, inLine);
21728 desret_xmlChar_ptr(ret_val);
21729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021730 des_xmlDocPtr(n_doc, doc, 0);
21731 des_xmlNodePtr(n_list, list, 1);
21732 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021733 xmlResetLastError();
21734 if (mem_base != xmlMemBlocks()) {
21735 printf("Leak of %d blocks found in xmlNodeListGetString",
21736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021737 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021738 printf(" %d", n_doc);
21739 printf(" %d", n_list);
21740 printf(" %d", n_inLine);
21741 printf("\n");
21742 }
21743 }
21744 }
21745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021747
Daniel Veillard42595322004-11-08 10:52:06 +000021748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749}
21750
21751
21752static int
21753test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755
William M. Brack21e4ef22005-01-02 09:53:13 +000021756#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021757 int mem_base;
21758 xmlNodePtr cur; /* the node being changed */
21759 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021760 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761 int n_uri;
21762
21763 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21764 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021766 cur = gen_xmlNodePtr(n_cur, 0);
21767 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768
William M. Brackf13f77f2004-11-12 16:03:48 +000021769 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021771 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021772 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773 xmlResetLastError();
21774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021775 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021778 printf(" %d", n_cur);
21779 printf(" %d", n_uri);
21780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021781 }
21782 }
21783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021784 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021785#endif
21786
Daniel Veillard42595322004-11-08 10:52:06 +000021787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021788}
21789
21790
21791static int
21792test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021794
21795 int mem_base;
21796 xmlNodePtr cur; /* the node being modified */
21797 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021798 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021799 int n_content;
21800
21801 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21802 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021804 cur = gen_xmlNodePtr(n_cur, 0);
21805 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021806
William M. Brackf13f77f2004-11-12 16:03:48 +000021807 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021809 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021810 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021811 xmlResetLastError();
21812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021813 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021816 printf(" %d", n_cur);
21817 printf(" %d", n_content);
21818 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021819 }
21820 }
21821 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021822 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021823
Daniel Veillard42595322004-11-08 10:52:06 +000021824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021825}
21826
21827
21828static int
21829test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021831
William M. Brack21e4ef22005-01-02 09:53:13 +000021832#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021833 int mem_base;
21834 xmlNodePtr cur; /* the node being modified */
21835 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021836 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021837 int n_content;
21838 int len; /* the size of @content */
21839 int n_len;
21840
21841 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21842 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21843 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021845 cur = gen_xmlNodePtr(n_cur, 0);
21846 content = gen_const_xmlChar_ptr(n_content, 1);
21847 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021848
William M. Brackf13f77f2004-11-12 16:03:48 +000021849 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021851 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021852 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021853 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021854 xmlResetLastError();
21855 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021856 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021858 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021859 printf(" %d", n_cur);
21860 printf(" %d", n_content);
21861 printf(" %d", n_len);
21862 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021863 }
21864 }
21865 }
21866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021867 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021868#endif
21869
Daniel Veillard42595322004-11-08 10:52:06 +000021870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021871}
21872
21873
21874static int
21875test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021877
William M. Brack21e4ef22005-01-02 09:53:13 +000021878#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021879 int mem_base;
21880 xmlNodePtr cur; /* the node being changed */
21881 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021882 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021883 int n_lang;
21884
21885 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21886 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21887 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021888 cur = gen_xmlNodePtr(n_cur, 0);
21889 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021890
William M. Brackf13f77f2004-11-12 16:03:48 +000021891 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021893 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021894 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021895 xmlResetLastError();
21896 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021897 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021899 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021900 printf(" %d", n_cur);
21901 printf(" %d", n_lang);
21902 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021903 }
21904 }
21905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021906 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021907#endif
21908
Daniel Veillard42595322004-11-08 10:52:06 +000021909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021910}
21911
21912
21913static int
21914test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021916
William M. Brack21e4ef22005-01-02 09:53:13 +000021917#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021918 int mem_base;
21919 xmlNodePtr cur; /* the node being changed */
21920 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021921 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021922 int n_name;
21923
21924 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21925 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021927 cur = gen_xmlNodePtr(n_cur, 0);
21928 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929
William M. Brackf13f77f2004-11-12 16:03:48 +000021930 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021932 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021933 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021934 xmlResetLastError();
21935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021936 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021939 printf(" %d", n_cur);
21940 printf(" %d", n_name);
21941 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021942 }
21943 }
21944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021945 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021946#endif
21947
Daniel Veillard42595322004-11-08 10:52:06 +000021948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021949}
21950
21951
21952static int
21953test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021955
William M. Brack21e4ef22005-01-02 09:53:13 +000021956#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021957 int mem_base;
21958 xmlNodePtr cur; /* the node being changed */
21959 int n_cur;
21960 int val; /* the xml:space value ("0": default, 1: "preserve") */
21961 int n_val;
21962
21963 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21964 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21965 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021966 cur = gen_xmlNodePtr(n_cur, 0);
21967 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021968
21969 xmlNodeSetSpacePreserve(cur, val);
21970 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021971 des_xmlNodePtr(n_cur, cur, 0);
21972 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973 xmlResetLastError();
21974 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021975 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021977 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021978 printf(" %d", n_cur);
21979 printf(" %d", n_val);
21980 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981 }
21982 }
21983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021984 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021985#endif
21986
Daniel Veillard42595322004-11-08 10:52:06 +000021987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021988}
21989
21990
21991static int
21992test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021994
William M. Brack21e4ef22005-01-02 09:53:13 +000021995#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021996#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021997 int mem_base;
21998 int ret_val;
21999 xmlDocPtr doc; /* the document */
22000 int n_doc;
22001 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
22002 int n_tree;
22003
22004 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22005 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
22006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022007 doc = gen_xmlDocPtr(n_doc, 0);
22008 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022009
22010 ret_val = xmlReconciliateNs(doc, tree);
22011 desret_int(ret_val);
22012 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022013 des_xmlDocPtr(n_doc, doc, 0);
22014 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022015 xmlResetLastError();
22016 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022017 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022019 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022020 printf(" %d", n_doc);
22021 printf(" %d", n_tree);
22022 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022023 }
22024 }
22025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022026 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022027#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022028#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022029
Daniel Veillard42595322004-11-08 10:52:06 +000022030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022031}
22032
22033
22034static int
22035test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022037
William M. Brack21e4ef22005-01-02 09:53:13 +000022038#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000022039 int mem_base;
22040 int ret_val;
22041 xmlAttrPtr cur; /* an attribute */
22042 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022043
Daniel Veillardce244ad2004-11-05 10:03:46 +000022044 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
22045 mem_base = xmlMemBlocks();
22046 cur = gen_xmlAttrPtr(n_cur, 0);
22047
22048 ret_val = xmlRemoveProp(cur);
22049 cur = NULL;
22050 desret_int(ret_val);
22051 call_tests++;
22052 des_xmlAttrPtr(n_cur, cur, 0);
22053 xmlResetLastError();
22054 if (mem_base != xmlMemBlocks()) {
22055 printf("Leak of %d blocks found in xmlRemoveProp",
22056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022057 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000022058 printf(" %d", n_cur);
22059 printf("\n");
22060 }
22061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022062 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000022063#endif
22064
Daniel Veillard42595322004-11-08 10:52:06 +000022065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022066}
22067
22068
22069static int
22070test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022072
William M. Brack21e4ef22005-01-02 09:53:13 +000022073#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022074 int mem_base;
22075 xmlNodePtr ret_val;
22076 xmlNodePtr old; /* the old node */
22077 int n_old;
22078 xmlNodePtr cur; /* the node */
22079 int n_cur;
22080
22081 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022082 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022084 old = gen_xmlNodePtr(n_old, 0);
22085 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022086
22087 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000022088 if (cur != NULL) {
22089 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022090 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000022091 if (old != NULL) {
22092 xmlUnlinkNode(old);
22093 xmlFreeNode(old) ; old = NULL ; }
22094 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022095 desret_xmlNodePtr(ret_val);
22096 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022097 des_xmlNodePtr(n_old, old, 0);
22098 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022099 xmlResetLastError();
22100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022101 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022104 printf(" %d", n_old);
22105 printf(" %d", n_cur);
22106 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022107 }
22108 }
22109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022110 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022111#endif
22112
Daniel Veillard42595322004-11-08 10:52:06 +000022113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022114}
22115
22116
22117static int
22118test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022120
William M. Brack21e4ef22005-01-02 09:53:13 +000022121#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122 int mem_base;
22123 int ret_val;
22124 const char * filename; /* the filename (or URL) */
22125 int n_filename;
22126 xmlDocPtr cur; /* the document */
22127 int n_cur;
22128
22129 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22130 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022132 filename = gen_fileoutput(n_filename, 0);
22133 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022134
22135 ret_val = xmlSaveFile(filename, cur);
22136 desret_int(ret_val);
22137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022138 des_fileoutput(n_filename, filename, 0);
22139 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022140 xmlResetLastError();
22141 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022142 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022144 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022145 printf(" %d", n_filename);
22146 printf(" %d", n_cur);
22147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022148 }
22149 }
22150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022151 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022152#endif
22153
Daniel Veillard42595322004-11-08 10:52:06 +000022154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022155}
22156
22157
22158static int
22159test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022161
William M. Brack21e4ef22005-01-02 09:53:13 +000022162#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022163 int mem_base;
22164 int ret_val;
22165 const char * filename; /* the filename (or URL) */
22166 int n_filename;
22167 xmlDocPtr cur; /* the document */
22168 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022169 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022170 int n_encoding;
22171
22172 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22173 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22174 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022176 filename = gen_fileoutput(n_filename, 0);
22177 cur = gen_xmlDocPtr(n_cur, 1);
22178 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022179
William M. Brackf13f77f2004-11-12 16:03:48 +000022180 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022181 desret_int(ret_val);
22182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022183 des_fileoutput(n_filename, filename, 0);
22184 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022185 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022186 xmlResetLastError();
22187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022188 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022191 printf(" %d", n_filename);
22192 printf(" %d", n_cur);
22193 printf(" %d", n_encoding);
22194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022195 }
22196 }
22197 }
22198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022199 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022200#endif
22201
Daniel Veillard42595322004-11-08 10:52:06 +000022202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203}
22204
22205
22206static int
22207test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022209
William M. Brack21e4ef22005-01-02 09:53:13 +000022210#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022211 int mem_base;
22212 int ret_val;
22213 xmlOutputBufferPtr buf; /* an output I/O buffer */
22214 int n_buf;
22215 xmlDocPtr cur; /* the document */
22216 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022217 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022218 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022219
Daniel Veillard3d97e662004-11-04 10:49:00 +000022220 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22221 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22222 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22223 mem_base = xmlMemBlocks();
22224 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22225 cur = gen_xmlDocPtr(n_cur, 1);
22226 encoding = gen_const_char_ptr(n_encoding, 2);
22227
William M. Brackf13f77f2004-11-12 16:03:48 +000022228 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022229 buf = NULL;
22230 desret_int(ret_val);
22231 call_tests++;
22232 des_xmlOutputBufferPtr(n_buf, buf, 0);
22233 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022234 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022235 xmlResetLastError();
22236 if (mem_base != xmlMemBlocks()) {
22237 printf("Leak of %d blocks found in xmlSaveFileTo",
22238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022239 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022240 printf(" %d", n_buf);
22241 printf(" %d", n_cur);
22242 printf(" %d", n_encoding);
22243 printf("\n");
22244 }
22245 }
22246 }
22247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022248 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022249#endif
22250
Daniel Veillard42595322004-11-08 10:52:06 +000022251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022252}
22253
22254
22255static int
22256test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022258
William M. Brack21e4ef22005-01-02 09:53:13 +000022259#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022260 int mem_base;
22261 int ret_val;
22262 const char * filename; /* the filename (or URL) */
22263 int n_filename;
22264 xmlDocPtr cur; /* the document */
22265 int n_cur;
22266 int format; /* should formatting spaces been added */
22267 int n_format;
22268
22269 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22270 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22271 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22272 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022273 filename = gen_fileoutput(n_filename, 0);
22274 cur = gen_xmlDocPtr(n_cur, 1);
22275 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022276
22277 ret_val = xmlSaveFormatFile(filename, cur, format);
22278 desret_int(ret_val);
22279 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022280 des_fileoutput(n_filename, filename, 0);
22281 des_xmlDocPtr(n_cur, cur, 1);
22282 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022283 xmlResetLastError();
22284 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022285 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022287 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022288 printf(" %d", n_filename);
22289 printf(" %d", n_cur);
22290 printf(" %d", n_format);
22291 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022292 }
22293 }
22294 }
22295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022296 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022297#endif
22298
Daniel Veillard42595322004-11-08 10:52:06 +000022299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022300}
22301
22302
22303static int
22304test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022306
William M. Brack21e4ef22005-01-02 09:53:13 +000022307#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022308 int mem_base;
22309 int ret_val;
22310 const char * filename; /* the filename or URL to output */
22311 int n_filename;
22312 xmlDocPtr cur; /* the document being saved */
22313 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022314 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022315 int n_encoding;
22316 int format; /* should formatting spaces be added. */
22317 int n_format;
22318
22319 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22320 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22321 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22322 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022324 filename = gen_fileoutput(n_filename, 0);
22325 cur = gen_xmlDocPtr(n_cur, 1);
22326 encoding = gen_const_char_ptr(n_encoding, 2);
22327 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022328
William M. Brackf13f77f2004-11-12 16:03:48 +000022329 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022330 desret_int(ret_val);
22331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022332 des_fileoutput(n_filename, filename, 0);
22333 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022334 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022335 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022336 xmlResetLastError();
22337 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022338 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022340 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022341 printf(" %d", n_filename);
22342 printf(" %d", n_cur);
22343 printf(" %d", n_encoding);
22344 printf(" %d", n_format);
22345 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022346 }
22347 }
22348 }
22349 }
22350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022351 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022352#endif
22353
Daniel Veillard42595322004-11-08 10:52:06 +000022354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022355}
22356
22357
22358static int
22359test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361
William M. Brack21e4ef22005-01-02 09:53:13 +000022362#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022363 int mem_base;
22364 int ret_val;
22365 xmlOutputBufferPtr buf; /* an output I/O buffer */
22366 int n_buf;
22367 xmlDocPtr cur; /* the document */
22368 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022369 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022370 int n_encoding;
22371 int format; /* should formatting spaces been added */
22372 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373
Daniel Veillard3d97e662004-11-04 10:49:00 +000022374 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22375 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22376 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22377 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22378 mem_base = xmlMemBlocks();
22379 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22380 cur = gen_xmlDocPtr(n_cur, 1);
22381 encoding = gen_const_char_ptr(n_encoding, 2);
22382 format = gen_int(n_format, 3);
22383
William M. Brackf13f77f2004-11-12 16:03:48 +000022384 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022385 buf = NULL;
22386 desret_int(ret_val);
22387 call_tests++;
22388 des_xmlOutputBufferPtr(n_buf, buf, 0);
22389 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022390 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022391 des_int(n_format, format, 3);
22392 xmlResetLastError();
22393 if (mem_base != xmlMemBlocks()) {
22394 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022396 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022397 printf(" %d", n_buf);
22398 printf(" %d", n_cur);
22399 printf(" %d", n_encoding);
22400 printf(" %d", n_format);
22401 printf("\n");
22402 }
22403 }
22404 }
22405 }
22406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022407 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022408#endif
22409
Daniel Veillard42595322004-11-08 10:52:06 +000022410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022411}
22412
22413
22414static int
22415test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022417
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022418 int mem_base;
22419 xmlNsPtr ret_val;
22420 xmlDocPtr doc; /* the document */
22421 int n_doc;
22422 xmlNodePtr node; /* the current node */
22423 int n_node;
22424 xmlChar * nameSpace; /* the namespace prefix */
22425 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022426
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022427 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22428 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22429 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22430 mem_base = xmlMemBlocks();
22431 doc = gen_xmlDocPtr(n_doc, 0);
22432 node = gen_xmlNodePtr(n_node, 1);
22433 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22434
William M. Brackf13f77f2004-11-12 16:03:48 +000022435 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022436 desret_xmlNsPtr(ret_val);
22437 call_tests++;
22438 des_xmlDocPtr(n_doc, doc, 0);
22439 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022440 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022441 xmlResetLastError();
22442 if (mem_base != xmlMemBlocks()) {
22443 printf("Leak of %d blocks found in xmlSearchNs",
22444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022445 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022446 printf(" %d", n_doc);
22447 printf(" %d", n_node);
22448 printf(" %d", n_nameSpace);
22449 printf("\n");
22450 }
22451 }
22452 }
22453 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022454 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022455
Daniel Veillard42595322004-11-08 10:52:06 +000022456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022457}
22458
22459
22460static int
22461test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022463
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022464 int mem_base;
22465 xmlNsPtr ret_val;
22466 xmlDocPtr doc; /* the document */
22467 int n_doc;
22468 xmlNodePtr node; /* the current node */
22469 int n_node;
22470 xmlChar * href; /* the namespace value */
22471 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022472
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022473 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22474 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22475 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22476 mem_base = xmlMemBlocks();
22477 doc = gen_xmlDocPtr(n_doc, 0);
22478 node = gen_xmlNodePtr(n_node, 1);
22479 href = gen_const_xmlChar_ptr(n_href, 2);
22480
William M. Brackf13f77f2004-11-12 16:03:48 +000022481 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022482 desret_xmlNsPtr(ret_val);
22483 call_tests++;
22484 des_xmlDocPtr(n_doc, doc, 0);
22485 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022486 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022487 xmlResetLastError();
22488 if (mem_base != xmlMemBlocks()) {
22489 printf("Leak of %d blocks found in xmlSearchNsByHref",
22490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022491 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022492 printf(" %d", n_doc);
22493 printf(" %d", n_node);
22494 printf(" %d", n_href);
22495 printf("\n");
22496 }
22497 }
22498 }
22499 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022500 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022501
Daniel Veillard42595322004-11-08 10:52:06 +000022502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503}
22504
22505
22506static int
22507test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022509
Daniel Veillard57b25162004-11-06 14:50:18 +000022510 int mem_base;
22511 xmlBufferAllocationScheme scheme; /* allocation method to use */
22512 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513
Daniel Veillard57b25162004-11-06 14:50:18 +000022514 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22515 mem_base = xmlMemBlocks();
22516 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22517
22518 xmlSetBufferAllocationScheme(scheme);
22519 call_tests++;
22520 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22521 xmlResetLastError();
22522 if (mem_base != xmlMemBlocks()) {
22523 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022525 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022526 printf(" %d", n_scheme);
22527 printf("\n");
22528 }
22529 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022531
Daniel Veillard42595322004-11-08 10:52:06 +000022532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022533}
22534
22535
22536static int
22537test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022539
22540 int mem_base;
22541 int mode; /* the compression ratio */
22542 int n_mode;
22543
22544 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022546 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022547
22548 xmlSetCompressMode(mode);
22549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022550 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022551 xmlResetLastError();
22552 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022553 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022556 printf(" %d", n_mode);
22557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022558 }
22559 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022560 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022561
Daniel Veillard42595322004-11-08 10:52:06 +000022562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022563}
22564
22565
22566static int
22567test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022569
22570 int mem_base;
22571 xmlDocPtr doc; /* the document */
22572 int n_doc;
22573 int mode; /* the compression ratio */
22574 int n_mode;
22575
22576 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22577 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022579 doc = gen_xmlDocPtr(n_doc, 0);
22580 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022581
22582 xmlSetDocCompressMode(doc, mode);
22583 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022584 des_xmlDocPtr(n_doc, doc, 0);
22585 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022586 xmlResetLastError();
22587 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022588 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022590 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022591 printf(" %d", n_doc);
22592 printf(" %d", n_mode);
22593 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022594 }
22595 }
22596 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022597 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022598
Daniel Veillard42595322004-11-08 10:52:06 +000022599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022600}
22601
22602
22603static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022604test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022606
Daniel Veillard27f20102004-11-05 11:50:11 +000022607 int mem_base;
22608 xmlNodePtr node; /* a node in the document */
22609 int n_node;
22610 xmlNsPtr ns; /* a namespace pointer */
22611 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022612
Daniel Veillard27f20102004-11-05 11:50:11 +000022613 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22614 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22615 mem_base = xmlMemBlocks();
22616 node = gen_xmlNodePtr(n_node, 0);
22617 ns = gen_xmlNsPtr(n_ns, 1);
22618
22619 xmlSetNs(node, ns);
22620 call_tests++;
22621 des_xmlNodePtr(n_node, node, 0);
22622 des_xmlNsPtr(n_ns, ns, 1);
22623 xmlResetLastError();
22624 if (mem_base != xmlMemBlocks()) {
22625 printf("Leak of %d blocks found in xmlSetNs",
22626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022627 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022628 printf(" %d", n_node);
22629 printf(" %d", n_ns);
22630 printf("\n");
22631 }
22632 }
22633 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022634 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022635
Daniel Veillard42595322004-11-08 10:52:06 +000022636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022637}
22638
22639
22640static int
22641test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022643
William M. Brack21e4ef22005-01-02 09:53:13 +000022644#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022645 int mem_base;
22646 xmlAttrPtr ret_val;
22647 xmlNodePtr node; /* the node */
22648 int n_node;
22649 xmlNsPtr ns; /* the namespace definition */
22650 int n_ns;
22651 xmlChar * name; /* the attribute name */
22652 int n_name;
22653 xmlChar * value; /* the attribute value */
22654 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022655
Daniel Veillard57b25162004-11-06 14:50:18 +000022656 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22657 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22658 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22659 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22660 mem_base = xmlMemBlocks();
22661 node = gen_xmlNodePtr(n_node, 0);
22662 ns = gen_xmlNsPtr(n_ns, 1);
22663 name = gen_const_xmlChar_ptr(n_name, 2);
22664 value = gen_const_xmlChar_ptr(n_value, 3);
22665
William M. Brackf13f77f2004-11-12 16:03:48 +000022666 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022667 desret_xmlAttrPtr(ret_val);
22668 call_tests++;
22669 des_xmlNodePtr(n_node, node, 0);
22670 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022671 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22672 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022673 xmlResetLastError();
22674 if (mem_base != xmlMemBlocks()) {
22675 printf("Leak of %d blocks found in xmlSetNsProp",
22676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022677 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022678 printf(" %d", n_node);
22679 printf(" %d", n_ns);
22680 printf(" %d", n_name);
22681 printf(" %d", n_value);
22682 printf("\n");
22683 }
22684 }
22685 }
22686 }
22687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022688 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022689#endif
22690
Daniel Veillard42595322004-11-08 10:52:06 +000022691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022692}
22693
22694
22695static int
22696test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022698
William M. Brack21e4ef22005-01-02 09:53:13 +000022699#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022700 int mem_base;
22701 xmlAttrPtr ret_val;
22702 xmlNodePtr node; /* the node */
22703 int n_node;
22704 xmlChar * name; /* the attribute name */
22705 int n_name;
22706 xmlChar * value; /* the attribute value */
22707 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022708
Daniel Veillard57b25162004-11-06 14:50:18 +000022709 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22710 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22711 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22712 mem_base = xmlMemBlocks();
22713 node = gen_xmlNodePtr(n_node, 0);
22714 name = gen_const_xmlChar_ptr(n_name, 1);
22715 value = gen_const_xmlChar_ptr(n_value, 2);
22716
William M. Brackf13f77f2004-11-12 16:03:48 +000022717 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022718 desret_xmlAttrPtr(ret_val);
22719 call_tests++;
22720 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022721 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22722 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022723 xmlResetLastError();
22724 if (mem_base != xmlMemBlocks()) {
22725 printf("Leak of %d blocks found in xmlSetProp",
22726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022727 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022728 printf(" %d", n_node);
22729 printf(" %d", n_name);
22730 printf(" %d", n_value);
22731 printf("\n");
22732 }
22733 }
22734 }
22735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022736 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022737#endif
22738
Daniel Veillard42595322004-11-08 10:52:06 +000022739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022740}
22741
22742
22743static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022746
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022747 int mem_base;
22748 xmlChar * ret_val;
22749 xmlChar * name; /* the full QName */
22750 int n_name;
22751 xmlChar ** prefix; /* a xmlChar ** */
22752 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022753
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022754 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22755 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22756 mem_base = xmlMemBlocks();
22757 name = gen_const_xmlChar_ptr(n_name, 0);
22758 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22759
William M. Brackf13f77f2004-11-12 16:03:48 +000022760 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022761 desret_xmlChar_ptr(ret_val);
22762 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022763 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022764 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22765 xmlResetLastError();
22766 if (mem_base != xmlMemBlocks()) {
22767 printf("Leak of %d blocks found in xmlSplitQName2",
22768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022769 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022770 printf(" %d", n_name);
22771 printf(" %d", n_prefix);
22772 printf("\n");
22773 }
22774 }
22775 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022776 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022777
Daniel Veillard42595322004-11-08 10:52:06 +000022778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779}
22780
22781
22782static int
22783test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022786 int mem_base;
22787 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022788 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022789 int n_name;
22790 int * len; /* an int * */
22791 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022793 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22794 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22795 mem_base = xmlMemBlocks();
22796 name = gen_const_xmlChar_ptr(n_name, 0);
22797 len = gen_int_ptr(n_len, 1);
22798
William M. Brackf13f77f2004-11-12 16:03:48 +000022799 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022800 desret_const_xmlChar_ptr(ret_val);
22801 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022802 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022803 des_int_ptr(n_len, len, 1);
22804 xmlResetLastError();
22805 if (mem_base != xmlMemBlocks()) {
22806 printf("Leak of %d blocks found in xmlSplitQName3",
22807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022808 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022809 printf(" %d", n_name);
22810 printf(" %d", n_len);
22811 printf("\n");
22812 }
22813 }
22814 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022815 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022816
Daniel Veillard42595322004-11-08 10:52:06 +000022817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022818}
22819
22820
22821static int
22822test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022824
22825 int mem_base;
22826 xmlNodePtr ret_val;
22827 xmlDocPtr doc; /* the document */
22828 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022829 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022830 int n_value;
22831
22832 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22833 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22834 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022835 doc = gen_xmlDocPtr(n_doc, 0);
22836 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022837
William M. Brackf13f77f2004-11-12 16:03:48 +000022838 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 desret_xmlNodePtr(ret_val);
22840 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022841 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022842 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022843 xmlResetLastError();
22844 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022845 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022847 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022848 printf(" %d", n_doc);
22849 printf(" %d", n_value);
22850 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022851 }
22852 }
22853 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022855
Daniel Veillard42595322004-11-08 10:52:06 +000022856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857}
22858
22859
22860static int
22861test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022863
22864 int mem_base;
22865 xmlNodePtr ret_val;
22866 xmlDocPtr doc; /* the document */
22867 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022868 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869 int n_value;
22870 int len; /* the length of the string value */
22871 int n_len;
22872
22873 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22874 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22875 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022877 doc = gen_xmlDocPtr(n_doc, 0);
22878 value = gen_const_xmlChar_ptr(n_value, 1);
22879 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022880
William M. Brackf13f77f2004-11-12 16:03:48 +000022881 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022882 desret_xmlNodePtr(ret_val);
22883 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022884 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022885 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022886 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022887 xmlResetLastError();
22888 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022889 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022891 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022892 printf(" %d", n_doc);
22893 printf(" %d", n_value);
22894 printf(" %d", n_len);
22895 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022896 }
22897 }
22898 }
22899 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022900 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022901
Daniel Veillard42595322004-11-08 10:52:06 +000022902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022903}
22904
22905
22906static int
22907test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022909
22910 int mem_base;
22911 int ret_val;
22912 xmlNodePtr node; /* the node */
22913 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022914 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022915 int n_content;
22916 int len; /* @content length */
22917 int n_len;
22918
22919 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22920 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22921 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022923 node = gen_xmlNodePtr(n_node, 0);
22924 content = gen_const_xmlChar_ptr(n_content, 1);
22925 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022926
William M. Brackf13f77f2004-11-12 16:03:48 +000022927 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022928 desret_int(ret_val);
22929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022930 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022931 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022932 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022933 xmlResetLastError();
22934 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022935 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022937 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022938 printf(" %d", n_node);
22939 printf(" %d", n_content);
22940 printf(" %d", n_len);
22941 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022942 }
22943 }
22944 }
22945 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022946 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022947
Daniel Veillard42595322004-11-08 10:52:06 +000022948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022949}
22950
22951
22952static int
22953test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022955
22956 int mem_base;
22957 xmlNodePtr ret_val;
22958 xmlNodePtr first; /* the first text node */
22959 int n_first;
22960 xmlNodePtr second; /* the second text node being merged */
22961 int n_second;
22962
Daniel Veillarda03e3652004-11-02 18:45:30 +000022963 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22964 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022965 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022966 first = gen_xmlNodePtr_in(n_first, 0);
22967 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022968
22969 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022970 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022971 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022972 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022973 desret_xmlNodePtr(ret_val);
22974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022975 des_xmlNodePtr_in(n_first, first, 0);
22976 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022977 xmlResetLastError();
22978 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022979 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022981 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022982 printf(" %d", n_first);
22983 printf(" %d", n_second);
22984 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022985 }
22986 }
22987 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022989
Daniel Veillard42595322004-11-08 10:52:06 +000022990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022991}
22992
22993
22994static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022995test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022997
William M. Brack21e4ef22005-01-02 09:53:13 +000022998#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022999 int mem_base;
23000 int ret_val;
23001 xmlNodePtr node; /* the node */
23002 int n_node;
23003 xmlNsPtr ns; /* the namespace definition */
23004 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023005 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000023006 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023007
Daniel Veillard27f20102004-11-05 11:50:11 +000023008 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23009 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
23010 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23011 mem_base = xmlMemBlocks();
23012 node = gen_xmlNodePtr(n_node, 0);
23013 ns = gen_xmlNsPtr(n_ns, 1);
23014 name = gen_const_xmlChar_ptr(n_name, 2);
23015
William M. Brackf13f77f2004-11-12 16:03:48 +000023016 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000023017 desret_int(ret_val);
23018 call_tests++;
23019 des_xmlNodePtr(n_node, node, 0);
23020 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023021 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000023022 xmlResetLastError();
23023 if (mem_base != xmlMemBlocks()) {
23024 printf("Leak of %d blocks found in xmlUnsetNsProp",
23025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023026 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000023027 printf(" %d", n_node);
23028 printf(" %d", n_ns);
23029 printf(" %d", n_name);
23030 printf("\n");
23031 }
23032 }
23033 }
23034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023035 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000023036#endif
23037
Daniel Veillard42595322004-11-08 10:52:06 +000023038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023039}
23040
23041
23042static int
23043test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023045
William M. Brack21e4ef22005-01-02 09:53:13 +000023046#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000023047 int mem_base;
23048 int ret_val;
23049 xmlNodePtr node; /* the node */
23050 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023051 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023052 int n_name;
23053
23054 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23055 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023057 node = gen_xmlNodePtr(n_node, 0);
23058 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023059
William M. Brackf13f77f2004-11-12 16:03:48 +000023060 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023061 desret_int(ret_val);
23062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023063 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023064 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023065 xmlResetLastError();
23066 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023067 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023069 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023070 printf(" %d", n_node);
23071 printf(" %d", n_name);
23072 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023073 }
23074 }
23075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023076 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023077#endif
23078
Daniel Veillard42595322004-11-08 10:52:06 +000023079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023080}
23081
23082
23083static int
23084test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023086
William M. Brack21e4ef22005-01-02 09:53:13 +000023087#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023088#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023089 int mem_base;
23090 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023091 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023092 int n_value;
23093 int space; /* allow spaces in front and end of the string */
23094 int n_space;
23095
23096 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23097 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023099 value = gen_const_xmlChar_ptr(n_value, 0);
23100 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023101
William M. Brackf13f77f2004-11-12 16:03:48 +000023102 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023103 desret_int(ret_val);
23104 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023105 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023106 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023107 xmlResetLastError();
23108 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023109 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023111 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023112 printf(" %d", n_value);
23113 printf(" %d", n_space);
23114 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023115 }
23116 }
23117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023118 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023119#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023120#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023121
Daniel Veillard42595322004-11-08 10:52:06 +000023122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023123}
23124
23125
23126static int
23127test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023129
William M. Brack21e4ef22005-01-02 09:53:13 +000023130#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023131#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023132 int mem_base;
23133 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023134 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023135 int n_value;
23136 int space; /* allow spaces in front and end of the string */
23137 int n_space;
23138
23139 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23140 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023142 value = gen_const_xmlChar_ptr(n_value, 0);
23143 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023144
William M. Brackf13f77f2004-11-12 16:03:48 +000023145 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023146 desret_int(ret_val);
23147 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023148 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023149 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023150 xmlResetLastError();
23151 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023152 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023154 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023155 printf(" %d", n_value);
23156 printf(" %d", n_space);
23157 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023158 }
23159 }
23160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023161 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023162#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023163#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023164
Daniel Veillard42595322004-11-08 10:52:06 +000023165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023166}
23167
23168
23169static int
23170test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023172
William M. Brack21e4ef22005-01-02 09:53:13 +000023173#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023174#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023175 int mem_base;
23176 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023177 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023178 int n_value;
23179 int space; /* allow spaces in front and end of the string */
23180 int n_space;
23181
23182 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23183 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023185 value = gen_const_xmlChar_ptr(n_value, 0);
23186 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187
William M. Brackf13f77f2004-11-12 16:03:48 +000023188 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023189 desret_int(ret_val);
23190 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023191 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023192 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023193 xmlResetLastError();
23194 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023195 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023197 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023198 printf(" %d", n_value);
23199 printf(" %d", n_space);
23200 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023201 }
23202 }
23203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023204 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023205#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023206#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023207
Daniel Veillard42595322004-11-08 10:52:06 +000023208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023209}
23210
23211
23212static int
23213test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023215
William M. Brack21e4ef22005-01-02 09:53:13 +000023216#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023217#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023218 int mem_base;
23219 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023220 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023221 int n_value;
23222 int space; /* allow spaces in front and end of the string */
23223 int n_space;
23224
23225 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23226 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23227 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023228 value = gen_const_xmlChar_ptr(n_value, 0);
23229 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023230
William M. Brackf13f77f2004-11-12 16:03:48 +000023231 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023232 desret_int(ret_val);
23233 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023234 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023235 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023236 xmlResetLastError();
23237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023238 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023241 printf(" %d", n_value);
23242 printf(" %d", n_space);
23243 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023244 }
23245 }
23246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023247 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023248#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023249#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023250
Daniel Veillard42595322004-11-08 10:52:06 +000023251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023252}
23253
23254static int
23255test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023257
Daniel Veillard95175012005-07-03 16:09:51 +000023258 if (quiet == 0) printf("Testing tree : 132 of 151 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023259 test_ret += test_xmlAddChild();
23260 test_ret += test_xmlAddChildList();
23261 test_ret += test_xmlAddNextSibling();
23262 test_ret += test_xmlAddPrevSibling();
23263 test_ret += test_xmlAddSibling();
23264 test_ret += test_xmlAttrSerializeTxtContent();
23265 test_ret += test_xmlBufferAdd();
23266 test_ret += test_xmlBufferAddHead();
23267 test_ret += test_xmlBufferCCat();
23268 test_ret += test_xmlBufferCat();
23269 test_ret += test_xmlBufferContent();
23270 test_ret += test_xmlBufferCreate();
23271 test_ret += test_xmlBufferCreateSize();
23272 test_ret += test_xmlBufferCreateStatic();
23273 test_ret += test_xmlBufferEmpty();
23274 test_ret += test_xmlBufferGrow();
23275 test_ret += test_xmlBufferLength();
23276 test_ret += test_xmlBufferResize();
23277 test_ret += test_xmlBufferSetAllocationScheme();
23278 test_ret += test_xmlBufferShrink();
23279 test_ret += test_xmlBufferWriteCHAR();
23280 test_ret += test_xmlBufferWriteChar();
23281 test_ret += test_xmlBufferWriteQuotedString();
23282 test_ret += test_xmlBuildQName();
23283 test_ret += test_xmlCopyDoc();
23284 test_ret += test_xmlCopyDtd();
23285 test_ret += test_xmlCopyNamespace();
23286 test_ret += test_xmlCopyNamespaceList();
23287 test_ret += test_xmlCopyNode();
23288 test_ret += test_xmlCopyNodeList();
23289 test_ret += test_xmlCopyProp();
23290 test_ret += test_xmlCopyPropList();
23291 test_ret += test_xmlCreateIntSubset();
Daniel Veillard95175012005-07-03 16:09:51 +000023292 test_ret += test_xmlDOMWrapAdoptNode();
23293 test_ret += test_xmlDOMWrapNewCtxt();
23294 test_ret += test_xmlDOMWrapReconcileNamespaces();
23295 test_ret += test_xmlDOMWrapRemoveNode();
Daniel Veillard42595322004-11-08 10:52:06 +000023296 test_ret += test_xmlDocCopyNode();
23297 test_ret += test_xmlDocCopyNodeList();
23298 test_ret += test_xmlDocDump();
23299 test_ret += test_xmlDocDumpFormatMemory();
23300 test_ret += test_xmlDocDumpFormatMemoryEnc();
23301 test_ret += test_xmlDocDumpMemory();
23302 test_ret += test_xmlDocDumpMemoryEnc();
23303 test_ret += test_xmlDocFormatDump();
23304 test_ret += test_xmlDocGetRootElement();
23305 test_ret += test_xmlDocSetRootElement();
23306 test_ret += test_xmlElemDump();
23307 test_ret += test_xmlGetBufferAllocationScheme();
23308 test_ret += test_xmlGetCompressMode();
23309 test_ret += test_xmlGetDocCompressMode();
23310 test_ret += test_xmlGetIntSubset();
23311 test_ret += test_xmlGetLastChild();
23312 test_ret += test_xmlGetLineNo();
23313 test_ret += test_xmlGetNoNsProp();
23314 test_ret += test_xmlGetNodePath();
23315 test_ret += test_xmlGetNsList();
23316 test_ret += test_xmlGetNsProp();
23317 test_ret += test_xmlGetProp();
23318 test_ret += test_xmlHasNsProp();
23319 test_ret += test_xmlHasProp();
23320 test_ret += test_xmlIsBlankNode();
23321 test_ret += test_xmlIsXHTML();
23322 test_ret += test_xmlNewCDataBlock();
23323 test_ret += test_xmlNewCharRef();
23324 test_ret += test_xmlNewChild();
23325 test_ret += test_xmlNewComment();
23326 test_ret += test_xmlNewDoc();
23327 test_ret += test_xmlNewDocComment();
23328 test_ret += test_xmlNewDocFragment();
23329 test_ret += test_xmlNewDocNode();
23330 test_ret += test_xmlNewDocNodeEatName();
23331 test_ret += test_xmlNewDocPI();
23332 test_ret += test_xmlNewDocProp();
23333 test_ret += test_xmlNewDocRawNode();
23334 test_ret += test_xmlNewDocText();
23335 test_ret += test_xmlNewDocTextLen();
23336 test_ret += test_xmlNewDtd();
23337 test_ret += test_xmlNewNode();
23338 test_ret += test_xmlNewNodeEatName();
23339 test_ret += test_xmlNewNs();
23340 test_ret += test_xmlNewNsProp();
23341 test_ret += test_xmlNewNsPropEatName();
23342 test_ret += test_xmlNewPI();
23343 test_ret += test_xmlNewProp();
23344 test_ret += test_xmlNewReference();
23345 test_ret += test_xmlNewText();
23346 test_ret += test_xmlNewTextChild();
23347 test_ret += test_xmlNewTextLen();
23348 test_ret += test_xmlNodeAddContent();
23349 test_ret += test_xmlNodeAddContentLen();
23350 test_ret += test_xmlNodeBufGetContent();
23351 test_ret += test_xmlNodeDump();
23352 test_ret += test_xmlNodeDumpOutput();
23353 test_ret += test_xmlNodeGetBase();
23354 test_ret += test_xmlNodeGetContent();
23355 test_ret += test_xmlNodeGetLang();
23356 test_ret += test_xmlNodeGetSpacePreserve();
23357 test_ret += test_xmlNodeIsText();
23358 test_ret += test_xmlNodeListGetRawString();
23359 test_ret += test_xmlNodeListGetString();
23360 test_ret += test_xmlNodeSetBase();
23361 test_ret += test_xmlNodeSetContent();
23362 test_ret += test_xmlNodeSetContentLen();
23363 test_ret += test_xmlNodeSetLang();
23364 test_ret += test_xmlNodeSetName();
23365 test_ret += test_xmlNodeSetSpacePreserve();
23366 test_ret += test_xmlReconciliateNs();
23367 test_ret += test_xmlRemoveProp();
23368 test_ret += test_xmlReplaceNode();
23369 test_ret += test_xmlSaveFile();
23370 test_ret += test_xmlSaveFileEnc();
23371 test_ret += test_xmlSaveFileTo();
23372 test_ret += test_xmlSaveFormatFile();
23373 test_ret += test_xmlSaveFormatFileEnc();
23374 test_ret += test_xmlSaveFormatFileTo();
23375 test_ret += test_xmlSearchNs();
23376 test_ret += test_xmlSearchNsByHref();
23377 test_ret += test_xmlSetBufferAllocationScheme();
23378 test_ret += test_xmlSetCompressMode();
23379 test_ret += test_xmlSetDocCompressMode();
23380 test_ret += test_xmlSetNs();
23381 test_ret += test_xmlSetNsProp();
23382 test_ret += test_xmlSetProp();
23383 test_ret += test_xmlSplitQName2();
23384 test_ret += test_xmlSplitQName3();
23385 test_ret += test_xmlStringGetNodeList();
23386 test_ret += test_xmlStringLenGetNodeList();
23387 test_ret += test_xmlTextConcat();
23388 test_ret += test_xmlTextMerge();
23389 test_ret += test_xmlUnsetNsProp();
23390 test_ret += test_xmlUnsetProp();
23391 test_ret += test_xmlValidateNCName();
23392 test_ret += test_xmlValidateNMToken();
23393 test_ret += test_xmlValidateName();
23394 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023395
Daniel Veillard42595322004-11-08 10:52:06 +000023396 if (test_ret != 0)
23397 printf("Module tree: %d errors\n", test_ret);
23398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023399}
23400
23401static int
23402test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023404
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023405 int mem_base;
23406 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023407 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023408 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023409 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023410 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023411
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023412 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23413 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023415 URI = gen_const_xmlChar_ptr(n_URI, 0);
23416 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023417
William M. Brackf13f77f2004-11-12 16:03:48 +000023418 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023419 desret_xmlChar_ptr(ret_val);
23420 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023421 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23422 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023423 xmlResetLastError();
23424 if (mem_base != xmlMemBlocks()) {
23425 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023427 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023428 printf(" %d", n_URI);
23429 printf(" %d", n_base);
23430 printf("\n");
23431 }
23432 }
23433 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023434 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023435
Daniel Veillard42595322004-11-08 10:52:06 +000023436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023437}
23438
23439
23440static int
23441test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023443
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023444 int mem_base;
23445 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023446 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023447 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023448 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023449 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023450
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023451 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23452 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023454 URI = gen_const_xmlChar_ptr(n_URI, 0);
23455 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023456
William M. Brackf13f77f2004-11-12 16:03:48 +000023457 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023458 desret_xmlChar_ptr(ret_val);
23459 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023460 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23461 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023462 xmlResetLastError();
23463 if (mem_base != xmlMemBlocks()) {
23464 printf("Leak of %d blocks found in xmlBuildURI",
23465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023466 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023467 printf(" %d", n_URI);
23468 printf(" %d", n_base);
23469 printf("\n");
23470 }
23471 }
23472 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023474
Daniel Veillard42595322004-11-08 10:52:06 +000023475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023476}
23477
23478
23479static int
23480test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023482
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023483 int mem_base;
23484 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023485 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023486 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023487
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023488 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023490 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023491
William M. Brackf13f77f2004-11-12 16:03:48 +000023492 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023493 desret_xmlChar_ptr(ret_val);
23494 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023495 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023496 xmlResetLastError();
23497 if (mem_base != xmlMemBlocks()) {
23498 printf("Leak of %d blocks found in xmlCanonicPath",
23499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023500 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023501 printf(" %d", n_path);
23502 printf("\n");
23503 }
23504 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023505 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023506
Daniel Veillard42595322004-11-08 10:52:06 +000023507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023508}
23509
23510
23511static int
23512test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023514
23515
23516 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023518}
23519
23520
23521static int
23522test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023524
Daniel Veillardce682bc2004-11-05 17:22:25 +000023525 int mem_base;
23526 int ret_val;
23527 char * path; /* pointer to the path string */
23528 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023529
Daniel Veillardce682bc2004-11-05 17:22:25 +000023530 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23531 mem_base = xmlMemBlocks();
23532 path = gen_char_ptr(n_path, 0);
23533
23534 ret_val = xmlNormalizeURIPath(path);
23535 desret_int(ret_val);
23536 call_tests++;
23537 des_char_ptr(n_path, path, 0);
23538 xmlResetLastError();
23539 if (mem_base != xmlMemBlocks()) {
23540 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023542 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023543 printf(" %d", n_path);
23544 printf("\n");
23545 }
23546 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023548
Daniel Veillard42595322004-11-08 10:52:06 +000023549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023550}
23551
23552
23553static int
23554test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023556
23557
23558 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023560}
23561
23562
Daniel Veillardce682bc2004-11-05 17:22:25 +000023563#define gen_nb_xmlURIPtr 1
23564static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23565 return(NULL);
23566}
23567static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23568}
23569
Daniel Veillardd93f6252004-11-02 15:53:51 +000023570static int
23571test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023573
Daniel Veillardce682bc2004-11-05 17:22:25 +000023574 int mem_base;
23575 int ret_val;
23576 xmlURIPtr uri; /* pointer to an URI structure */
23577 int n_uri;
23578 char * str; /* the string to analyze */
23579 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023580
Daniel Veillardce682bc2004-11-05 17:22:25 +000023581 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23582 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23583 mem_base = xmlMemBlocks();
23584 uri = gen_xmlURIPtr(n_uri, 0);
23585 str = gen_const_char_ptr(n_str, 1);
23586
William M. Brackf13f77f2004-11-12 16:03:48 +000023587 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023588 desret_int(ret_val);
23589 call_tests++;
23590 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023591 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023592 xmlResetLastError();
23593 if (mem_base != xmlMemBlocks()) {
23594 printf("Leak of %d blocks found in xmlParseURIReference",
23595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023596 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023597 printf(" %d", n_uri);
23598 printf(" %d", n_str);
23599 printf("\n");
23600 }
23601 }
23602 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023603 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023604
Daniel Veillard42595322004-11-08 10:52:06 +000023605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023606}
23607
23608
23609static int
23610test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023612
Daniel Veillardce682bc2004-11-05 17:22:25 +000023613 int mem_base;
23614 FILE * stream; /* a FILE* for the output */
23615 int n_stream;
23616 xmlURIPtr uri; /* pointer to an xmlURI */
23617 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023618
Daniel Veillardce682bc2004-11-05 17:22:25 +000023619 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23620 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23621 mem_base = xmlMemBlocks();
23622 stream = gen_FILE_ptr(n_stream, 0);
23623 uri = gen_xmlURIPtr(n_uri, 1);
23624
23625 xmlPrintURI(stream, uri);
23626 call_tests++;
23627 des_FILE_ptr(n_stream, stream, 0);
23628 des_xmlURIPtr(n_uri, uri, 1);
23629 xmlResetLastError();
23630 if (mem_base != xmlMemBlocks()) {
23631 printf("Leak of %d blocks found in xmlPrintURI",
23632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023633 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023634 printf(" %d", n_stream);
23635 printf(" %d", n_uri);
23636 printf("\n");
23637 }
23638 }
23639 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023641
Daniel Veillard42595322004-11-08 10:52:06 +000023642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023643}
23644
23645
23646static int
23647test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023649
Daniel Veillardce682bc2004-11-05 17:22:25 +000023650 int mem_base;
23651 xmlChar * ret_val;
23652 xmlURIPtr uri; /* pointer to an xmlURI */
23653 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023654
Daniel Veillardce682bc2004-11-05 17:22:25 +000023655 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23656 mem_base = xmlMemBlocks();
23657 uri = gen_xmlURIPtr(n_uri, 0);
23658
23659 ret_val = xmlSaveUri(uri);
23660 desret_xmlChar_ptr(ret_val);
23661 call_tests++;
23662 des_xmlURIPtr(n_uri, uri, 0);
23663 xmlResetLastError();
23664 if (mem_base != xmlMemBlocks()) {
23665 printf("Leak of %d blocks found in xmlSaveUri",
23666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023667 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023668 printf(" %d", n_uri);
23669 printf("\n");
23670 }
23671 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023673
Daniel Veillard42595322004-11-08 10:52:06 +000023674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023675}
23676
23677
23678static int
23679test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023681
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023682 int mem_base;
23683 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023684 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023685 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023687 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023689 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023690
William M. Brackf13f77f2004-11-12 16:03:48 +000023691 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023692 desret_xmlChar_ptr(ret_val);
23693 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023694 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023695 xmlResetLastError();
23696 if (mem_base != xmlMemBlocks()) {
23697 printf("Leak of %d blocks found in xmlURIEscape",
23698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023699 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023700 printf(" %d", n_str);
23701 printf("\n");
23702 }
23703 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023705
Daniel Veillard42595322004-11-08 10:52:06 +000023706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023707}
23708
23709
23710static int
23711test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023713
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023714 int mem_base;
23715 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023716 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023717 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023718 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023719 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023720
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023721 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23722 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023724 str = gen_const_xmlChar_ptr(n_str, 0);
23725 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023726
William M. Brackf13f77f2004-11-12 16:03:48 +000023727 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023728 desret_xmlChar_ptr(ret_val);
23729 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023730 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23731 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023732 xmlResetLastError();
23733 if (mem_base != xmlMemBlocks()) {
23734 printf("Leak of %d blocks found in xmlURIEscapeStr",
23735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023736 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023737 printf(" %d", n_str);
23738 printf(" %d", n_list);
23739 printf("\n");
23740 }
23741 }
23742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023744
Daniel Veillard42595322004-11-08 10:52:06 +000023745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023746}
23747
23748
23749static int
23750test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023752
23753
23754 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023756}
23757
23758static int
23759test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023761
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023762 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023763 test_ret += test_xmlBuildRelativeURI();
23764 test_ret += test_xmlBuildURI();
23765 test_ret += test_xmlCanonicPath();
23766 test_ret += test_xmlCreateURI();
23767 test_ret += test_xmlNormalizeURIPath();
23768 test_ret += test_xmlParseURI();
23769 test_ret += test_xmlParseURIReference();
23770 test_ret += test_xmlPrintURI();
23771 test_ret += test_xmlSaveUri();
23772 test_ret += test_xmlURIEscape();
23773 test_ret += test_xmlURIEscapeStr();
23774 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023775
Daniel Veillard42595322004-11-08 10:52:06 +000023776 if (test_ret != 0)
23777 printf("Module uri: %d errors\n", test_ret);
23778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023779}
23780
23781static int
23782test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023784
Daniel Veillard42595322004-11-08 10:52:06 +000023785 int mem_base;
23786 xmlAttributePtr ret_val;
23787 xmlValidCtxtPtr ctxt; /* the validation context */
23788 int n_ctxt;
23789 xmlDtdPtr dtd; /* pointer to the DTD */
23790 int n_dtd;
23791 xmlChar * elem; /* the element name */
23792 int n_elem;
23793 xmlChar * name; /* the attribute name */
23794 int n_name;
23795 xmlChar * ns; /* the attribute namespace prefix */
23796 int n_ns;
23797 xmlAttributeType type; /* the attribute type */
23798 int n_type;
23799 xmlAttributeDefault def; /* the attribute default type */
23800 int n_def;
23801 xmlChar * defaultValue; /* the attribute default value */
23802 int n_defaultValue;
23803 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23804 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023805
Daniel Veillard42595322004-11-08 10:52:06 +000023806 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23807 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23808 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23809 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23810 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23811 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23812 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23813 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23814 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23815 mem_base = xmlMemBlocks();
23816 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23817 dtd = gen_xmlDtdPtr(n_dtd, 1);
23818 elem = gen_const_xmlChar_ptr(n_elem, 2);
23819 name = gen_const_xmlChar_ptr(n_name, 3);
23820 ns = gen_const_xmlChar_ptr(n_ns, 4);
23821 type = gen_xmlAttributeType(n_type, 5);
23822 def = gen_xmlAttributeDefault(n_def, 6);
23823 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23824 tree = gen_xmlEnumerationPtr(n_tree, 8);
23825
William M. Brackf13f77f2004-11-12 16:03:48 +000023826 ret_val = xmlAddAttributeDecl(ctxt, dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)ns, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard42595322004-11-08 10:52:06 +000023827 desret_xmlAttributePtr(ret_val);
23828 call_tests++;
23829 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23830 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023831 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23832 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23833 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023834 des_xmlAttributeType(n_type, type, 5);
23835 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023836 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023837 des_xmlEnumerationPtr(n_tree, tree, 8);
23838 xmlResetLastError();
23839 if (mem_base != xmlMemBlocks()) {
23840 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23841 xmlMemBlocks() - mem_base);
23842 test_ret++;
23843 printf(" %d", n_ctxt);
23844 printf(" %d", n_dtd);
23845 printf(" %d", n_elem);
23846 printf(" %d", n_name);
23847 printf(" %d", n_ns);
23848 printf(" %d", n_type);
23849 printf(" %d", n_def);
23850 printf(" %d", n_defaultValue);
23851 printf(" %d", n_tree);
23852 printf("\n");
23853 }
23854 }
23855 }
23856 }
23857 }
23858 }
23859 }
23860 }
23861 }
23862 }
Daniel Veillard42595322004-11-08 10:52:06 +000023863 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023864
Daniel Veillard42595322004-11-08 10:52:06 +000023865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023866}
23867
23868
23869static int
23870test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872
Daniel Veillard42595322004-11-08 10:52:06 +000023873 int mem_base;
23874 xmlElementPtr ret_val;
23875 xmlValidCtxtPtr ctxt; /* the validation context */
23876 int n_ctxt;
23877 xmlDtdPtr dtd; /* pointer to the DTD */
23878 int n_dtd;
23879 xmlChar * name; /* the entity name */
23880 int n_name;
23881 xmlElementTypeVal type; /* the element type */
23882 int n_type;
23883 xmlElementContentPtr content; /* the element content tree or NULL */
23884 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023885
Daniel Veillard42595322004-11-08 10:52:06 +000023886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23887 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23888 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23889 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23890 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23891 mem_base = xmlMemBlocks();
23892 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23893 dtd = gen_xmlDtdPtr(n_dtd, 1);
23894 name = gen_const_xmlChar_ptr(n_name, 2);
23895 type = gen_xmlElementTypeVal(n_type, 3);
23896 content = gen_xmlElementContentPtr(n_content, 4);
23897
William M. Brackf13f77f2004-11-12 16:03:48 +000023898 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023899 desret_xmlElementPtr(ret_val);
23900 call_tests++;
23901 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23902 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023903 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023904 des_xmlElementTypeVal(n_type, type, 3);
23905 des_xmlElementContentPtr(n_content, content, 4);
23906 xmlResetLastError();
23907 if (mem_base != xmlMemBlocks()) {
23908 printf("Leak of %d blocks found in xmlAddElementDecl",
23909 xmlMemBlocks() - mem_base);
23910 test_ret++;
23911 printf(" %d", n_ctxt);
23912 printf(" %d", n_dtd);
23913 printf(" %d", n_name);
23914 printf(" %d", n_type);
23915 printf(" %d", n_content);
23916 printf("\n");
23917 }
23918 }
23919 }
23920 }
23921 }
23922 }
Daniel Veillard42595322004-11-08 10:52:06 +000023923 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023924
Daniel Veillard42595322004-11-08 10:52:06 +000023925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023926}
23927
23928
23929static int
23930test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023932
23933
23934 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023936}
23937
23938
23939static int
23940test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023942
23943
23944 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023946}
23947
23948
23949static int
23950test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023952
23953
23954 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023956}
23957
23958
Daniel Veillardce682bc2004-11-05 17:22:25 +000023959#define gen_nb_xmlAttributeTablePtr 1
23960static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23961 return(NULL);
23962}
23963static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23964}
23965
Daniel Veillardd93f6252004-11-02 15:53:51 +000023966static int
23967test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023969
23970
23971 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023973}
23974
23975
23976static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023977test_xmlCopyDocElementContent(void) {
23978 int test_ret = 0;
23979
23980 int mem_base;
23981 xmlElementContentPtr ret_val;
23982 xmlDocPtr doc; /* the document owning the element declaration */
23983 int n_doc;
23984 xmlElementContentPtr cur; /* An element content pointer. */
23985 int n_cur;
23986
23987 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23988 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23989 mem_base = xmlMemBlocks();
23990 doc = gen_xmlDocPtr(n_doc, 0);
23991 cur = gen_xmlElementContentPtr(n_cur, 1);
23992
23993 ret_val = xmlCopyDocElementContent(doc, cur);
23994 desret_xmlElementContentPtr(ret_val);
23995 call_tests++;
23996 des_xmlDocPtr(n_doc, doc, 0);
23997 des_xmlElementContentPtr(n_cur, cur, 1);
23998 xmlResetLastError();
23999 if (mem_base != xmlMemBlocks()) {
24000 printf("Leak of %d blocks found in xmlCopyDocElementContent",
24001 xmlMemBlocks() - mem_base);
24002 test_ret++;
24003 printf(" %d", n_doc);
24004 printf(" %d", n_cur);
24005 printf("\n");
24006 }
24007 }
24008 }
24009 function_tests++;
24010
24011 return(test_ret);
24012}
24013
24014
24015static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024016test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024018
William M. Brack094dd862004-11-14 14:28:34 +000024019 int mem_base;
24020 xmlElementContentPtr ret_val;
24021 xmlElementContentPtr cur; /* An element content pointer. */
24022 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024023
William M. Brack094dd862004-11-14 14:28:34 +000024024 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
24025 mem_base = xmlMemBlocks();
24026 cur = gen_xmlElementContentPtr(n_cur, 0);
24027
24028 ret_val = xmlCopyElementContent(cur);
24029 desret_xmlElementContentPtr(ret_val);
24030 call_tests++;
24031 des_xmlElementContentPtr(n_cur, cur, 0);
24032 xmlResetLastError();
24033 if (mem_base != xmlMemBlocks()) {
24034 printf("Leak of %d blocks found in xmlCopyElementContent",
24035 xmlMemBlocks() - mem_base);
24036 test_ret++;
24037 printf(" %d", n_cur);
24038 printf("\n");
24039 }
24040 }
24041 function_tests++;
24042
Daniel Veillard42595322004-11-08 10:52:06 +000024043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024044}
24045
24046
Daniel Veillardce682bc2004-11-05 17:22:25 +000024047#define gen_nb_xmlElementTablePtr 1
24048static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24049 return(NULL);
24050}
24051static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24052}
24053
Daniel Veillardd93f6252004-11-02 15:53:51 +000024054static int
24055test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024057
24058
24059 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024061}
24062
24063
24064static int
24065test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024067
24068
24069 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024071}
24072
24073
Daniel Veillardce682bc2004-11-05 17:22:25 +000024074#define gen_nb_xmlNotationTablePtr 1
24075static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24076 return(NULL);
24077}
24078static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24079}
24080
Daniel Veillardd93f6252004-11-02 15:53:51 +000024081static int
24082test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024084
24085
24086 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024088}
24089
24090
24091static int
24092test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024094
24095
24096 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024098}
24099
24100
Daniel Veillardce682bc2004-11-05 17:22:25 +000024101#define gen_nb_xmlAttributePtr 1
24102static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24103 return(NULL);
24104}
24105static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24106}
24107
Daniel Veillardd93f6252004-11-02 15:53:51 +000024108static int
24109test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024111
William M. Brack21e4ef22005-01-02 09:53:13 +000024112#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024113 int mem_base;
24114 xmlBufferPtr buf; /* the XML buffer output */
24115 int n_buf;
24116 xmlAttributePtr attr; /* An attribute declaration */
24117 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024118
Daniel Veillardce682bc2004-11-05 17:22:25 +000024119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24120 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24121 mem_base = xmlMemBlocks();
24122 buf = gen_xmlBufferPtr(n_buf, 0);
24123 attr = gen_xmlAttributePtr(n_attr, 1);
24124
24125 xmlDumpAttributeDecl(buf, attr);
24126 call_tests++;
24127 des_xmlBufferPtr(n_buf, buf, 0);
24128 des_xmlAttributePtr(n_attr, attr, 1);
24129 xmlResetLastError();
24130 if (mem_base != xmlMemBlocks()) {
24131 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
24132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024134 printf(" %d", n_buf);
24135 printf(" %d", n_attr);
24136 printf("\n");
24137 }
24138 }
24139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024140 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024141#endif
24142
Daniel Veillard42595322004-11-08 10:52:06 +000024143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024144}
24145
24146
24147static int
24148test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024150
William M. Brack21e4ef22005-01-02 09:53:13 +000024151#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024152 int mem_base;
24153 xmlBufferPtr buf; /* the XML buffer output */
24154 int n_buf;
24155 xmlAttributeTablePtr table; /* An attribute table */
24156 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024157
Daniel Veillardce682bc2004-11-05 17:22:25 +000024158 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24159 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
24160 mem_base = xmlMemBlocks();
24161 buf = gen_xmlBufferPtr(n_buf, 0);
24162 table = gen_xmlAttributeTablePtr(n_table, 1);
24163
24164 xmlDumpAttributeTable(buf, table);
24165 call_tests++;
24166 des_xmlBufferPtr(n_buf, buf, 0);
24167 des_xmlAttributeTablePtr(n_table, table, 1);
24168 xmlResetLastError();
24169 if (mem_base != xmlMemBlocks()) {
24170 printf("Leak of %d blocks found in xmlDumpAttributeTable",
24171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024173 printf(" %d", n_buf);
24174 printf(" %d", n_table);
24175 printf("\n");
24176 }
24177 }
24178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024179 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024180#endif
24181
Daniel Veillard42595322004-11-08 10:52:06 +000024182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024183}
24184
24185
Daniel Veillardce682bc2004-11-05 17:22:25 +000024186#define gen_nb_xmlElementPtr 1
24187static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24188 return(NULL);
24189}
24190static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24191}
24192
Daniel Veillardd93f6252004-11-02 15:53:51 +000024193static int
24194test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024196
William M. Brack21e4ef22005-01-02 09:53:13 +000024197#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024198 int mem_base;
24199 xmlBufferPtr buf; /* the XML buffer output */
24200 int n_buf;
24201 xmlElementPtr elem; /* An element table */
24202 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024203
Daniel Veillardce682bc2004-11-05 17:22:25 +000024204 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24205 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24206 mem_base = xmlMemBlocks();
24207 buf = gen_xmlBufferPtr(n_buf, 0);
24208 elem = gen_xmlElementPtr(n_elem, 1);
24209
24210 xmlDumpElementDecl(buf, elem);
24211 call_tests++;
24212 des_xmlBufferPtr(n_buf, buf, 0);
24213 des_xmlElementPtr(n_elem, elem, 1);
24214 xmlResetLastError();
24215 if (mem_base != xmlMemBlocks()) {
24216 printf("Leak of %d blocks found in xmlDumpElementDecl",
24217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024218 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024219 printf(" %d", n_buf);
24220 printf(" %d", n_elem);
24221 printf("\n");
24222 }
24223 }
24224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024225 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024226#endif
24227
Daniel Veillard42595322004-11-08 10:52:06 +000024228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024229}
24230
24231
24232static int
24233test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024235
William M. Brack21e4ef22005-01-02 09:53:13 +000024236#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024237 int mem_base;
24238 xmlBufferPtr buf; /* the XML buffer output */
24239 int n_buf;
24240 xmlElementTablePtr table; /* An element table */
24241 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024242
Daniel Veillardce682bc2004-11-05 17:22:25 +000024243 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24244 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24245 mem_base = xmlMemBlocks();
24246 buf = gen_xmlBufferPtr(n_buf, 0);
24247 table = gen_xmlElementTablePtr(n_table, 1);
24248
24249 xmlDumpElementTable(buf, table);
24250 call_tests++;
24251 des_xmlBufferPtr(n_buf, buf, 0);
24252 des_xmlElementTablePtr(n_table, table, 1);
24253 xmlResetLastError();
24254 if (mem_base != xmlMemBlocks()) {
24255 printf("Leak of %d blocks found in xmlDumpElementTable",
24256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024257 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024258 printf(" %d", n_buf);
24259 printf(" %d", n_table);
24260 printf("\n");
24261 }
24262 }
24263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024264 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024265#endif
24266
Daniel Veillard42595322004-11-08 10:52:06 +000024267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024268}
24269
24270
Daniel Veillardce682bc2004-11-05 17:22:25 +000024271#define gen_nb_xmlNotationPtr 1
24272static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24273 return(NULL);
24274}
24275static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24276}
24277
Daniel Veillardd93f6252004-11-02 15:53:51 +000024278static int
24279test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024281
William M. Brack21e4ef22005-01-02 09:53:13 +000024282#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024283 int mem_base;
24284 xmlBufferPtr buf; /* the XML buffer output */
24285 int n_buf;
24286 xmlNotationPtr nota; /* A notation declaration */
24287 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024288
Daniel Veillardce682bc2004-11-05 17:22:25 +000024289 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24290 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24291 mem_base = xmlMemBlocks();
24292 buf = gen_xmlBufferPtr(n_buf, 0);
24293 nota = gen_xmlNotationPtr(n_nota, 1);
24294
24295 xmlDumpNotationDecl(buf, nota);
24296 call_tests++;
24297 des_xmlBufferPtr(n_buf, buf, 0);
24298 des_xmlNotationPtr(n_nota, nota, 1);
24299 xmlResetLastError();
24300 if (mem_base != xmlMemBlocks()) {
24301 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024303 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024304 printf(" %d", n_buf);
24305 printf(" %d", n_nota);
24306 printf("\n");
24307 }
24308 }
24309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024310 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024311#endif
24312
Daniel Veillard42595322004-11-08 10:52:06 +000024313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024314}
24315
24316
24317static int
24318test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024320
William M. Brack21e4ef22005-01-02 09:53:13 +000024321#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024322 int mem_base;
24323 xmlBufferPtr buf; /* the XML buffer output */
24324 int n_buf;
24325 xmlNotationTablePtr table; /* A notation table */
24326 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024327
Daniel Veillardce682bc2004-11-05 17:22:25 +000024328 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24329 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24330 mem_base = xmlMemBlocks();
24331 buf = gen_xmlBufferPtr(n_buf, 0);
24332 table = gen_xmlNotationTablePtr(n_table, 1);
24333
24334 xmlDumpNotationTable(buf, table);
24335 call_tests++;
24336 des_xmlBufferPtr(n_buf, buf, 0);
24337 des_xmlNotationTablePtr(n_table, table, 1);
24338 xmlResetLastError();
24339 if (mem_base != xmlMemBlocks()) {
24340 printf("Leak of %d blocks found in xmlDumpNotationTable",
24341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024342 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024343 printf(" %d", n_buf);
24344 printf(" %d", n_table);
24345 printf("\n");
24346 }
24347 }
24348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024349 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024350#endif
24351
Daniel Veillard42595322004-11-08 10:52:06 +000024352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024353}
24354
24355
24356static int
24357test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024359
Daniel Veillard42595322004-11-08 10:52:06 +000024360 int mem_base;
24361 xmlAttributePtr ret_val;
24362 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24363 int n_dtd;
24364 xmlChar * elem; /* the element name */
24365 int n_elem;
24366 xmlChar * name; /* the attribute name */
24367 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024368
Daniel Veillard42595322004-11-08 10:52:06 +000024369 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24370 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24372 mem_base = xmlMemBlocks();
24373 dtd = gen_xmlDtdPtr(n_dtd, 0);
24374 elem = gen_const_xmlChar_ptr(n_elem, 1);
24375 name = gen_const_xmlChar_ptr(n_name, 2);
24376
William M. Brackf13f77f2004-11-12 16:03:48 +000024377 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024378 desret_xmlAttributePtr(ret_val);
24379 call_tests++;
24380 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024381 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24382 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024383 xmlResetLastError();
24384 if (mem_base != xmlMemBlocks()) {
24385 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24386 xmlMemBlocks() - mem_base);
24387 test_ret++;
24388 printf(" %d", n_dtd);
24389 printf(" %d", n_elem);
24390 printf(" %d", n_name);
24391 printf("\n");
24392 }
24393 }
24394 }
24395 }
Daniel Veillard42595322004-11-08 10:52:06 +000024396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024397
Daniel Veillard42595322004-11-08 10:52:06 +000024398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399}
24400
24401
24402static int
24403test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024405
Daniel Veillard42595322004-11-08 10:52:06 +000024406 int mem_base;
24407 xmlElementPtr ret_val;
24408 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24409 int n_dtd;
24410 xmlChar * name; /* the element name */
24411 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024412
Daniel Veillard42595322004-11-08 10:52:06 +000024413 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24414 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24415 mem_base = xmlMemBlocks();
24416 dtd = gen_xmlDtdPtr(n_dtd, 0);
24417 name = gen_const_xmlChar_ptr(n_name, 1);
24418
William M. Brackf13f77f2004-11-12 16:03:48 +000024419 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024420 desret_xmlElementPtr(ret_val);
24421 call_tests++;
24422 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024423 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024424 xmlResetLastError();
24425 if (mem_base != xmlMemBlocks()) {
24426 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24427 xmlMemBlocks() - mem_base);
24428 test_ret++;
24429 printf(" %d", n_dtd);
24430 printf(" %d", n_name);
24431 printf("\n");
24432 }
24433 }
24434 }
Daniel Veillard42595322004-11-08 10:52:06 +000024435 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024436
Daniel Veillard42595322004-11-08 10:52:06 +000024437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024438}
24439
24440
24441static int
24442test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024444
24445
24446 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024448}
24449
24450
24451static int
24452test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024454
Daniel Veillard42595322004-11-08 10:52:06 +000024455 int mem_base;
24456 xmlAttributePtr ret_val;
24457 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24458 int n_dtd;
24459 xmlChar * elem; /* the element name */
24460 int n_elem;
24461 xmlChar * name; /* the attribute name */
24462 int n_name;
24463 xmlChar * prefix; /* the attribute namespace prefix */
24464 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024465
Daniel Veillard42595322004-11-08 10:52:06 +000024466 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24467 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24469 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24470 mem_base = xmlMemBlocks();
24471 dtd = gen_xmlDtdPtr(n_dtd, 0);
24472 elem = gen_const_xmlChar_ptr(n_elem, 1);
24473 name = gen_const_xmlChar_ptr(n_name, 2);
24474 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24475
William M. Brackf13f77f2004-11-12 16:03:48 +000024476 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024477 desret_xmlAttributePtr(ret_val);
24478 call_tests++;
24479 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024480 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24481 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24482 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024483 xmlResetLastError();
24484 if (mem_base != xmlMemBlocks()) {
24485 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24486 xmlMemBlocks() - mem_base);
24487 test_ret++;
24488 printf(" %d", n_dtd);
24489 printf(" %d", n_elem);
24490 printf(" %d", n_name);
24491 printf(" %d", n_prefix);
24492 printf("\n");
24493 }
24494 }
24495 }
24496 }
24497 }
Daniel Veillard42595322004-11-08 10:52:06 +000024498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024499
Daniel Veillard42595322004-11-08 10:52:06 +000024500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024501}
24502
24503
24504static int
24505test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024507
Daniel Veillard42595322004-11-08 10:52:06 +000024508 int mem_base;
24509 xmlElementPtr ret_val;
24510 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24511 int n_dtd;
24512 xmlChar * name; /* the element name */
24513 int n_name;
24514 xmlChar * prefix; /* the element namespace prefix */
24515 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024516
Daniel Veillard42595322004-11-08 10:52:06 +000024517 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24518 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24519 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24520 mem_base = xmlMemBlocks();
24521 dtd = gen_xmlDtdPtr(n_dtd, 0);
24522 name = gen_const_xmlChar_ptr(n_name, 1);
24523 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24524
William M. Brackf13f77f2004-11-12 16:03:48 +000024525 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024526 desret_xmlElementPtr(ret_val);
24527 call_tests++;
24528 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024529 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24530 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024531 xmlResetLastError();
24532 if (mem_base != xmlMemBlocks()) {
24533 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24534 xmlMemBlocks() - mem_base);
24535 test_ret++;
24536 printf(" %d", n_dtd);
24537 printf(" %d", n_name);
24538 printf(" %d", n_prefix);
24539 printf("\n");
24540 }
24541 }
24542 }
24543 }
Daniel Veillard42595322004-11-08 10:52:06 +000024544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024545
Daniel Veillard42595322004-11-08 10:52:06 +000024546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024547}
24548
24549
24550static int
24551test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024553
Daniel Veillard57b25162004-11-06 14:50:18 +000024554 int mem_base;
24555 xmlAttrPtr ret_val;
24556 xmlDocPtr doc; /* pointer to the document */
24557 int n_doc;
24558 xmlChar * ID; /* the ID value */
24559 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024560
Daniel Veillard57b25162004-11-06 14:50:18 +000024561 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24562 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24563 mem_base = xmlMemBlocks();
24564 doc = gen_xmlDocPtr(n_doc, 0);
24565 ID = gen_const_xmlChar_ptr(n_ID, 1);
24566
William M. Brackf13f77f2004-11-12 16:03:48 +000024567 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024568 desret_xmlAttrPtr(ret_val);
24569 call_tests++;
24570 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024571 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024572 xmlResetLastError();
24573 if (mem_base != xmlMemBlocks()) {
24574 printf("Leak of %d blocks found in xmlGetID",
24575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024576 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024577 printf(" %d", n_doc);
24578 printf(" %d", n_ID);
24579 printf("\n");
24580 }
24581 }
24582 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024584
Daniel Veillard42595322004-11-08 10:52:06 +000024585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024586}
24587
24588
24589static int
24590test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024592
24593
24594 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024596}
24597
24598
24599static int
24600test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024602
Daniel Veillardce244ad2004-11-05 10:03:46 +000024603 int mem_base;
24604 int ret_val;
24605 xmlDocPtr doc; /* the document */
24606 int n_doc;
24607 xmlNodePtr elem; /* the element carrying the attribute */
24608 int n_elem;
24609 xmlAttrPtr attr; /* the attribute */
24610 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024611
Daniel Veillardce244ad2004-11-05 10:03:46 +000024612 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24613 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24614 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24615 mem_base = xmlMemBlocks();
24616 doc = gen_xmlDocPtr(n_doc, 0);
24617 elem = gen_xmlNodePtr(n_elem, 1);
24618 attr = gen_xmlAttrPtr(n_attr, 2);
24619
24620 ret_val = xmlIsID(doc, elem, attr);
24621 desret_int(ret_val);
24622 call_tests++;
24623 des_xmlDocPtr(n_doc, doc, 0);
24624 des_xmlNodePtr(n_elem, elem, 1);
24625 des_xmlAttrPtr(n_attr, attr, 2);
24626 xmlResetLastError();
24627 if (mem_base != xmlMemBlocks()) {
24628 printf("Leak of %d blocks found in xmlIsID",
24629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024630 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024631 printf(" %d", n_doc);
24632 printf(" %d", n_elem);
24633 printf(" %d", n_attr);
24634 printf("\n");
24635 }
24636 }
24637 }
24638 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024640
Daniel Veillard42595322004-11-08 10:52:06 +000024641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024642}
24643
24644
24645static int
24646test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024648
24649 int mem_base;
24650 int ret_val;
24651 xmlDocPtr doc; /* the document */
24652 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024653 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024654 int n_name;
24655
24656 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24657 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024659 doc = gen_xmlDocPtr(n_doc, 0);
24660 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024661
William M. Brackf13f77f2004-11-12 16:03:48 +000024662 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024663 desret_int(ret_val);
24664 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024665 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024666 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024667 xmlResetLastError();
24668 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024669 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024671 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024672 printf(" %d", n_doc);
24673 printf(" %d", n_name);
24674 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024675 }
24676 }
24677 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024678 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024679
Daniel Veillard42595322004-11-08 10:52:06 +000024680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024681}
24682
24683
24684static int
24685test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024687
Daniel Veillardce244ad2004-11-05 10:03:46 +000024688 int mem_base;
24689 int ret_val;
24690 xmlDocPtr doc; /* the document */
24691 int n_doc;
24692 xmlNodePtr elem; /* the element carrying the attribute */
24693 int n_elem;
24694 xmlAttrPtr attr; /* the attribute */
24695 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024696
Daniel Veillardce244ad2004-11-05 10:03:46 +000024697 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24698 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24699 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24700 mem_base = xmlMemBlocks();
24701 doc = gen_xmlDocPtr(n_doc, 0);
24702 elem = gen_xmlNodePtr(n_elem, 1);
24703 attr = gen_xmlAttrPtr(n_attr, 2);
24704
24705 ret_val = xmlIsRef(doc, elem, attr);
24706 desret_int(ret_val);
24707 call_tests++;
24708 des_xmlDocPtr(n_doc, doc, 0);
24709 des_xmlNodePtr(n_elem, elem, 1);
24710 des_xmlAttrPtr(n_attr, attr, 2);
24711 xmlResetLastError();
24712 if (mem_base != xmlMemBlocks()) {
24713 printf("Leak of %d blocks found in xmlIsRef",
24714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024715 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024716 printf(" %d", n_doc);
24717 printf(" %d", n_elem);
24718 printf(" %d", n_attr);
24719 printf("\n");
24720 }
24721 }
24722 }
24723 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024725
Daniel Veillard42595322004-11-08 10:52:06 +000024726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024727}
24728
24729
24730static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024731test_xmlNewDocElementContent(void) {
24732 int test_ret = 0;
24733
24734 int mem_base;
24735 xmlElementContentPtr ret_val;
24736 xmlDocPtr doc; /* the document */
24737 int n_doc;
24738 xmlChar * name; /* the subelement name or NULL */
24739 int n_name;
24740 xmlElementContentType type; /* the type of element content decl */
24741 int n_type;
24742
24743 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24744 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24745 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24746 mem_base = xmlMemBlocks();
24747 doc = gen_xmlDocPtr(n_doc, 0);
24748 name = gen_const_xmlChar_ptr(n_name, 1);
24749 type = gen_xmlElementContentType(n_type, 2);
24750
24751 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024752 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024753 desret_xmlElementContentPtr(ret_val);
24754 call_tests++;
24755 des_xmlDocPtr(n_doc, doc, 0);
24756 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24757 des_xmlElementContentType(n_type, type, 2);
24758 xmlResetLastError();
24759 if (mem_base != xmlMemBlocks()) {
24760 printf("Leak of %d blocks found in xmlNewDocElementContent",
24761 xmlMemBlocks() - mem_base);
24762 test_ret++;
24763 printf(" %d", n_doc);
24764 printf(" %d", n_name);
24765 printf(" %d", n_type);
24766 printf("\n");
24767 }
24768 }
24769 }
24770 }
24771 function_tests++;
24772
24773 return(test_ret);
24774}
24775
24776
24777static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024778test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024780
William M. Brack094dd862004-11-14 14:28:34 +000024781 int mem_base;
24782 xmlElementContentPtr ret_val;
24783 xmlChar * name; /* the subelement name or NULL */
24784 int n_name;
24785 xmlElementContentType type; /* the type of element content decl */
24786 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024787
William M. Brack094dd862004-11-14 14:28:34 +000024788 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24789 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24790 mem_base = xmlMemBlocks();
24791 name = gen_const_xmlChar_ptr(n_name, 0);
24792 type = gen_xmlElementContentType(n_type, 1);
24793
24794 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24795 desret_xmlElementContentPtr(ret_val);
24796 call_tests++;
24797 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24798 des_xmlElementContentType(n_type, type, 1);
24799 xmlResetLastError();
24800 if (mem_base != xmlMemBlocks()) {
24801 printf("Leak of %d blocks found in xmlNewElementContent",
24802 xmlMemBlocks() - mem_base);
24803 test_ret++;
24804 printf(" %d", n_name);
24805 printf(" %d", n_type);
24806 printf("\n");
24807 }
24808 }
24809 }
24810 function_tests++;
24811
Daniel Veillard42595322004-11-08 10:52:06 +000024812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024813}
24814
24815
24816static int
24817test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024819
24820
24821 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024823}
24824
24825
24826static int
24827test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024829
Daniel Veillardce244ad2004-11-05 10:03:46 +000024830 int mem_base;
24831 int ret_val;
24832 xmlDocPtr doc; /* the document */
24833 int n_doc;
24834 xmlAttrPtr attr; /* the attribute */
24835 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024836
Daniel Veillardce244ad2004-11-05 10:03:46 +000024837 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24838 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24839 mem_base = xmlMemBlocks();
24840 doc = gen_xmlDocPtr(n_doc, 0);
24841 attr = gen_xmlAttrPtr(n_attr, 1);
24842
24843 ret_val = xmlRemoveID(doc, attr);
24844 desret_int(ret_val);
24845 call_tests++;
24846 des_xmlDocPtr(n_doc, doc, 0);
24847 des_xmlAttrPtr(n_attr, attr, 1);
24848 xmlResetLastError();
24849 if (mem_base != xmlMemBlocks()) {
24850 printf("Leak of %d blocks found in xmlRemoveID",
24851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024852 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024853 printf(" %d", n_doc);
24854 printf(" %d", n_attr);
24855 printf("\n");
24856 }
24857 }
24858 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024859 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024860
Daniel Veillard42595322004-11-08 10:52:06 +000024861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024862}
24863
24864
24865static int
24866test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024868
Daniel Veillardce244ad2004-11-05 10:03:46 +000024869 int mem_base;
24870 int ret_val;
24871 xmlDocPtr doc; /* the document */
24872 int n_doc;
24873 xmlAttrPtr attr; /* the attribute */
24874 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024875
Daniel Veillardce244ad2004-11-05 10:03:46 +000024876 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24877 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24878 mem_base = xmlMemBlocks();
24879 doc = gen_xmlDocPtr(n_doc, 0);
24880 attr = gen_xmlAttrPtr(n_attr, 1);
24881
24882 ret_val = xmlRemoveRef(doc, attr);
24883 desret_int(ret_val);
24884 call_tests++;
24885 des_xmlDocPtr(n_doc, doc, 0);
24886 des_xmlAttrPtr(n_attr, attr, 1);
24887 xmlResetLastError();
24888 if (mem_base != xmlMemBlocks()) {
24889 printf("Leak of %d blocks found in xmlRemoveRef",
24890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024891 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024892 printf(" %d", n_doc);
24893 printf(" %d", n_attr);
24894 printf("\n");
24895 }
24896 }
24897 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024898 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024899
Daniel Veillard42595322004-11-08 10:52:06 +000024900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024901}
24902
24903
24904static int
24905test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024907
Daniel Veillardce682bc2004-11-05 17:22:25 +000024908 int mem_base;
24909 char * buf; /* an output buffer */
24910 int n_buf;
24911 int size; /* the buffer size */
24912 int n_size;
24913 xmlElementContentPtr content; /* An element table */
24914 int n_content;
Daniel Veillard95175012005-07-03 16:09:51 +000024915 int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24916 int n_englob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024917
Daniel Veillardce682bc2004-11-05 17:22:25 +000024918 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24919 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24920 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
Daniel Veillard95175012005-07-03 16:09:51 +000024921 for (n_englob = 0;n_englob < gen_nb_int;n_englob++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +000024922 mem_base = xmlMemBlocks();
24923 buf = gen_char_ptr(n_buf, 0);
24924 size = gen_int(n_size, 1);
24925 content = gen_xmlElementContentPtr(n_content, 2);
Daniel Veillard95175012005-07-03 16:09:51 +000024926 englob = gen_int(n_englob, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024927
Daniel Veillard95175012005-07-03 16:09:51 +000024928 xmlSnprintfElementContent(buf, size, content, englob);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024929 call_tests++;
24930 des_char_ptr(n_buf, buf, 0);
24931 des_int(n_size, size, 1);
24932 des_xmlElementContentPtr(n_content, content, 2);
Daniel Veillard95175012005-07-03 16:09:51 +000024933 des_int(n_englob, englob, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024934 xmlResetLastError();
24935 if (mem_base != xmlMemBlocks()) {
24936 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024938 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024939 printf(" %d", n_buf);
24940 printf(" %d", n_size);
24941 printf(" %d", n_content);
Daniel Veillard95175012005-07-03 16:09:51 +000024942 printf(" %d", n_englob);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024943 printf("\n");
24944 }
24945 }
24946 }
24947 }
24948 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024950
Daniel Veillard42595322004-11-08 10:52:06 +000024951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024952}
24953
24954
24955static int
24956test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024958
William M. Brack21e4ef22005-01-02 09:53:13 +000024959#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024960#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024961 int mem_base;
24962 char * buf; /* an output buffer */
24963 int n_buf;
24964 xmlElementContentPtr content; /* An element table */
24965 int n_content;
Daniel Veillard95175012005-07-03 16:09:51 +000024966 int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24967 int n_englob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024968
Daniel Veillardce682bc2004-11-05 17:22:25 +000024969 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24970 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
Daniel Veillard95175012005-07-03 16:09:51 +000024971 for (n_englob = 0;n_englob < gen_nb_int;n_englob++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +000024972 mem_base = xmlMemBlocks();
24973 buf = gen_char_ptr(n_buf, 0);
24974 content = gen_xmlElementContentPtr(n_content, 1);
Daniel Veillard95175012005-07-03 16:09:51 +000024975 englob = gen_int(n_englob, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024976
Daniel Veillard95175012005-07-03 16:09:51 +000024977 xmlSprintfElementContent(buf, content, englob);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024978 call_tests++;
24979 des_char_ptr(n_buf, buf, 0);
24980 des_xmlElementContentPtr(n_content, content, 1);
Daniel Veillard95175012005-07-03 16:09:51 +000024981 des_int(n_englob, englob, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024982 xmlResetLastError();
24983 if (mem_base != xmlMemBlocks()) {
24984 printf("Leak of %d blocks found in xmlSprintfElementContent",
24985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024986 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024987 printf(" %d", n_buf);
24988 printf(" %d", n_content);
Daniel Veillard95175012005-07-03 16:09:51 +000024989 printf(" %d", n_englob);
Daniel Veillardce682bc2004-11-05 17:22:25 +000024990 printf("\n");
24991 }
24992 }
24993 }
24994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024995 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024996#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024997#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024998
Daniel Veillard42595322004-11-08 10:52:06 +000024999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025000}
25001
25002
25003static int
25004test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025006
William M. Brack21e4ef22005-01-02 09:53:13 +000025007#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025008 int mem_base;
25009 int ret_val;
25010 xmlValidCtxtPtr ctxt; /* a validation context */
25011 int n_ctxt;
25012 xmlElementPtr elem; /* an element declaration node */
25013 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025014
Daniel Veillardce682bc2004-11-05 17:22:25 +000025015 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25016 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25017 mem_base = xmlMemBlocks();
25018 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25019 elem = gen_xmlElementPtr(n_elem, 1);
25020
25021 ret_val = xmlValidBuildContentModel(ctxt, elem);
25022 desret_int(ret_val);
25023 call_tests++;
25024 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25025 des_xmlElementPtr(n_elem, elem, 1);
25026 xmlResetLastError();
25027 if (mem_base != xmlMemBlocks()) {
25028 printf("Leak of %d blocks found in xmlValidBuildContentModel",
25029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025030 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025031 printf(" %d", n_ctxt);
25032 printf(" %d", n_elem);
25033 printf("\n");
25034 }
25035 }
25036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025037 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025038#endif
25039
Daniel Veillard42595322004-11-08 10:52:06 +000025040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025041}
25042
25043
25044static int
25045test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025047
William M. Brack21e4ef22005-01-02 09:53:13 +000025048#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025049 int mem_base;
25050 xmlChar * ret_val;
25051 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
25052 int n_ctxt;
25053 xmlDocPtr doc; /* the document */
25054 int n_doc;
25055 xmlNodePtr elem; /* the parent */
25056 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025057 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025058 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025059 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025060 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025061
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025062 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25063 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25064 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25065 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25066 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25067 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025068 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25069 doc = gen_xmlDocPtr(n_doc, 1);
25070 elem = gen_xmlNodePtr(n_elem, 2);
25071 name = gen_const_xmlChar_ptr(n_name, 3);
25072 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025073
William M. Brackf13f77f2004-11-12 16:03:48 +000025074 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025075 desret_xmlChar_ptr(ret_val);
25076 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025077 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25078 des_xmlDocPtr(n_doc, doc, 1);
25079 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025080 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
25081 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025082 xmlResetLastError();
25083 if (mem_base != xmlMemBlocks()) {
25084 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
25085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025086 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025087 printf(" %d", n_ctxt);
25088 printf(" %d", n_doc);
25089 printf(" %d", n_elem);
25090 printf(" %d", n_name);
25091 printf(" %d", n_value);
25092 printf("\n");
25093 }
25094 }
25095 }
25096 }
25097 }
25098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025099 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025100#endif
25101
Daniel Veillard42595322004-11-08 10:52:06 +000025102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025103}
25104
25105
Daniel Veillardce682bc2004-11-05 17:22:25 +000025106#define gen_nb_xmlElementContent_ptr 1
25107static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25108 return(NULL);
25109}
25110static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25111}
25112
Daniel Veillardd93f6252004-11-02 15:53:51 +000025113static int
25114test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025116
William M. Brack21e4ef22005-01-02 09:53:13 +000025117#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000025118#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025119 int mem_base;
25120 int ret_val;
25121 xmlElementContent * ctree; /* an element content tree */
25122 int n_ctree;
25123 xmlChar ** list; /* an array to store the list of child names */
25124 int n_list;
25125 int * len; /* a pointer to the number of element in the list */
25126 int n_len;
25127 int max; /* the size of the array */
25128 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025129
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025130 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
25131 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
25132 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
25133 for (n_max = 0;n_max < gen_nb_int;n_max++) {
25134 mem_base = xmlMemBlocks();
25135 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
25136 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
25137 len = gen_int_ptr(n_len, 2);
25138 max = gen_int(n_max, 3);
25139
William M. Brackf13f77f2004-11-12 16:03:48 +000025140 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025141 desret_int(ret_val);
25142 call_tests++;
25143 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025144 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025145 des_int_ptr(n_len, len, 2);
25146 des_int(n_max, max, 3);
25147 xmlResetLastError();
25148 if (mem_base != xmlMemBlocks()) {
25149 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
25150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025151 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025152 printf(" %d", n_ctree);
25153 printf(" %d", n_list);
25154 printf(" %d", n_len);
25155 printf(" %d", n_max);
25156 printf("\n");
25157 }
25158 }
25159 }
25160 }
25161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025162 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025163#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025164#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025165
Daniel Veillard42595322004-11-08 10:52:06 +000025166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025167}
25168
25169
25170static int
25171test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025173
William M. Brack21e4ef22005-01-02 09:53:13 +000025174#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000025175#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025176 int mem_base;
25177 int ret_val;
25178 xmlNode * prev; /* an element to insert after */
25179 int n_prev;
25180 xmlNode * next; /* an element to insert next */
25181 int n_next;
25182 xmlChar ** names; /* an array to store the list of child names */
25183 int n_names;
25184 int max; /* the size of the array */
25185 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025186
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025187 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
25188 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
25189 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
25190 for (n_max = 0;n_max < gen_nb_int;n_max++) {
25191 mem_base = xmlMemBlocks();
25192 prev = gen_xmlNodePtr(n_prev, 0);
25193 next = gen_xmlNodePtr(n_next, 1);
25194 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
25195 max = gen_int(n_max, 3);
25196
William M. Brackf13f77f2004-11-12 16:03:48 +000025197 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025198 desret_int(ret_val);
25199 call_tests++;
25200 des_xmlNodePtr(n_prev, prev, 0);
25201 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025202 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025203 des_int(n_max, max, 3);
25204 xmlResetLastError();
25205 if (mem_base != xmlMemBlocks()) {
25206 printf("Leak of %d blocks found in xmlValidGetValidElements",
25207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025208 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025209 printf(" %d", n_prev);
25210 printf(" %d", n_next);
25211 printf(" %d", n_names);
25212 printf(" %d", n_max);
25213 printf("\n");
25214 }
25215 }
25216 }
25217 }
25218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025219 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025220#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025221#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025222
Daniel Veillard42595322004-11-08 10:52:06 +000025223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025224}
25225
25226
25227static int
25228test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025230
William M. Brack21e4ef22005-01-02 09:53:13 +000025231#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025232 int mem_base;
25233 xmlChar * ret_val;
25234 xmlDocPtr doc; /* the document */
25235 int n_doc;
25236 xmlNodePtr elem; /* the parent */
25237 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025238 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025239 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025240 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025241 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025242
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025243 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25244 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25245 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25246 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025248 doc = gen_xmlDocPtr(n_doc, 0);
25249 elem = gen_xmlNodePtr(n_elem, 1);
25250 name = gen_const_xmlChar_ptr(n_name, 2);
25251 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025252
William M. Brackf13f77f2004-11-12 16:03:48 +000025253 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025254 desret_xmlChar_ptr(ret_val);
25255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025256 des_xmlDocPtr(n_doc, doc, 0);
25257 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025258 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25259 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025260 xmlResetLastError();
25261 if (mem_base != xmlMemBlocks()) {
25262 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025264 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025265 printf(" %d", n_doc);
25266 printf(" %d", n_elem);
25267 printf(" %d", n_name);
25268 printf(" %d", n_value);
25269 printf("\n");
25270 }
25271 }
25272 }
25273 }
25274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025275 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025276#endif
25277
Daniel Veillard42595322004-11-08 10:52:06 +000025278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025279}
25280
25281
25282static int
25283test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025285
William M. Brack21e4ef22005-01-02 09:53:13 +000025286#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025287 int mem_base;
25288 int ret_val;
25289 xmlValidCtxtPtr ctxt; /* the validation context */
25290 int n_ctxt;
25291 xmlDocPtr doc; /* a document instance */
25292 int n_doc;
25293 xmlAttributePtr attr; /* an attribute definition */
25294 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025295
Daniel Veillardce682bc2004-11-05 17:22:25 +000025296 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25298 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25299 mem_base = xmlMemBlocks();
25300 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25301 doc = gen_xmlDocPtr(n_doc, 1);
25302 attr = gen_xmlAttributePtr(n_attr, 2);
25303
25304 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25305 desret_int(ret_val);
25306 call_tests++;
25307 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25308 des_xmlDocPtr(n_doc, doc, 1);
25309 des_xmlAttributePtr(n_attr, attr, 2);
25310 xmlResetLastError();
25311 if (mem_base != xmlMemBlocks()) {
25312 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025314 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025315 printf(" %d", n_ctxt);
25316 printf(" %d", n_doc);
25317 printf(" %d", n_attr);
25318 printf("\n");
25319 }
25320 }
25321 }
25322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025323 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025324#endif
25325
Daniel Veillard42595322004-11-08 10:52:06 +000025326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025327}
25328
25329
25330static int
25331test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025333
William M. Brack21e4ef22005-01-02 09:53:13 +000025334#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025335 int mem_base;
25336 int ret_val;
25337 xmlAttributeType type; /* an attribute type */
25338 int n_type;
25339 xmlChar * value; /* an attribute value */
25340 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025341
Daniel Veillard57b25162004-11-06 14:50:18 +000025342 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25343 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25344 mem_base = xmlMemBlocks();
25345 type = gen_xmlAttributeType(n_type, 0);
25346 value = gen_const_xmlChar_ptr(n_value, 1);
25347
William M. Brackf13f77f2004-11-12 16:03:48 +000025348 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025349 desret_int(ret_val);
25350 call_tests++;
25351 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025352 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025353 xmlResetLastError();
25354 if (mem_base != xmlMemBlocks()) {
25355 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025357 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025358 printf(" %d", n_type);
25359 printf(" %d", n_value);
25360 printf("\n");
25361 }
25362 }
25363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025364 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025365#endif
25366
Daniel Veillard42595322004-11-08 10:52:06 +000025367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025368}
25369
25370
25371static int
25372test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025374
William M. Brack21e4ef22005-01-02 09:53:13 +000025375#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025376 int mem_base;
25377 int ret_val;
25378 xmlValidCtxtPtr ctxt; /* the validation context */
25379 int n_ctxt;
25380 xmlDocPtr doc; /* a document instance */
25381 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025382
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025383 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25384 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025386 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25387 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025388
25389 ret_val = xmlValidateDocument(ctxt, doc);
25390 desret_int(ret_val);
25391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025392 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25393 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025394 xmlResetLastError();
25395 if (mem_base != xmlMemBlocks()) {
25396 printf("Leak of %d blocks found in xmlValidateDocument",
25397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025398 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025399 printf(" %d", n_ctxt);
25400 printf(" %d", n_doc);
25401 printf("\n");
25402 }
25403 }
25404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025405 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025406#endif
25407
Daniel Veillard42595322004-11-08 10:52:06 +000025408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025409}
25410
25411
25412static int
25413test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025415
William M. Brack21e4ef22005-01-02 09:53:13 +000025416#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025417 int mem_base;
25418 int ret_val;
25419 xmlValidCtxtPtr ctxt; /* the validation context */
25420 int n_ctxt;
25421 xmlDocPtr doc; /* a document instance */
25422 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025424 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25425 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025427 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25428 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025429
25430 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25431 desret_int(ret_val);
25432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025433 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25434 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025435 xmlResetLastError();
25436 if (mem_base != xmlMemBlocks()) {
25437 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025439 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025440 printf(" %d", n_ctxt);
25441 printf(" %d", n_doc);
25442 printf("\n");
25443 }
25444 }
25445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025446 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025447#endif
25448
Daniel Veillard42595322004-11-08 10:52:06 +000025449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025450}
25451
25452
25453static int
25454test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025456
William M. Brack21e4ef22005-01-02 09:53:13 +000025457#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025458 int mem_base;
25459 int ret_val;
25460 xmlValidCtxtPtr ctxt; /* the validation context */
25461 int n_ctxt;
25462 xmlDocPtr doc; /* a document instance */
25463 int n_doc;
25464 xmlDtdPtr dtd; /* a dtd instance */
25465 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025466
Daniel Veillard27f20102004-11-05 11:50:11 +000025467 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25468 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25469 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25470 mem_base = xmlMemBlocks();
25471 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25472 doc = gen_xmlDocPtr(n_doc, 1);
25473 dtd = gen_xmlDtdPtr(n_dtd, 2);
25474
25475 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25476 desret_int(ret_val);
25477 call_tests++;
25478 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25479 des_xmlDocPtr(n_doc, doc, 1);
25480 des_xmlDtdPtr(n_dtd, dtd, 2);
25481 xmlResetLastError();
25482 if (mem_base != xmlMemBlocks()) {
25483 printf("Leak of %d blocks found in xmlValidateDtd",
25484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025485 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025486 printf(" %d", n_ctxt);
25487 printf(" %d", n_doc);
25488 printf(" %d", n_dtd);
25489 printf("\n");
25490 }
25491 }
25492 }
25493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025494 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025495#endif
25496
Daniel Veillard42595322004-11-08 10:52:06 +000025497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025498}
25499
25500
25501static int
25502test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025504
William M. Brack21e4ef22005-01-02 09:53:13 +000025505#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025506 int mem_base;
25507 int ret_val;
25508 xmlValidCtxtPtr ctxt; /* the validation context */
25509 int n_ctxt;
25510 xmlDocPtr doc; /* a document instance */
25511 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025512
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025513 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25514 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025516 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25517 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025518
25519 ret_val = xmlValidateDtdFinal(ctxt, doc);
25520 desret_int(ret_val);
25521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025522 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25523 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025524 xmlResetLastError();
25525 if (mem_base != xmlMemBlocks()) {
25526 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025528 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025529 printf(" %d", n_ctxt);
25530 printf(" %d", n_doc);
25531 printf("\n");
25532 }
25533 }
25534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025535 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025536#endif
25537
Daniel Veillard42595322004-11-08 10:52:06 +000025538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025539}
25540
25541
25542static int
25543test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025545
William M. Brack21e4ef22005-01-02 09:53:13 +000025546#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025547 int mem_base;
25548 int ret_val;
25549 xmlValidCtxtPtr ctxt; /* the validation context */
25550 int n_ctxt;
25551 xmlDocPtr doc; /* a document instance */
25552 int n_doc;
25553 xmlNodePtr elem; /* an element instance */
25554 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025555
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025556 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25557 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25558 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025560 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25561 doc = gen_xmlDocPtr(n_doc, 1);
25562 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025563
25564 ret_val = xmlValidateElement(ctxt, doc, elem);
25565 desret_int(ret_val);
25566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025567 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25568 des_xmlDocPtr(n_doc, doc, 1);
25569 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025570 xmlResetLastError();
25571 if (mem_base != xmlMemBlocks()) {
25572 printf("Leak of %d blocks found in xmlValidateElement",
25573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025574 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025575 printf(" %d", n_ctxt);
25576 printf(" %d", n_doc);
25577 printf(" %d", n_elem);
25578 printf("\n");
25579 }
25580 }
25581 }
25582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025583 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025584#endif
25585
Daniel Veillard42595322004-11-08 10:52:06 +000025586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025587}
25588
25589
25590static int
25591test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025593
William M. Brack21e4ef22005-01-02 09:53:13 +000025594#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025595 int mem_base;
25596 int ret_val;
25597 xmlValidCtxtPtr ctxt; /* the validation context */
25598 int n_ctxt;
25599 xmlDocPtr doc; /* a document instance */
25600 int n_doc;
25601 xmlElementPtr elem; /* an element definition */
25602 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025603
Daniel Veillardce682bc2004-11-05 17:22:25 +000025604 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25605 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25606 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25607 mem_base = xmlMemBlocks();
25608 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25609 doc = gen_xmlDocPtr(n_doc, 1);
25610 elem = gen_xmlElementPtr(n_elem, 2);
25611
25612 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25613 desret_int(ret_val);
25614 call_tests++;
25615 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25616 des_xmlDocPtr(n_doc, doc, 1);
25617 des_xmlElementPtr(n_elem, elem, 2);
25618 xmlResetLastError();
25619 if (mem_base != xmlMemBlocks()) {
25620 printf("Leak of %d blocks found in xmlValidateElementDecl",
25621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025622 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025623 printf(" %d", n_ctxt);
25624 printf(" %d", n_doc);
25625 printf(" %d", n_elem);
25626 printf("\n");
25627 }
25628 }
25629 }
25630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025631 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025632#endif
25633
Daniel Veillard42595322004-11-08 10:52:06 +000025634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025635}
25636
25637
25638static int
25639test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025641
William M. Brack21e4ef22005-01-02 09:53:13 +000025642#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025643 int mem_base;
25644 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025645 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025646 int n_value;
25647
25648 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25649 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025650 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025651
William M. Brackf13f77f2004-11-12 16:03:48 +000025652 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025653 desret_int(ret_val);
25654 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025655 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025656 xmlResetLastError();
25657 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025658 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025660 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025661 printf(" %d", n_value);
25662 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025663 }
25664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025665 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025666#endif
25667
Daniel Veillard42595322004-11-08 10:52:06 +000025668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025669}
25670
25671
25672static int
25673test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025675
William M. Brack21e4ef22005-01-02 09:53:13 +000025676#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025677 int mem_base;
25678 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025679 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025680 int n_value;
25681
25682 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025684 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025685
William M. Brackf13f77f2004-11-12 16:03:48 +000025686 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025687 desret_int(ret_val);
25688 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025689 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025690 xmlResetLastError();
25691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025692 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025695 printf(" %d", n_value);
25696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025697 }
25698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025699 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025700#endif
25701
Daniel Veillard42595322004-11-08 10:52:06 +000025702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025703}
25704
25705
25706static int
25707test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025709
William M. Brack21e4ef22005-01-02 09:53:13 +000025710#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025711 int mem_base;
25712 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025713 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025714 int n_value;
25715
25716 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025718 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025719
William M. Brackf13f77f2004-11-12 16:03:48 +000025720 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025721 desret_int(ret_val);
25722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025723 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025724 xmlResetLastError();
25725 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025726 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025728 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025729 printf(" %d", n_value);
25730 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025731 }
25732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025733 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025734#endif
25735
Daniel Veillard42595322004-11-08 10:52:06 +000025736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025737}
25738
25739
25740static int
25741test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025743
William M. Brack21e4ef22005-01-02 09:53:13 +000025744#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025745 int mem_base;
25746 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025747 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025748 int n_value;
25749
25750 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025752 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025753
William M. Brackf13f77f2004-11-12 16:03:48 +000025754 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025755 desret_int(ret_val);
25756 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025757 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025758 xmlResetLastError();
25759 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025760 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025762 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025763 printf(" %d", n_value);
25764 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025765 }
25766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025767 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025768#endif
25769
Daniel Veillard42595322004-11-08 10:52:06 +000025770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025771}
25772
25773
25774static int
25775test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025777
William M. Brack21e4ef22005-01-02 09:53:13 +000025778#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025779 int mem_base;
25780 int ret_val;
25781 xmlValidCtxtPtr ctxt; /* the validation context */
25782 int n_ctxt;
25783 xmlDocPtr doc; /* a document instance */
25784 int n_doc;
25785 xmlNotationPtr nota; /* a notation definition */
25786 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025787
Daniel Veillardce682bc2004-11-05 17:22:25 +000025788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25789 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25790 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25791 mem_base = xmlMemBlocks();
25792 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25793 doc = gen_xmlDocPtr(n_doc, 1);
25794 nota = gen_xmlNotationPtr(n_nota, 2);
25795
25796 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25797 desret_int(ret_val);
25798 call_tests++;
25799 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25800 des_xmlDocPtr(n_doc, doc, 1);
25801 des_xmlNotationPtr(n_nota, nota, 2);
25802 xmlResetLastError();
25803 if (mem_base != xmlMemBlocks()) {
25804 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025806 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025807 printf(" %d", n_ctxt);
25808 printf(" %d", n_doc);
25809 printf(" %d", n_nota);
25810 printf("\n");
25811 }
25812 }
25813 }
25814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025815 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025816#endif
25817
Daniel Veillard42595322004-11-08 10:52:06 +000025818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025819}
25820
25821
25822static int
25823test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025825
William M. Brack21e4ef22005-01-02 09:53:13 +000025826#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025827 int mem_base;
25828 int ret_val;
25829 xmlValidCtxtPtr ctxt; /* the validation context */
25830 int n_ctxt;
25831 xmlDocPtr doc; /* the document */
25832 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025833 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025834 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025835
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025836 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25837 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25838 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25839 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025840 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25841 doc = gen_xmlDocPtr(n_doc, 1);
25842 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025843
William M. Brackf13f77f2004-11-12 16:03:48 +000025844 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025845 desret_int(ret_val);
25846 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025847 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25848 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025849 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025850 xmlResetLastError();
25851 if (mem_base != xmlMemBlocks()) {
25852 printf("Leak of %d blocks found in xmlValidateNotationUse",
25853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025854 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025855 printf(" %d", n_ctxt);
25856 printf(" %d", n_doc);
25857 printf(" %d", n_notationName);
25858 printf("\n");
25859 }
25860 }
25861 }
25862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025863 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025864#endif
25865
Daniel Veillard42595322004-11-08 10:52:06 +000025866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025867}
25868
25869
25870static int
25871test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025873
William M. Brack21e4ef22005-01-02 09:53:13 +000025874#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025875 int mem_base;
25876 int ret_val;
25877 xmlValidCtxtPtr ctxt; /* the validation context */
25878 int n_ctxt;
25879 xmlDocPtr doc; /* a document instance */
25880 int n_doc;
25881 xmlNodePtr elem; /* an element instance */
25882 int n_elem;
25883 xmlAttrPtr attr; /* an attribute instance */
25884 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025885 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025886 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025887
Daniel Veillardce244ad2004-11-05 10:03:46 +000025888 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25889 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25890 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25891 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25892 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25893 mem_base = xmlMemBlocks();
25894 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25895 doc = gen_xmlDocPtr(n_doc, 1);
25896 elem = gen_xmlNodePtr(n_elem, 2);
25897 attr = gen_xmlAttrPtr(n_attr, 3);
25898 value = gen_const_xmlChar_ptr(n_value, 4);
25899
William M. Brackf13f77f2004-11-12 16:03:48 +000025900 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025901 desret_int(ret_val);
25902 call_tests++;
25903 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25904 des_xmlDocPtr(n_doc, doc, 1);
25905 des_xmlNodePtr(n_elem, elem, 2);
25906 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025907 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025908 xmlResetLastError();
25909 if (mem_base != xmlMemBlocks()) {
25910 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025912 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025913 printf(" %d", n_ctxt);
25914 printf(" %d", n_doc);
25915 printf(" %d", n_elem);
25916 printf(" %d", n_attr);
25917 printf(" %d", n_value);
25918 printf("\n");
25919 }
25920 }
25921 }
25922 }
25923 }
25924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025925 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025926#endif
25927
Daniel Veillard42595322004-11-08 10:52:06 +000025928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025929}
25930
25931
25932static int
25933test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025935
William M. Brack21e4ef22005-01-02 09:53:13 +000025936#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025937 int mem_base;
25938 int ret_val;
25939 xmlValidCtxtPtr ctxt; /* the validation context */
25940 int n_ctxt;
25941 xmlDocPtr doc; /* a document instance */
25942 int n_doc;
25943 xmlNodePtr elem; /* an element instance */
25944 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025945
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025946 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25947 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25948 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25949 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025950 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25951 doc = gen_xmlDocPtr(n_doc, 1);
25952 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025953
25954 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25955 desret_int(ret_val);
25956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025957 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25958 des_xmlDocPtr(n_doc, doc, 1);
25959 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025960 xmlResetLastError();
25961 if (mem_base != xmlMemBlocks()) {
25962 printf("Leak of %d blocks found in xmlValidateOneElement",
25963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025964 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025965 printf(" %d", n_ctxt);
25966 printf(" %d", n_doc);
25967 printf(" %d", n_elem);
25968 printf("\n");
25969 }
25970 }
25971 }
25972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025973 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025974#endif
25975
Daniel Veillard42595322004-11-08 10:52:06 +000025976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025977}
25978
25979
25980static int
25981test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025983
William M. Brack21e4ef22005-01-02 09:53:13 +000025984#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025985 int mem_base;
25986 int ret_val;
25987 xmlValidCtxtPtr ctxt; /* the validation context */
25988 int n_ctxt;
25989 xmlDocPtr doc; /* a document instance */
25990 int n_doc;
25991 xmlNodePtr elem; /* an element instance */
25992 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025993 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025994 int n_prefix;
25995 xmlNsPtr ns; /* an namespace declaration instance */
25996 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025997 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025998 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999
Daniel Veillard27f20102004-11-05 11:50:11 +000026000 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26001 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26002 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26003 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
26004 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
26005 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26006 mem_base = xmlMemBlocks();
26007 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26008 doc = gen_xmlDocPtr(n_doc, 1);
26009 elem = gen_xmlNodePtr(n_elem, 2);
26010 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
26011 ns = gen_xmlNsPtr(n_ns, 4);
26012 value = gen_const_xmlChar_ptr(n_value, 5);
26013
William M. Brackf13f77f2004-11-12 16:03:48 +000026014 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000026015 desret_int(ret_val);
26016 call_tests++;
26017 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26018 des_xmlDocPtr(n_doc, doc, 1);
26019 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000026020 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000026021 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000026022 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000026023 xmlResetLastError();
26024 if (mem_base != xmlMemBlocks()) {
26025 printf("Leak of %d blocks found in xmlValidateOneNamespace",
26026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026027 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000026028 printf(" %d", n_ctxt);
26029 printf(" %d", n_doc);
26030 printf(" %d", n_elem);
26031 printf(" %d", n_prefix);
26032 printf(" %d", n_ns);
26033 printf(" %d", n_value);
26034 printf("\n");
26035 }
26036 }
26037 }
26038 }
26039 }
26040 }
26041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026042 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000026043#endif
26044
Daniel Veillard42595322004-11-08 10:52:06 +000026045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026046}
26047
26048
26049static int
26050test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026052
William M. Brack21e4ef22005-01-02 09:53:13 +000026053#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026054 int mem_base;
26055 int ret_val;
26056 xmlValidCtxtPtr ctxt; /* the validation context */
26057 int n_ctxt;
26058 xmlDocPtr doc; /* a document instance */
26059 int n_doc;
26060 xmlNodePtr elem; /* an element instance */
26061 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026062 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026063 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026064
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026065 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26066 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26067 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26068 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
26069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026070 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26071 doc = gen_xmlDocPtr(n_doc, 1);
26072 elem = gen_xmlNodePtr(n_elem, 2);
26073 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026074
William M. Brackf13f77f2004-11-12 16:03:48 +000026075 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026076 desret_int(ret_val);
26077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026078 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26079 des_xmlDocPtr(n_doc, doc, 1);
26080 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000026081 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026082 xmlResetLastError();
26083 if (mem_base != xmlMemBlocks()) {
26084 printf("Leak of %d blocks found in xmlValidatePopElement",
26085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026086 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026087 printf(" %d", n_ctxt);
26088 printf(" %d", n_doc);
26089 printf(" %d", n_elem);
26090 printf(" %d", n_qname);
26091 printf("\n");
26092 }
26093 }
26094 }
26095 }
26096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026097 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026098#endif
26099
Daniel Veillard42595322004-11-08 10:52:06 +000026100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101}
26102
26103
26104static int
26105test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026107
William M. Brack21e4ef22005-01-02 09:53:13 +000026108#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026109 int mem_base;
26110 int ret_val;
26111 xmlValidCtxtPtr ctxt; /* the validation context */
26112 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026113 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026114 int n_data;
26115 int len; /* the lenght of the data */
26116 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026117
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026118 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26119 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
26120 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026122 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26123 data = gen_const_xmlChar_ptr(n_data, 1);
26124 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026125
William M. Brackf13f77f2004-11-12 16:03:48 +000026126 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026127 desret_int(ret_val);
26128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026129 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026130 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000026131 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026132 xmlResetLastError();
26133 if (mem_base != xmlMemBlocks()) {
26134 printf("Leak of %d blocks found in xmlValidatePushCData",
26135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026136 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026137 printf(" %d", n_ctxt);
26138 printf(" %d", n_data);
26139 printf(" %d", n_len);
26140 printf("\n");
26141 }
26142 }
26143 }
26144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026145 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026146#endif
26147
Daniel Veillard42595322004-11-08 10:52:06 +000026148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026149}
26150
26151
26152static int
26153test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026155
William M. Brack21e4ef22005-01-02 09:53:13 +000026156#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026157 int mem_base;
26158 int ret_val;
26159 xmlValidCtxtPtr ctxt; /* the validation context */
26160 int n_ctxt;
26161 xmlDocPtr doc; /* a document instance */
26162 int n_doc;
26163 xmlNodePtr elem; /* an element instance */
26164 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026165 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026166 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026167
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026168 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26169 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26170 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26171 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
26172 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026173 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26174 doc = gen_xmlDocPtr(n_doc, 1);
26175 elem = gen_xmlNodePtr(n_elem, 2);
26176 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026177
William M. Brackf13f77f2004-11-12 16:03:48 +000026178 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026179 desret_int(ret_val);
26180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026181 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26182 des_xmlDocPtr(n_doc, doc, 1);
26183 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000026184 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026185 xmlResetLastError();
26186 if (mem_base != xmlMemBlocks()) {
26187 printf("Leak of %d blocks found in xmlValidatePushElement",
26188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026189 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026190 printf(" %d", n_ctxt);
26191 printf(" %d", n_doc);
26192 printf(" %d", n_elem);
26193 printf(" %d", n_qname);
26194 printf("\n");
26195 }
26196 }
26197 }
26198 }
26199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026200 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026201#endif
26202
Daniel Veillard42595322004-11-08 10:52:06 +000026203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026204}
26205
26206
26207static int
26208test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026210
William M. Brack21e4ef22005-01-02 09:53:13 +000026211#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026212 int mem_base;
26213 int ret_val;
26214 xmlValidCtxtPtr ctxt; /* the validation context */
26215 int n_ctxt;
26216 xmlDocPtr doc; /* a document instance */
26217 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026218
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26220 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026222 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26223 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026224
26225 ret_val = xmlValidateRoot(ctxt, doc);
26226 desret_int(ret_val);
26227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026228 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26229 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026230 xmlResetLastError();
26231 if (mem_base != xmlMemBlocks()) {
26232 printf("Leak of %d blocks found in xmlValidateRoot",
26233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026234 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026235 printf(" %d", n_ctxt);
26236 printf(" %d", n_doc);
26237 printf("\n");
26238 }
26239 }
26240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026241 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026242#endif
26243
Daniel Veillard42595322004-11-08 10:52:06 +000026244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026245}
26246
26247static int
26248test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026250
Daniel Veillard2ae13382005-01-25 23:45:06 +000026251 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026252 test_ret += test_xmlAddAttributeDecl();
26253 test_ret += test_xmlAddElementDecl();
26254 test_ret += test_xmlAddID();
26255 test_ret += test_xmlAddNotationDecl();
26256 test_ret += test_xmlAddRef();
26257 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026258 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026259 test_ret += test_xmlCopyElementContent();
26260 test_ret += test_xmlCopyElementTable();
26261 test_ret += test_xmlCopyEnumeration();
26262 test_ret += test_xmlCopyNotationTable();
26263 test_ret += test_xmlCreateEnumeration();
26264 test_ret += test_xmlDumpAttributeDecl();
26265 test_ret += test_xmlDumpAttributeTable();
26266 test_ret += test_xmlDumpElementDecl();
26267 test_ret += test_xmlDumpElementTable();
26268 test_ret += test_xmlDumpNotationDecl();
26269 test_ret += test_xmlDumpNotationTable();
26270 test_ret += test_xmlGetDtdAttrDesc();
26271 test_ret += test_xmlGetDtdElementDesc();
26272 test_ret += test_xmlGetDtdNotationDesc();
26273 test_ret += test_xmlGetDtdQAttrDesc();
26274 test_ret += test_xmlGetDtdQElementDesc();
26275 test_ret += test_xmlGetID();
26276 test_ret += test_xmlGetRefs();
26277 test_ret += test_xmlIsID();
26278 test_ret += test_xmlIsMixedElement();
26279 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026280 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026281 test_ret += test_xmlNewElementContent();
26282 test_ret += test_xmlNewValidCtxt();
26283 test_ret += test_xmlRemoveID();
26284 test_ret += test_xmlRemoveRef();
26285 test_ret += test_xmlSnprintfElementContent();
26286 test_ret += test_xmlSprintfElementContent();
26287 test_ret += test_xmlValidBuildContentModel();
26288 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26289 test_ret += test_xmlValidGetPotentialChildren();
26290 test_ret += test_xmlValidGetValidElements();
26291 test_ret += test_xmlValidNormalizeAttributeValue();
26292 test_ret += test_xmlValidateAttributeDecl();
26293 test_ret += test_xmlValidateAttributeValue();
26294 test_ret += test_xmlValidateDocument();
26295 test_ret += test_xmlValidateDocumentFinal();
26296 test_ret += test_xmlValidateDtd();
26297 test_ret += test_xmlValidateDtdFinal();
26298 test_ret += test_xmlValidateElement();
26299 test_ret += test_xmlValidateElementDecl();
26300 test_ret += test_xmlValidateNameValue();
26301 test_ret += test_xmlValidateNamesValue();
26302 test_ret += test_xmlValidateNmtokenValue();
26303 test_ret += test_xmlValidateNmtokensValue();
26304 test_ret += test_xmlValidateNotationDecl();
26305 test_ret += test_xmlValidateNotationUse();
26306 test_ret += test_xmlValidateOneAttribute();
26307 test_ret += test_xmlValidateOneElement();
26308 test_ret += test_xmlValidateOneNamespace();
26309 test_ret += test_xmlValidatePopElement();
26310 test_ret += test_xmlValidatePushCData();
26311 test_ret += test_xmlValidatePushElement();
26312 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026313
Daniel Veillard42595322004-11-08 10:52:06 +000026314 if (test_ret != 0)
26315 printf("Module valid: %d errors\n", test_ret);
26316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026317}
26318
26319static int
26320test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026322
26323
26324 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026326}
26327
26328
26329static int
26330test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026332
William M. Brack21e4ef22005-01-02 09:53:13 +000026333#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026334 int mem_base;
26335 int ret_val;
26336 xmlDocPtr doc; /* an XML document */
26337 int n_doc;
26338
26339 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026341 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026342
26343 ret_val = xmlXIncludeProcess(doc);
26344 desret_int(ret_val);
26345 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026346 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026347 xmlResetLastError();
26348 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026349 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026351 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026352 printf(" %d", n_doc);
26353 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026354 }
26355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026356 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026357#endif
26358
Daniel Veillard42595322004-11-08 10:52:06 +000026359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026360}
26361
26362
26363static int
26364test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026366
William M. Brack21e4ef22005-01-02 09:53:13 +000026367#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026368 int mem_base;
26369 int ret_val;
26370 xmlDocPtr doc; /* an XML document */
26371 int n_doc;
26372 int flags; /* a set of xmlParserOption used for parsing XML includes */
26373 int n_flags;
26374
26375 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26376 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26377 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026378 doc = gen_xmlDocPtr(n_doc, 0);
26379 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026380
26381 ret_val = xmlXIncludeProcessFlags(doc, flags);
26382 desret_int(ret_val);
26383 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026384 des_xmlDocPtr(n_doc, doc, 0);
26385 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026386 xmlResetLastError();
26387 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026388 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026390 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026391 printf(" %d", n_doc);
26392 printf(" %d", n_flags);
26393 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026394 }
26395 }
26396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026397 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026398#endif
26399
Daniel Veillard42595322004-11-08 10:52:06 +000026400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026401}
26402
Daniel Veillarda521d282004-11-09 14:59:59 +000026403#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026404
Daniel Veillardce682bc2004-11-05 17:22:25 +000026405#define gen_nb_xmlXIncludeCtxtPtr 1
26406static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26407 return(NULL);
26408}
26409static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26410}
Daniel Veillarda521d282004-11-09 14:59:59 +000026411#endif
26412
Daniel Veillardce682bc2004-11-05 17:22:25 +000026413
Daniel Veillardd93f6252004-11-02 15:53:51 +000026414static int
26415test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026417
William M. Brack21e4ef22005-01-02 09:53:13 +000026418#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026419 int mem_base;
26420 int ret_val;
26421 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26422 int n_ctxt;
26423 xmlNodePtr node; /* a node in an XML document */
26424 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026425
Daniel Veillardce682bc2004-11-05 17:22:25 +000026426 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26427 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26428 mem_base = xmlMemBlocks();
26429 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26430 node = gen_xmlNodePtr(n_node, 1);
26431
26432 ret_val = xmlXIncludeProcessNode(ctxt, node);
26433 desret_int(ret_val);
26434 call_tests++;
26435 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26436 des_xmlNodePtr(n_node, node, 1);
26437 xmlResetLastError();
26438 if (mem_base != xmlMemBlocks()) {
26439 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026441 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026442 printf(" %d", n_ctxt);
26443 printf(" %d", n_node);
26444 printf("\n");
26445 }
26446 }
26447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026448 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026449#endif
26450
Daniel Veillard42595322004-11-08 10:52:06 +000026451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026452}
26453
26454
26455static int
26456test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026458
William M. Brack21e4ef22005-01-02 09:53:13 +000026459#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026460 int mem_base;
26461 int ret_val;
26462 xmlNodePtr tree; /* a node in an XML document */
26463 int n_tree;
26464
26465 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026467 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026468
26469 ret_val = xmlXIncludeProcessTree(tree);
26470 desret_int(ret_val);
26471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026472 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026473 xmlResetLastError();
26474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026475 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026478 printf(" %d", n_tree);
26479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026480 }
26481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026482 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483#endif
26484
Daniel Veillard42595322004-11-08 10:52:06 +000026485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026486}
26487
26488
26489static int
26490test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026492
William M. Brack21e4ef22005-01-02 09:53:13 +000026493#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026494 int mem_base;
26495 int ret_val;
26496 xmlNodePtr tree; /* a node in an XML document */
26497 int n_tree;
26498 int flags; /* a set of xmlParserOption used for parsing XML includes */
26499 int n_flags;
26500
26501 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26502 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026504 tree = gen_xmlNodePtr(n_tree, 0);
26505 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026506
26507 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26508 desret_int(ret_val);
26509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026510 des_xmlNodePtr(n_tree, tree, 0);
26511 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026512 xmlResetLastError();
26513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026514 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026517 printf(" %d", n_tree);
26518 printf(" %d", n_flags);
26519 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026520 }
26521 }
26522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026523 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026524#endif
26525
Daniel Veillard42595322004-11-08 10:52:06 +000026526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026527}
26528
26529
26530static int
26531test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026533
William M. Brack21e4ef22005-01-02 09:53:13 +000026534#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026535 int mem_base;
26536 int ret_val;
26537 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26538 int n_ctxt;
26539 int flags; /* a set of xmlParserOption used for parsing XML includes */
26540 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541
Daniel Veillardce682bc2004-11-05 17:22:25 +000026542 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26543 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26544 mem_base = xmlMemBlocks();
26545 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26546 flags = gen_int(n_flags, 1);
26547
26548 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26549 desret_int(ret_val);
26550 call_tests++;
26551 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26552 des_int(n_flags, flags, 1);
26553 xmlResetLastError();
26554 if (mem_base != xmlMemBlocks()) {
26555 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026557 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026558 printf(" %d", n_ctxt);
26559 printf(" %d", n_flags);
26560 printf("\n");
26561 }
26562 }
26563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026564 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026565#endif
26566
Daniel Veillard42595322004-11-08 10:52:06 +000026567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026568}
26569
26570static int
26571test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026573
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026574 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026575 test_ret += test_xmlXIncludeNewContext();
26576 test_ret += test_xmlXIncludeProcess();
26577 test_ret += test_xmlXIncludeProcessFlags();
26578 test_ret += test_xmlXIncludeProcessNode();
26579 test_ret += test_xmlXIncludeProcessTree();
26580 test_ret += test_xmlXIncludeProcessTreeFlags();
26581 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026582
Daniel Veillard42595322004-11-08 10:52:06 +000026583 if (test_ret != 0)
26584 printf("Module xinclude: %d errors\n", test_ret);
26585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026586}
26587
26588static int
26589test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026591
William M. Brack21e4ef22005-01-02 09:53:13 +000026592#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026593 int mem_base;
26594 xmlOutputBufferPtr ret_val;
26595 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26596 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026597
Daniel Veillard3d95c732004-11-06 22:25:14 +000026598 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26599 mem_base = xmlMemBlocks();
26600 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26601
26602 ret_val = xmlAllocOutputBuffer(encoder);
26603 desret_xmlOutputBufferPtr(ret_val);
26604 call_tests++;
26605 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26606 xmlResetLastError();
26607 if (mem_base != xmlMemBlocks()) {
26608 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026610 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026611 printf(" %d", n_encoder);
26612 printf("\n");
26613 }
26614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026615 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026616#endif
26617
Daniel Veillard42595322004-11-08 10:52:06 +000026618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026619}
26620
26621
26622static int
26623test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026626 int mem_base;
26627 xmlParserInputBufferPtr ret_val;
26628 xmlCharEncoding enc; /* the charset encoding if known */
26629 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026630
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026631 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26632 mem_base = xmlMemBlocks();
26633 enc = gen_xmlCharEncoding(n_enc, 0);
26634
26635 ret_val = xmlAllocParserInputBuffer(enc);
26636 desret_xmlParserInputBufferPtr(ret_val);
26637 call_tests++;
26638 des_xmlCharEncoding(n_enc, enc, 0);
26639 xmlResetLastError();
26640 if (mem_base != xmlMemBlocks()) {
26641 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026643 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026644 printf(" %d", n_enc);
26645 printf("\n");
26646 }
26647 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026648 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026649
Daniel Veillard42595322004-11-08 10:52:06 +000026650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026651}
26652
26653
26654static int
26655test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026657
26658 int mem_base;
26659 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026660 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026661 int n_path;
26662
26663 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026665 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026666
William M. Brackf13f77f2004-11-12 16:03:48 +000026667 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026668 desret_int(ret_val);
26669 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026670 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026671 xmlResetLastError();
26672 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026673 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026675 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026676 printf(" %d", n_path);
26677 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026678 }
26679 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026680 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026681
Daniel Veillard42595322004-11-08 10:52:06 +000026682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026683}
26684
26685
26686static int
26687test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026689
Daniel Veillard42595322004-11-08 10:52:06 +000026690 int mem_base;
26691 xmlParserInputPtr ret_val;
26692 xmlParserCtxtPtr ctxt; /* an XML parser context */
26693 int n_ctxt;
26694 xmlParserInputPtr ret; /* an XML parser input */
26695 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026696
Daniel Veillard42595322004-11-08 10:52:06 +000026697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26698 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26699 mem_base = xmlMemBlocks();
26700 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26701 ret = gen_xmlParserInputPtr(n_ret, 1);
26702
26703 ret_val = xmlCheckHTTPInput(ctxt, ret);
26704 desret_xmlParserInputPtr(ret_val);
26705 call_tests++;
26706 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26707 des_xmlParserInputPtr(n_ret, ret, 1);
26708 xmlResetLastError();
26709 if (mem_base != xmlMemBlocks()) {
26710 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26711 xmlMemBlocks() - mem_base);
26712 test_ret++;
26713 printf(" %d", n_ctxt);
26714 printf(" %d", n_ret);
26715 printf("\n");
26716 }
26717 }
26718 }
Daniel Veillard42595322004-11-08 10:52:06 +000026719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026720
Daniel Veillard42595322004-11-08 10:52:06 +000026721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026722}
26723
26724
26725static int
26726test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026728
26729 int mem_base;
26730
26731 mem_base = xmlMemBlocks();
26732
26733 xmlCleanupInputCallbacks();
26734 call_tests++;
26735 xmlResetLastError();
26736 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026737 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026739 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026740 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026743
Daniel Veillard42595322004-11-08 10:52:06 +000026744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026745}
26746
26747
26748static int
26749test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026751
William M. Brack21e4ef22005-01-02 09:53:13 +000026752#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026753 int mem_base;
26754
26755 mem_base = xmlMemBlocks();
26756
26757 xmlCleanupOutputCallbacks();
26758 call_tests++;
26759 xmlResetLastError();
26760 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026761 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026764 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026766 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026767#endif
26768
Daniel Veillard42595322004-11-08 10:52:06 +000026769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026770}
26771
26772
26773static int
26774test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026776
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026777 int mem_base;
26778 int ret_val;
26779 void * context; /* the I/O context */
26780 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026782 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026784 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026785
26786 ret_val = xmlFileClose(context);
26787 desret_int(ret_val);
26788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026789 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026790 xmlResetLastError();
26791 if (mem_base != xmlMemBlocks()) {
26792 printf("Leak of %d blocks found in xmlFileClose",
26793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026794 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026795 printf(" %d", n_context);
26796 printf("\n");
26797 }
26798 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026800
Daniel Veillard42595322004-11-08 10:52:06 +000026801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026802}
26803
26804
26805static int
26806test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
26809 int mem_base;
26810 int ret_val;
26811 const char * filename; /* the URI for matching */
26812 int n_filename;
26813
26814 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026816 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026817
26818 ret_val = xmlFileMatch(filename);
26819 desret_int(ret_val);
26820 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026821 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026822 xmlResetLastError();
26823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026824 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026827 printf(" %d", n_filename);
26828 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026829 }
26830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026832
Daniel Veillard42595322004-11-08 10:52:06 +000026833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026834}
26835
26836
26837static int
26838test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026840
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026841 int mem_base;
26842 void * ret_val;
26843 const char * filename; /* the URI for matching */
26844 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026845
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026846 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026848 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026849
26850 ret_val = xmlFileOpen(filename);
26851 desret_void_ptr(ret_val);
26852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026853 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026854 xmlResetLastError();
26855 if (mem_base != xmlMemBlocks()) {
26856 printf("Leak of %d blocks found in xmlFileOpen",
26857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026858 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026859 printf(" %d", n_filename);
26860 printf("\n");
26861 }
26862 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026863 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026864
Daniel Veillard42595322004-11-08 10:52:06 +000026865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026866}
26867
26868
26869static int
26870test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026872
Daniel Veillardce682bc2004-11-05 17:22:25 +000026873 int mem_base;
26874 int ret_val;
26875 void * context; /* the I/O context */
26876 int n_context;
26877 char * buffer; /* where to drop data */
26878 int n_buffer;
26879 int len; /* number of bytes to write */
26880 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026881
Daniel Veillardce682bc2004-11-05 17:22:25 +000026882 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26883 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26884 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26885 mem_base = xmlMemBlocks();
26886 context = gen_void_ptr(n_context, 0);
26887 buffer = gen_char_ptr(n_buffer, 1);
26888 len = gen_int(n_len, 2);
26889
26890 ret_val = xmlFileRead(context, buffer, len);
26891 desret_int(ret_val);
26892 call_tests++;
26893 des_void_ptr(n_context, context, 0);
26894 des_char_ptr(n_buffer, buffer, 1);
26895 des_int(n_len, len, 2);
26896 xmlResetLastError();
26897 if (mem_base != xmlMemBlocks()) {
26898 printf("Leak of %d blocks found in xmlFileRead",
26899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026900 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026901 printf(" %d", n_context);
26902 printf(" %d", n_buffer);
26903 printf(" %d", n_len);
26904 printf("\n");
26905 }
26906 }
26907 }
26908 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026909 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026910
Daniel Veillard42595322004-11-08 10:52:06 +000026911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026912}
26913
26914
26915static int
26916test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026918
William M. Brack21e4ef22005-01-02 09:53:13 +000026919#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026920 int mem_base;
26921 int ret_val;
26922 void * context; /* the I/O context */
26923 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026925 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026927 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026928
26929 ret_val = xmlIOFTPClose(context);
26930 desret_int(ret_val);
26931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026932 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026933 xmlResetLastError();
26934 if (mem_base != xmlMemBlocks()) {
26935 printf("Leak of %d blocks found in xmlIOFTPClose",
26936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026937 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026938 printf(" %d", n_context);
26939 printf("\n");
26940 }
26941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026942 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026943#endif
26944
Daniel Veillard42595322004-11-08 10:52:06 +000026945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026946}
26947
26948
26949static int
26950test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026952
William M. Brack21e4ef22005-01-02 09:53:13 +000026953#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026954 int mem_base;
26955 int ret_val;
26956 const char * filename; /* the URI for matching */
26957 int n_filename;
26958
26959 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026961 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026962
26963 ret_val = xmlIOFTPMatch(filename);
26964 desret_int(ret_val);
26965 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026966 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026967 xmlResetLastError();
26968 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026969 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026971 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026972 printf(" %d", n_filename);
26973 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026974 }
26975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026976 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026977#endif
26978
Daniel Veillard42595322004-11-08 10:52:06 +000026979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026980}
26981
26982
26983static int
26984test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026986
William M. Brack21e4ef22005-01-02 09:53:13 +000026987#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026988 int mem_base;
26989 void * ret_val;
26990 const char * filename; /* the URI for matching */
26991 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026992
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026993 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26994 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026995 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026996
26997 ret_val = xmlIOFTPOpen(filename);
26998 desret_void_ptr(ret_val);
26999 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027000 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027001 xmlResetLastError();
27002 if (mem_base != xmlMemBlocks()) {
27003 printf("Leak of %d blocks found in xmlIOFTPOpen",
27004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027005 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027006 printf(" %d", n_filename);
27007 printf("\n");
27008 }
27009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027010 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027011#endif
27012
Daniel Veillard42595322004-11-08 10:52:06 +000027013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027014}
27015
27016
27017static int
27018test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027020
William M. Brack21e4ef22005-01-02 09:53:13 +000027021#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000027022 int mem_base;
27023 int ret_val;
27024 void * context; /* the I/O context */
27025 int n_context;
27026 char * buffer; /* where to drop data */
27027 int n_buffer;
27028 int len; /* number of bytes to write */
27029 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027030
Daniel Veillardce682bc2004-11-05 17:22:25 +000027031 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
27032 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
27033 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27034 mem_base = xmlMemBlocks();
27035 context = gen_void_ptr(n_context, 0);
27036 buffer = gen_char_ptr(n_buffer, 1);
27037 len = gen_int(n_len, 2);
27038
27039 ret_val = xmlIOFTPRead(context, buffer, len);
27040 desret_int(ret_val);
27041 call_tests++;
27042 des_void_ptr(n_context, context, 0);
27043 des_char_ptr(n_buffer, buffer, 1);
27044 des_int(n_len, len, 2);
27045 xmlResetLastError();
27046 if (mem_base != xmlMemBlocks()) {
27047 printf("Leak of %d blocks found in xmlIOFTPRead",
27048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027049 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027050 printf(" %d", n_context);
27051 printf(" %d", n_buffer);
27052 printf(" %d", n_len);
27053 printf("\n");
27054 }
27055 }
27056 }
27057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027058 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027059#endif
27060
Daniel Veillard42595322004-11-08 10:52:06 +000027061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027062}
27063
27064
27065static int
27066test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027068
William M. Brack21e4ef22005-01-02 09:53:13 +000027069#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027070 int mem_base;
27071 int ret_val;
27072 void * context; /* the I/O context */
27073 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027074
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027075 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
27076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027077 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027078
27079 ret_val = xmlIOHTTPClose(context);
27080 desret_int(ret_val);
27081 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027082 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027083 xmlResetLastError();
27084 if (mem_base != xmlMemBlocks()) {
27085 printf("Leak of %d blocks found in xmlIOHTTPClose",
27086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027087 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027088 printf(" %d", n_context);
27089 printf("\n");
27090 }
27091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027092 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027093#endif
27094
Daniel Veillard42595322004-11-08 10:52:06 +000027095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027096}
27097
27098
27099static int
27100test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027102
William M. Brack21e4ef22005-01-02 09:53:13 +000027103#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027104 int mem_base;
27105 int ret_val;
27106 const char * filename; /* the URI for matching */
27107 int n_filename;
27108
27109 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
27110 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027111 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027112
27113 ret_val = xmlIOHTTPMatch(filename);
27114 desret_int(ret_val);
27115 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027116 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027117 xmlResetLastError();
27118 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027119 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027121 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027122 printf(" %d", n_filename);
27123 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027124 }
27125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027126 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027127#endif
27128
Daniel Veillard42595322004-11-08 10:52:06 +000027129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027130}
27131
27132
27133static int
27134test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027136
William M. Brack21e4ef22005-01-02 09:53:13 +000027137#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027138 int mem_base;
27139 void * ret_val;
27140 const char * filename; /* the URI for matching */
27141 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027142
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027143 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
27144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027145 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027146
27147 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000027148 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027150 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027151 xmlResetLastError();
27152 if (mem_base != xmlMemBlocks()) {
27153 printf("Leak of %d blocks found in xmlIOHTTPOpen",
27154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027155 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027156 printf(" %d", n_filename);
27157 printf("\n");
27158 }
27159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027160 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027161#endif
27162
Daniel Veillard42595322004-11-08 10:52:06 +000027163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027164}
27165
27166
27167static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027168test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027170
William M. Brack21e4ef22005-01-02 09:53:13 +000027171#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000027172 int mem_base;
27173 int ret_val;
27174 void * context; /* the I/O context */
27175 int n_context;
27176 char * buffer; /* where to drop data */
27177 int n_buffer;
27178 int len; /* number of bytes to write */
27179 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027180
Daniel Veillardce682bc2004-11-05 17:22:25 +000027181 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
27182 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
27183 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27184 mem_base = xmlMemBlocks();
27185 context = gen_void_ptr(n_context, 0);
27186 buffer = gen_char_ptr(n_buffer, 1);
27187 len = gen_int(n_len, 2);
27188
27189 ret_val = xmlIOHTTPRead(context, buffer, len);
27190 desret_int(ret_val);
27191 call_tests++;
27192 des_void_ptr(n_context, context, 0);
27193 des_char_ptr(n_buffer, buffer, 1);
27194 des_int(n_len, len, 2);
27195 xmlResetLastError();
27196 if (mem_base != xmlMemBlocks()) {
27197 printf("Leak of %d blocks found in xmlIOHTTPRead",
27198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027199 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027200 printf(" %d", n_context);
27201 printf(" %d", n_buffer);
27202 printf(" %d", n_len);
27203 printf("\n");
27204 }
27205 }
27206 }
27207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027208 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027209#endif
27210
Daniel Veillard42595322004-11-08 10:52:06 +000027211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027212}
27213
27214
27215static int
27216test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027218
Daniel Veillard42595322004-11-08 10:52:06 +000027219 int mem_base;
27220 xmlParserInputPtr ret_val;
27221 const char * URL; /* the URL for the entity to load */
27222 int n_URL;
27223 char * ID; /* the System ID for the entity to load */
27224 int n_ID;
27225 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
27226 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027227
Daniel Veillard42595322004-11-08 10:52:06 +000027228 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
27229 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
27230 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
27231 mem_base = xmlMemBlocks();
27232 URL = gen_filepath(n_URL, 0);
27233 ID = gen_const_char_ptr(n_ID, 1);
27234 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
27235
William M. Brackf13f77f2004-11-12 16:03:48 +000027236 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027237 desret_xmlParserInputPtr(ret_val);
27238 call_tests++;
27239 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027240 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027241 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27242 xmlResetLastError();
27243 if (mem_base != xmlMemBlocks()) {
27244 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27245 xmlMemBlocks() - mem_base);
27246 test_ret++;
27247 printf(" %d", n_URL);
27248 printf(" %d", n_ID);
27249 printf(" %d", n_ctxt);
27250 printf("\n");
27251 }
27252 }
27253 }
27254 }
Daniel Veillard42595322004-11-08 10:52:06 +000027255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027256
Daniel Veillard42595322004-11-08 10:52:06 +000027257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027258}
27259
27260
27261static int
27262test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027264
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027265 int mem_base;
27266 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027267 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027268 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027269
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027270 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027272 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027273
William M. Brackf13f77f2004-11-12 16:03:48 +000027274 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027275 desret_xmlChar_ptr(ret_val);
27276 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027277 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027278 xmlResetLastError();
27279 if (mem_base != xmlMemBlocks()) {
27280 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027282 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027283 printf(" %d", n_path);
27284 printf("\n");
27285 }
27286 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027287 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027288
Daniel Veillard42595322004-11-08 10:52:06 +000027289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027290}
27291
27292
27293static int
27294test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027296
William M. Brack21e4ef22005-01-02 09:53:13 +000027297#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027298 int mem_base;
27299 xmlOutputBufferPtr ret_val;
27300 int fd; /* a file descriptor number */
27301 int n_fd;
27302 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27303 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027304
Daniel Veillard3d95c732004-11-06 22:25:14 +000027305 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27306 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27307 mem_base = xmlMemBlocks();
27308 fd = gen_int(n_fd, 0);
27309 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27310
27311 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27312 desret_xmlOutputBufferPtr(ret_val);
27313 call_tests++;
27314 des_int(n_fd, fd, 0);
27315 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27316 xmlResetLastError();
27317 if (mem_base != xmlMemBlocks()) {
27318 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027320 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027321 printf(" %d", n_fd);
27322 printf(" %d", n_encoder);
27323 printf("\n");
27324 }
27325 }
27326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027327 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027328#endif
27329
Daniel Veillard42595322004-11-08 10:52:06 +000027330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027331}
27332
27333
27334static int
27335test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027337
William M. Brack21e4ef22005-01-02 09:53:13 +000027338#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027339 int mem_base;
27340 xmlOutputBufferPtr ret_val;
27341 FILE * file; /* a FILE* */
27342 int n_file;
27343 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27344 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027345
Daniel Veillard3d95c732004-11-06 22:25:14 +000027346 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27347 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27348 mem_base = xmlMemBlocks();
27349 file = gen_FILE_ptr(n_file, 0);
27350 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27351
27352 ret_val = xmlOutputBufferCreateFile(file, encoder);
27353 desret_xmlOutputBufferPtr(ret_val);
27354 call_tests++;
27355 des_FILE_ptr(n_file, file, 0);
27356 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27357 xmlResetLastError();
27358 if (mem_base != xmlMemBlocks()) {
27359 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027361 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027362 printf(" %d", n_file);
27363 printf(" %d", n_encoder);
27364 printf("\n");
27365 }
27366 }
27367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027368 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027369#endif
27370
Daniel Veillard42595322004-11-08 10:52:06 +000027371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027372}
27373
27374
27375static int
27376test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027378
William M. Brack21e4ef22005-01-02 09:53:13 +000027379#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027380 int mem_base;
27381 xmlOutputBufferPtr ret_val;
27382 const char * URI; /* a C string containing the URI or filename */
27383 int n_URI;
27384 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27385 int n_encoder;
27386 int compression; /* the compression ration (0 none, 9 max). */
27387 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027388
Daniel Veillard42595322004-11-08 10:52:06 +000027389 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027390 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27391 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27392 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027393 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027394 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27395 compression = gen_int(n_compression, 2);
27396
27397 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27398 desret_xmlOutputBufferPtr(ret_val);
27399 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027400 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027401 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27402 des_int(n_compression, compression, 2);
27403 xmlResetLastError();
27404 if (mem_base != xmlMemBlocks()) {
27405 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027407 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027408 printf(" %d", n_URI);
27409 printf(" %d", n_encoder);
27410 printf(" %d", n_compression);
27411 printf("\n");
27412 }
27413 }
27414 }
27415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027416 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027417#endif
27418
Daniel Veillard42595322004-11-08 10:52:06 +000027419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027420}
27421
27422
27423static int
27424test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027426
William M. Brack21e4ef22005-01-02 09:53:13 +000027427#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027428 int mem_base;
27429 int ret_val;
27430 xmlOutputBufferPtr out; /* a buffered output */
27431 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027432
Daniel Veillard3d97e662004-11-04 10:49:00 +000027433 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27434 mem_base = xmlMemBlocks();
27435 out = gen_xmlOutputBufferPtr(n_out, 0);
27436
27437 ret_val = xmlOutputBufferFlush(out);
27438 desret_int(ret_val);
27439 call_tests++;
27440 des_xmlOutputBufferPtr(n_out, out, 0);
27441 xmlResetLastError();
27442 if (mem_base != xmlMemBlocks()) {
27443 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027445 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027446 printf(" %d", n_out);
27447 printf("\n");
27448 }
27449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027450 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027451#endif
27452
Daniel Veillard42595322004-11-08 10:52:06 +000027453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027454}
27455
27456
27457static int
27458test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027460
William M. Brack21e4ef22005-01-02 09:53:13 +000027461#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027462 int mem_base;
27463 int ret_val;
27464 xmlOutputBufferPtr out; /* a buffered parser output */
27465 int n_out;
27466 int len; /* the size in bytes of the array. */
27467 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027468 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027469 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027470
Daniel Veillard3d97e662004-11-04 10:49:00 +000027471 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27472 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27473 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27474 mem_base = xmlMemBlocks();
27475 out = gen_xmlOutputBufferPtr(n_out, 0);
27476 len = gen_int(n_len, 1);
27477 buf = gen_const_char_ptr(n_buf, 2);
27478
William M. Brackf13f77f2004-11-12 16:03:48 +000027479 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027480 desret_int(ret_val);
27481 call_tests++;
27482 des_xmlOutputBufferPtr(n_out, out, 0);
27483 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027484 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027485 xmlResetLastError();
27486 if (mem_base != xmlMemBlocks()) {
27487 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027489 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027490 printf(" %d", n_out);
27491 printf(" %d", n_len);
27492 printf(" %d", n_buf);
27493 printf("\n");
27494 }
27495 }
27496 }
27497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027498 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027499#endif
27500
Daniel Veillard42595322004-11-08 10:52:06 +000027501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027502}
27503
27504
27505static int
27506test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027508
27509
27510 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027512}
27513
27514
27515static int
27516test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027518
William M. Brack21e4ef22005-01-02 09:53:13 +000027519#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027520 int mem_base;
27521 int ret_val;
27522 xmlOutputBufferPtr out; /* a buffered parser output */
27523 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027524 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027525 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526
Daniel Veillard3d97e662004-11-04 10:49:00 +000027527 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27528 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27529 mem_base = xmlMemBlocks();
27530 out = gen_xmlOutputBufferPtr(n_out, 0);
27531 str = gen_const_char_ptr(n_str, 1);
27532
William M. Brackf13f77f2004-11-12 16:03:48 +000027533 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027534 desret_int(ret_val);
27535 call_tests++;
27536 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027537 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027538 xmlResetLastError();
27539 if (mem_base != xmlMemBlocks()) {
27540 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027542 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027543 printf(" %d", n_out);
27544 printf(" %d", n_str);
27545 printf("\n");
27546 }
27547 }
27548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027549 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027550#endif
27551
Daniel Veillard42595322004-11-08 10:52:06 +000027552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027553}
27554
27555
27556static int
27557test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027559
27560
27561 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027563}
27564
27565
27566static int
27567test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027569
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027570 int mem_base;
27571 xmlParserInputBufferPtr ret_val;
27572 int fd; /* a file descriptor number */
27573 int n_fd;
27574 xmlCharEncoding enc; /* the charset encoding if known */
27575 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027576
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027577 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27578 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27579 mem_base = xmlMemBlocks();
27580 fd = gen_int(n_fd, 0);
27581 enc = gen_xmlCharEncoding(n_enc, 1);
27582 if (fd >= 0) fd = -1;
27583
27584 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27585 desret_xmlParserInputBufferPtr(ret_val);
27586 call_tests++;
27587 des_int(n_fd, fd, 0);
27588 des_xmlCharEncoding(n_enc, enc, 1);
27589 xmlResetLastError();
27590 if (mem_base != xmlMemBlocks()) {
27591 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027593 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027594 printf(" %d", n_fd);
27595 printf(" %d", n_enc);
27596 printf("\n");
27597 }
27598 }
27599 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027601
Daniel Veillard42595322004-11-08 10:52:06 +000027602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027603}
27604
27605
27606static int
27607test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027609
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027610 int mem_base;
27611 xmlParserInputBufferPtr ret_val;
27612 FILE * file; /* a FILE* */
27613 int n_file;
27614 xmlCharEncoding enc; /* the charset encoding if known */
27615 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027616
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027617 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27618 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27619 mem_base = xmlMemBlocks();
27620 file = gen_FILE_ptr(n_file, 0);
27621 enc = gen_xmlCharEncoding(n_enc, 1);
27622
27623 ret_val = xmlParserInputBufferCreateFile(file, enc);
27624 desret_xmlParserInputBufferPtr(ret_val);
27625 call_tests++;
27626 des_FILE_ptr(n_file, file, 0);
27627 des_xmlCharEncoding(n_enc, enc, 1);
27628 xmlResetLastError();
27629 if (mem_base != xmlMemBlocks()) {
27630 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027632 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027633 printf(" %d", n_file);
27634 printf(" %d", n_enc);
27635 printf("\n");
27636 }
27637 }
27638 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027640
Daniel Veillard42595322004-11-08 10:52:06 +000027641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027642}
27643
27644
27645static int
27646test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027648
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027649 int mem_base;
27650 xmlParserInputBufferPtr ret_val;
27651 const char * URI; /* a C string containing the URI or filename */
27652 int n_URI;
27653 xmlCharEncoding enc; /* the charset encoding if known */
27654 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027655
Daniel Veillard42595322004-11-08 10:52:06 +000027656 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027657 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27658 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027659 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027660 enc = gen_xmlCharEncoding(n_enc, 1);
27661
27662 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27663 desret_xmlParserInputBufferPtr(ret_val);
27664 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027665 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027666 des_xmlCharEncoding(n_enc, enc, 1);
27667 xmlResetLastError();
27668 if (mem_base != xmlMemBlocks()) {
27669 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027671 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027672 printf(" %d", n_URI);
27673 printf(" %d", n_enc);
27674 printf("\n");
27675 }
27676 }
27677 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027678 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027679
Daniel Veillard42595322004-11-08 10:52:06 +000027680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027681}
27682
27683
27684static int
27685test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027687
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027688 int mem_base;
27689 xmlParserInputBufferPtr ret_val;
27690 char * mem; /* the memory input */
27691 int n_mem;
27692 int size; /* the length of the memory block */
27693 int n_size;
27694 xmlCharEncoding enc; /* the charset encoding if known */
27695 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027696
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027697 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27698 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27699 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27700 mem_base = xmlMemBlocks();
27701 mem = gen_const_char_ptr(n_mem, 0);
27702 size = gen_int(n_size, 1);
27703 enc = gen_xmlCharEncoding(n_enc, 2);
27704
William M. Brackf13f77f2004-11-12 16:03:48 +000027705 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027706 desret_xmlParserInputBufferPtr(ret_val);
27707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027708 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027709 des_int(n_size, size, 1);
27710 des_xmlCharEncoding(n_enc, enc, 2);
27711 xmlResetLastError();
27712 if (mem_base != xmlMemBlocks()) {
27713 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027715 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027716 printf(" %d", n_mem);
27717 printf(" %d", n_size);
27718 printf(" %d", n_enc);
27719 printf("\n");
27720 }
27721 }
27722 }
27723 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027725
Daniel Veillard42595322004-11-08 10:52:06 +000027726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027727}
27728
27729
27730static int
27731test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027733
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027734 int mem_base;
27735 xmlParserInputBufferPtr ret_val;
27736 char * mem; /* the memory input */
27737 int n_mem;
27738 int size; /* the length of the memory block */
27739 int n_size;
27740 xmlCharEncoding enc; /* the charset encoding if known */
27741 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027742
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027743 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27744 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27745 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27746 mem_base = xmlMemBlocks();
27747 mem = gen_const_char_ptr(n_mem, 0);
27748 size = gen_int(n_size, 1);
27749 enc = gen_xmlCharEncoding(n_enc, 2);
27750
William M. Brackf13f77f2004-11-12 16:03:48 +000027751 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027752 desret_xmlParserInputBufferPtr(ret_val);
27753 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027754 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027755 des_int(n_size, size, 1);
27756 des_xmlCharEncoding(n_enc, enc, 2);
27757 xmlResetLastError();
27758 if (mem_base != xmlMemBlocks()) {
27759 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027761 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027762 printf(" %d", n_mem);
27763 printf(" %d", n_size);
27764 printf(" %d", n_enc);
27765 printf("\n");
27766 }
27767 }
27768 }
27769 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027770 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027771
Daniel Veillard42595322004-11-08 10:52:06 +000027772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027773}
27774
27775
27776static int
27777test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027779
Daniel Veillard34099b42004-11-04 17:34:35 +000027780 int mem_base;
27781 int ret_val;
27782 xmlParserInputBufferPtr in; /* a buffered parser input */
27783 int n_in;
27784 int len; /* indicative value of the amount of chars to read */
27785 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027786
Daniel Veillard34099b42004-11-04 17:34:35 +000027787 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27788 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27789 mem_base = xmlMemBlocks();
27790 in = gen_xmlParserInputBufferPtr(n_in, 0);
27791 len = gen_int(n_len, 1);
27792
27793 ret_val = xmlParserInputBufferGrow(in, len);
27794 desret_int(ret_val);
27795 call_tests++;
27796 des_xmlParserInputBufferPtr(n_in, in, 0);
27797 des_int(n_len, len, 1);
27798 xmlResetLastError();
27799 if (mem_base != xmlMemBlocks()) {
27800 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027802 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027803 printf(" %d", n_in);
27804 printf(" %d", n_len);
27805 printf("\n");
27806 }
27807 }
27808 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027809 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027810
Daniel Veillard42595322004-11-08 10:52:06 +000027811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027812}
27813
27814
27815static int
27816test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027818
Daniel Veillard34099b42004-11-04 17:34:35 +000027819 int mem_base;
27820 int ret_val;
27821 xmlParserInputBufferPtr in; /* a buffered parser input */
27822 int n_in;
27823 int len; /* the size in bytes of the array. */
27824 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027825 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027826 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027827
Daniel Veillard34099b42004-11-04 17:34:35 +000027828 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27829 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27830 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27831 mem_base = xmlMemBlocks();
27832 in = gen_xmlParserInputBufferPtr(n_in, 0);
27833 len = gen_int(n_len, 1);
27834 buf = gen_const_char_ptr(n_buf, 2);
27835
William M. Brackf13f77f2004-11-12 16:03:48 +000027836 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027837 desret_int(ret_val);
27838 call_tests++;
27839 des_xmlParserInputBufferPtr(n_in, in, 0);
27840 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027841 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027842 xmlResetLastError();
27843 if (mem_base != xmlMemBlocks()) {
27844 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027846 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027847 printf(" %d", n_in);
27848 printf(" %d", n_len);
27849 printf(" %d", n_buf);
27850 printf("\n");
27851 }
27852 }
27853 }
27854 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027855 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027856
Daniel Veillard42595322004-11-08 10:52:06 +000027857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027858}
27859
27860
27861static int
27862test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027864
Daniel Veillard34099b42004-11-04 17:34:35 +000027865 int mem_base;
27866 int ret_val;
27867 xmlParserInputBufferPtr in; /* a buffered parser input */
27868 int n_in;
27869 int len; /* indicative value of the amount of chars to read */
27870 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027871
Daniel Veillard34099b42004-11-04 17:34:35 +000027872 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27873 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27874 mem_base = xmlMemBlocks();
27875 in = gen_xmlParserInputBufferPtr(n_in, 0);
27876 len = gen_int(n_len, 1);
27877
27878 ret_val = xmlParserInputBufferRead(in, len);
27879 desret_int(ret_val);
27880 call_tests++;
27881 des_xmlParserInputBufferPtr(n_in, in, 0);
27882 des_int(n_len, len, 1);
27883 xmlResetLastError();
27884 if (mem_base != xmlMemBlocks()) {
27885 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027887 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027888 printf(" %d", n_in);
27889 printf(" %d", n_len);
27890 printf("\n");
27891 }
27892 }
27893 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027895
Daniel Veillard42595322004-11-08 10:52:06 +000027896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027897}
27898
27899
27900static int
27901test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027903
27904 int mem_base;
27905 int ret_val;
27906
27907 mem_base = xmlMemBlocks();
27908
27909 ret_val = xmlPopInputCallbacks();
27910 desret_int(ret_val);
27911 call_tests++;
27912 xmlResetLastError();
27913 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027914 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027916 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027917 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027918 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027919 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027920
Daniel Veillard42595322004-11-08 10:52:06 +000027921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027922}
27923
27924
27925static int
27926test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027928
27929 int mem_base;
27930
27931 mem_base = xmlMemBlocks();
27932
27933 xmlRegisterDefaultInputCallbacks();
27934 call_tests++;
27935 xmlResetLastError();
27936 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027937 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027939 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027940 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027941 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027942 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027943
Daniel Veillard42595322004-11-08 10:52:06 +000027944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027945}
27946
27947
27948static int
27949test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027951
William M. Brack21e4ef22005-01-02 09:53:13 +000027952#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027953 int mem_base;
27954
27955 mem_base = xmlMemBlocks();
27956
27957 xmlRegisterDefaultOutputCallbacks();
27958 call_tests++;
27959 xmlResetLastError();
27960 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027961 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027963 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027964 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027966 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027967#endif
27968
Daniel Veillard42595322004-11-08 10:52:06 +000027969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027970}
27971
27972
27973static int
27974test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027976
William M. Brack21e4ef22005-01-02 09:53:13 +000027977#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027978 int mem_base;
27979
27980 mem_base = xmlMemBlocks();
27981
27982 xmlRegisterHTTPPostCallbacks();
27983 call_tests++;
27984 xmlResetLastError();
27985 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027986 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027988 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027989 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027991 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027992#endif
27993
Daniel Veillard42595322004-11-08 10:52:06 +000027994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027995}
27996
27997static int
27998test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028000
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028001 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028002 test_ret += test_xmlAllocOutputBuffer();
28003 test_ret += test_xmlAllocParserInputBuffer();
28004 test_ret += test_xmlCheckFilename();
28005 test_ret += test_xmlCheckHTTPInput();
28006 test_ret += test_xmlCleanupInputCallbacks();
28007 test_ret += test_xmlCleanupOutputCallbacks();
28008 test_ret += test_xmlFileClose();
28009 test_ret += test_xmlFileMatch();
28010 test_ret += test_xmlFileOpen();
28011 test_ret += test_xmlFileRead();
28012 test_ret += test_xmlIOFTPClose();
28013 test_ret += test_xmlIOFTPMatch();
28014 test_ret += test_xmlIOFTPOpen();
28015 test_ret += test_xmlIOFTPRead();
28016 test_ret += test_xmlIOHTTPClose();
28017 test_ret += test_xmlIOHTTPMatch();
28018 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000028019 test_ret += test_xmlIOHTTPRead();
28020 test_ret += test_xmlNoNetExternalEntityLoader();
28021 test_ret += test_xmlNormalizeWindowsPath();
28022 test_ret += test_xmlOutputBufferCreateFd();
28023 test_ret += test_xmlOutputBufferCreateFile();
28024 test_ret += test_xmlOutputBufferCreateFilename();
28025 test_ret += test_xmlOutputBufferFlush();
28026 test_ret += test_xmlOutputBufferWrite();
28027 test_ret += test_xmlOutputBufferWriteEscape();
28028 test_ret += test_xmlOutputBufferWriteString();
28029 test_ret += test_xmlParserGetDirectory();
28030 test_ret += test_xmlParserInputBufferCreateFd();
28031 test_ret += test_xmlParserInputBufferCreateFile();
28032 test_ret += test_xmlParserInputBufferCreateFilename();
28033 test_ret += test_xmlParserInputBufferCreateMem();
28034 test_ret += test_xmlParserInputBufferCreateStatic();
28035 test_ret += test_xmlParserInputBufferGrow();
28036 test_ret += test_xmlParserInputBufferPush();
28037 test_ret += test_xmlParserInputBufferRead();
28038 test_ret += test_xmlPopInputCallbacks();
28039 test_ret += test_xmlRegisterDefaultInputCallbacks();
28040 test_ret += test_xmlRegisterDefaultOutputCallbacks();
28041 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028042
Daniel Veillard42595322004-11-08 10:52:06 +000028043 if (test_ret != 0)
28044 printf("Module xmlIO: %d errors\n", test_ret);
28045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028046}
Daniel Veillarda521d282004-11-09 14:59:59 +000028047#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028048
Daniel Veillarda82b1822004-11-08 16:24:57 +000028049#define gen_nb_xmlAutomataPtr 1
28050static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28051 return(NULL);
28052}
28053static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28054}
Daniel Veillarda521d282004-11-09 14:59:59 +000028055#endif
28056
Daniel Veillarda82b1822004-11-08 16:24:57 +000028057
28058static int
28059test_xmlAutomataCompile(void) {
28060 int test_ret = 0;
28061
28062
28063 /* missing type support */
28064 return(test_ret);
28065}
28066
28067
28068static int
28069test_xmlAutomataGetInitState(void) {
28070 int test_ret = 0;
28071
28072
28073 /* missing type support */
28074 return(test_ret);
28075}
28076
28077
28078static int
28079test_xmlAutomataIsDeterminist(void) {
28080 int test_ret = 0;
28081
William M. Brack21e4ef22005-01-02 09:53:13 +000028082#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028083 int mem_base;
28084 int ret_val;
28085 xmlAutomataPtr am; /* an automata */
28086 int n_am;
28087
28088 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28089 mem_base = xmlMemBlocks();
28090 am = gen_xmlAutomataPtr(n_am, 0);
28091
28092 ret_val = xmlAutomataIsDeterminist(am);
28093 desret_int(ret_val);
28094 call_tests++;
28095 des_xmlAutomataPtr(n_am, am, 0);
28096 xmlResetLastError();
28097 if (mem_base != xmlMemBlocks()) {
28098 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
28099 xmlMemBlocks() - mem_base);
28100 test_ret++;
28101 printf(" %d", n_am);
28102 printf("\n");
28103 }
28104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028105 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028106#endif
28107
Daniel Veillarda82b1822004-11-08 16:24:57 +000028108 return(test_ret);
28109}
28110
Daniel Veillarda521d282004-11-09 14:59:59 +000028111#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000028112
28113#define gen_nb_xmlAutomataStatePtr 1
28114static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28115 return(NULL);
28116}
28117static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28118}
Daniel Veillarda521d282004-11-09 14:59:59 +000028119#endif
28120
Daniel Veillarda82b1822004-11-08 16:24:57 +000028121
28122static int
28123test_xmlAutomataNewAllTrans(void) {
28124 int test_ret = 0;
28125
28126
28127 /* missing type support */
28128 return(test_ret);
28129}
28130
28131
28132static int
28133test_xmlAutomataNewCountTrans(void) {
28134 int test_ret = 0;
28135
28136
28137 /* missing type support */
28138 return(test_ret);
28139}
28140
28141
28142static int
28143test_xmlAutomataNewCountTrans2(void) {
28144 int test_ret = 0;
28145
28146
28147 /* missing type support */
28148 return(test_ret);
28149}
28150
28151
28152static int
28153test_xmlAutomataNewCountedTrans(void) {
28154 int test_ret = 0;
28155
28156
28157 /* missing type support */
28158 return(test_ret);
28159}
28160
28161
28162static int
28163test_xmlAutomataNewCounter(void) {
28164 int test_ret = 0;
28165
William M. Brack21e4ef22005-01-02 09:53:13 +000028166#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028167 int mem_base;
28168 int ret_val;
28169 xmlAutomataPtr am; /* an automata */
28170 int n_am;
28171 int min; /* the minimal value on the counter */
28172 int n_min;
28173 int max; /* the maximal value on the counter */
28174 int n_max;
28175
28176 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28177 for (n_min = 0;n_min < gen_nb_int;n_min++) {
28178 for (n_max = 0;n_max < gen_nb_int;n_max++) {
28179 mem_base = xmlMemBlocks();
28180 am = gen_xmlAutomataPtr(n_am, 0);
28181 min = gen_int(n_min, 1);
28182 max = gen_int(n_max, 2);
28183
28184 ret_val = xmlAutomataNewCounter(am, min, max);
28185 desret_int(ret_val);
28186 call_tests++;
28187 des_xmlAutomataPtr(n_am, am, 0);
28188 des_int(n_min, min, 1);
28189 des_int(n_max, max, 2);
28190 xmlResetLastError();
28191 if (mem_base != xmlMemBlocks()) {
28192 printf("Leak of %d blocks found in xmlAutomataNewCounter",
28193 xmlMemBlocks() - mem_base);
28194 test_ret++;
28195 printf(" %d", n_am);
28196 printf(" %d", n_min);
28197 printf(" %d", n_max);
28198 printf("\n");
28199 }
28200 }
28201 }
28202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028203 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028204#endif
28205
Daniel Veillarda82b1822004-11-08 16:24:57 +000028206 return(test_ret);
28207}
28208
28209
28210static int
28211test_xmlAutomataNewCounterTrans(void) {
28212 int test_ret = 0;
28213
28214
28215 /* missing type support */
28216 return(test_ret);
28217}
28218
28219
28220static int
28221test_xmlAutomataNewEpsilon(void) {
28222 int test_ret = 0;
28223
28224
28225 /* missing type support */
28226 return(test_ret);
28227}
28228
28229
28230static int
28231test_xmlAutomataNewOnceTrans(void) {
28232 int test_ret = 0;
28233
28234
28235 /* missing type support */
28236 return(test_ret);
28237}
28238
28239
28240static int
28241test_xmlAutomataNewOnceTrans2(void) {
28242 int test_ret = 0;
28243
28244
28245 /* missing type support */
28246 return(test_ret);
28247}
28248
28249
28250static int
28251test_xmlAutomataNewState(void) {
28252 int test_ret = 0;
28253
28254
28255 /* missing type support */
28256 return(test_ret);
28257}
28258
28259
28260static int
28261test_xmlAutomataNewTransition(void) {
28262 int test_ret = 0;
28263
28264
28265 /* missing type support */
28266 return(test_ret);
28267}
28268
28269
28270static int
28271test_xmlAutomataNewTransition2(void) {
28272 int test_ret = 0;
28273
28274
28275 /* missing type support */
28276 return(test_ret);
28277}
28278
28279
28280static int
28281test_xmlAutomataSetFinalState(void) {
28282 int test_ret = 0;
28283
William M. Brack21e4ef22005-01-02 09:53:13 +000028284#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028285 int mem_base;
28286 int ret_val;
28287 xmlAutomataPtr am; /* an automata */
28288 int n_am;
28289 xmlAutomataStatePtr state; /* a state in this automata */
28290 int n_state;
28291
28292 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28293 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28294 mem_base = xmlMemBlocks();
28295 am = gen_xmlAutomataPtr(n_am, 0);
28296 state = gen_xmlAutomataStatePtr(n_state, 1);
28297
28298 ret_val = xmlAutomataSetFinalState(am, state);
28299 desret_int(ret_val);
28300 call_tests++;
28301 des_xmlAutomataPtr(n_am, am, 0);
28302 des_xmlAutomataStatePtr(n_state, state, 1);
28303 xmlResetLastError();
28304 if (mem_base != xmlMemBlocks()) {
28305 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28306 xmlMemBlocks() - mem_base);
28307 test_ret++;
28308 printf(" %d", n_am);
28309 printf(" %d", n_state);
28310 printf("\n");
28311 }
28312 }
28313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028314 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028315#endif
28316
Daniel Veillarda82b1822004-11-08 16:24:57 +000028317 return(test_ret);
28318}
28319
28320
28321static int
28322test_xmlNewAutomata(void) {
28323 int test_ret = 0;
28324
28325
28326 /* missing type support */
28327 return(test_ret);
28328}
28329
28330static int
28331test_xmlautomata(void) {
28332 int test_ret = 0;
28333
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028334 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028335 test_ret += test_xmlAutomataCompile();
28336 test_ret += test_xmlAutomataGetInitState();
28337 test_ret += test_xmlAutomataIsDeterminist();
28338 test_ret += test_xmlAutomataNewAllTrans();
28339 test_ret += test_xmlAutomataNewCountTrans();
28340 test_ret += test_xmlAutomataNewCountTrans2();
28341 test_ret += test_xmlAutomataNewCountedTrans();
28342 test_ret += test_xmlAutomataNewCounter();
28343 test_ret += test_xmlAutomataNewCounterTrans();
28344 test_ret += test_xmlAutomataNewEpsilon();
28345 test_ret += test_xmlAutomataNewOnceTrans();
28346 test_ret += test_xmlAutomataNewOnceTrans2();
28347 test_ret += test_xmlAutomataNewState();
28348 test_ret += test_xmlAutomataNewTransition();
28349 test_ret += test_xmlAutomataNewTransition2();
28350 test_ret += test_xmlAutomataSetFinalState();
28351 test_ret += test_xmlNewAutomata();
28352
28353 if (test_ret != 0)
28354 printf("Module xmlautomata: %d errors\n", test_ret);
28355 return(test_ret);
28356}
28357
Daniel Veillardce682bc2004-11-05 17:22:25 +000028358#define gen_nb_xmlGenericErrorFunc_ptr 1
28359static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28360 return(NULL);
28361}
28362static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28363}
28364
Daniel Veillardd93f6252004-11-02 15:53:51 +000028365static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028366test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028368
Daniel Veillardce682bc2004-11-05 17:22:25 +000028369 int mem_base;
28370 xmlGenericErrorFunc * handler; /* the handler */
28371 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028372
Daniel Veillardce682bc2004-11-05 17:22:25 +000028373 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28374 mem_base = xmlMemBlocks();
28375 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28376
28377 initGenericErrorDefaultFunc(handler);
28378 call_tests++;
28379 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28380 xmlResetLastError();
28381 if (mem_base != xmlMemBlocks()) {
28382 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028385 printf(" %d", n_handler);
28386 printf("\n");
28387 }
28388 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028390
Daniel Veillard42595322004-11-08 10:52:06 +000028391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028392}
28393
28394
Daniel Veillardce682bc2004-11-05 17:22:25 +000028395#define gen_nb_xmlErrorPtr 1
28396static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28397 return(NULL);
28398}
28399static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28400}
28401
Daniel Veillardd93f6252004-11-02 15:53:51 +000028402static int
28403test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028405
Daniel Veillardce682bc2004-11-05 17:22:25 +000028406 int mem_base;
28407 int ret_val;
28408 xmlErrorPtr from; /* a source error */
28409 int n_from;
28410 xmlErrorPtr to; /* a target error */
28411 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028412
Daniel Veillardce682bc2004-11-05 17:22:25 +000028413 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28414 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28415 mem_base = xmlMemBlocks();
28416 from = gen_xmlErrorPtr(n_from, 0);
28417 to = gen_xmlErrorPtr(n_to, 1);
28418
28419 ret_val = xmlCopyError(from, to);
28420 desret_int(ret_val);
28421 call_tests++;
28422 des_xmlErrorPtr(n_from, from, 0);
28423 des_xmlErrorPtr(n_to, to, 1);
28424 xmlResetLastError();
28425 if (mem_base != xmlMemBlocks()) {
28426 printf("Leak of %d blocks found in xmlCopyError",
28427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028428 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028429 printf(" %d", n_from);
28430 printf(" %d", n_to);
28431 printf("\n");
28432 }
28433 }
28434 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028435 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028436
Daniel Veillard42595322004-11-08 10:52:06 +000028437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028438}
28439
28440
28441static int
28442test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028444
28445
28446 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028448}
28449
28450
28451static int
28452test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028454
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028455 int mem_base;
28456 void * ctx; /* an XML parser context */
28457 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028458
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028459 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28460 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028461 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028462
28463 xmlCtxtResetLastError(ctx);
28464 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028465 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028466 xmlResetLastError();
28467 if (mem_base != xmlMemBlocks()) {
28468 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028470 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028471 printf(" %d", n_ctx);
28472 printf("\n");
28473 }
28474 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028476
Daniel Veillard42595322004-11-08 10:52:06 +000028477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028478}
28479
28480
28481static int
28482test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028484
28485
28486 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028488}
28489
28490
28491static int
28492test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028494
28495
28496 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028498}
28499
28500
28501static int
28502test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028504
Daniel Veillardce682bc2004-11-05 17:22:25 +000028505 int mem_base;
28506 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28507 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028508
Daniel Veillardce682bc2004-11-05 17:22:25 +000028509 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28510 mem_base = xmlMemBlocks();
28511 input = gen_xmlParserInputPtr(n_input, 0);
28512
28513 xmlParserPrintFileContext(input);
28514 call_tests++;
28515 des_xmlParserInputPtr(n_input, input, 0);
28516 xmlResetLastError();
28517 if (mem_base != xmlMemBlocks()) {
28518 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028520 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028521 printf(" %d", n_input);
28522 printf("\n");
28523 }
28524 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028525 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028526
Daniel Veillard42595322004-11-08 10:52:06 +000028527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028528}
28529
28530
28531static int
28532test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028534
Daniel Veillardce682bc2004-11-05 17:22:25 +000028535 int mem_base;
28536 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28537 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028538
Daniel Veillardce682bc2004-11-05 17:22:25 +000028539 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28540 mem_base = xmlMemBlocks();
28541 input = gen_xmlParserInputPtr(n_input, 0);
28542
28543 xmlParserPrintFileInfo(input);
28544 call_tests++;
28545 des_xmlParserInputPtr(n_input, input, 0);
28546 xmlResetLastError();
28547 if (mem_base != xmlMemBlocks()) {
28548 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028550 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028551 printf(" %d", n_input);
28552 printf("\n");
28553 }
28554 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028556
Daniel Veillard42595322004-11-08 10:52:06 +000028557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028558}
28559
28560
28561static int
28562test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028564
28565
28566 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028568}
28569
28570
28571static int
28572test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028574
28575
28576 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028578}
28579
28580
28581static int
28582test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028584
28585
28586 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028588}
28589
28590
28591static int
28592test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028594
Daniel Veillardce682bc2004-11-05 17:22:25 +000028595 int mem_base;
28596 xmlErrorPtr err; /* pointer to the error. */
28597 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028598
Daniel Veillardce682bc2004-11-05 17:22:25 +000028599 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28600 mem_base = xmlMemBlocks();
28601 err = gen_xmlErrorPtr(n_err, 0);
28602
28603 xmlResetError(err);
28604 call_tests++;
28605 des_xmlErrorPtr(n_err, err, 0);
28606 xmlResetLastError();
28607 if (mem_base != xmlMemBlocks()) {
28608 printf("Leak of %d blocks found in xmlResetError",
28609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028610 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028611 printf(" %d", n_err);
28612 printf("\n");
28613 }
28614 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028616
Daniel Veillard42595322004-11-08 10:52:06 +000028617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028618}
28619
28620
28621static int
28622test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028624
28625
28626
28627 xmlResetLastError();
28628 call_tests++;
28629 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028630 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028631
Daniel Veillard42595322004-11-08 10:52:06 +000028632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028633}
28634
28635
28636static int
28637test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028639
28640
28641 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028643}
28644
28645
28646static int
28647test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028649
28650
28651 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028653}
28654
28655static int
28656test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028658
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028659 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028660 test_ret += test_initGenericErrorDefaultFunc();
28661 test_ret += test_xmlCopyError();
28662 test_ret += test_xmlCtxtGetLastError();
28663 test_ret += test_xmlCtxtResetLastError();
28664 test_ret += test_xmlGetLastError();
28665 test_ret += test_xmlParserError();
28666 test_ret += test_xmlParserPrintFileContext();
28667 test_ret += test_xmlParserPrintFileInfo();
28668 test_ret += test_xmlParserValidityError();
28669 test_ret += test_xmlParserValidityWarning();
28670 test_ret += test_xmlParserWarning();
28671 test_ret += test_xmlResetError();
28672 test_ret += test_xmlResetLastError();
28673 test_ret += test_xmlSetGenericErrorFunc();
28674 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028675
Daniel Veillard42595322004-11-08 10:52:06 +000028676 if (test_ret != 0)
28677 printf("Module xmlerror: %d errors\n", test_ret);
28678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028679}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028680#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028681
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028682#define gen_nb_xmlModulePtr 1
28683static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28684 return(NULL);
28685}
28686static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28687}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028688#endif
28689
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028690
28691static int
28692test_xmlModuleClose(void) {
28693 int test_ret = 0;
28694
28695#if defined(LIBXML_MODULES_ENABLED)
28696 int mem_base;
28697 int ret_val;
28698 xmlModulePtr module; /* the module handle */
28699 int n_module;
28700
28701 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28702 mem_base = xmlMemBlocks();
28703 module = gen_xmlModulePtr(n_module, 0);
28704
28705 ret_val = xmlModuleClose(module);
28706 desret_int(ret_val);
28707 call_tests++;
28708 des_xmlModulePtr(n_module, module, 0);
28709 xmlResetLastError();
28710 if (mem_base != xmlMemBlocks()) {
28711 printf("Leak of %d blocks found in xmlModuleClose",
28712 xmlMemBlocks() - mem_base);
28713 test_ret++;
28714 printf(" %d", n_module);
28715 printf("\n");
28716 }
28717 }
28718 function_tests++;
28719#endif
28720
28721 return(test_ret);
28722}
28723
28724
28725static int
28726test_xmlModuleOpen(void) {
28727 int test_ret = 0;
28728
28729
28730 /* missing type support */
28731 return(test_ret);
28732}
28733
28734
28735static int
28736test_xmlModuleSymbol(void) {
28737 int test_ret = 0;
28738
28739#if defined(LIBXML_MODULES_ENABLED)
28740 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028741 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028742 xmlModulePtr module; /* the module */
28743 int n_module;
28744 char * name; /* the name of the symbol */
28745 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028746 void ** symbol; /* the resulting symbol address */
28747 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028748
28749 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28750 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028751 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028752 mem_base = xmlMemBlocks();
28753 module = gen_xmlModulePtr(n_module, 0);
28754 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028755 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028756
Daniel Veillardbe076e92005-01-04 20:18:14 +000028757 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28758 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028759 call_tests++;
28760 des_xmlModulePtr(n_module, module, 0);
28761 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028762 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028763 xmlResetLastError();
28764 if (mem_base != xmlMemBlocks()) {
28765 printf("Leak of %d blocks found in xmlModuleSymbol",
28766 xmlMemBlocks() - mem_base);
28767 test_ret++;
28768 printf(" %d", n_module);
28769 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028770 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028771 printf("\n");
28772 }
28773 }
28774 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028775 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028776 function_tests++;
28777#endif
28778
28779 return(test_ret);
28780}
28781
28782static int
28783test_xmlmodule(void) {
28784 int test_ret = 0;
28785
28786 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28787 test_ret += test_xmlModuleClose();
28788 test_ret += test_xmlModuleOpen();
28789 test_ret += test_xmlModuleSymbol();
28790
28791 if (test_ret != 0)
28792 printf("Module xmlmodule: %d errors\n", test_ret);
28793 return(test_ret);
28794}
28795
Daniel Veillardd93f6252004-11-02 15:53:51 +000028796static int
28797test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028799
William M. Brack21e4ef22005-01-02 09:53:13 +000028800#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028801 int mem_base;
28802 xmlTextReaderPtr ret_val;
28803 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28804 int n_input;
28805 const char * URI; /* the URI information for the source if available */
28806 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028807
Daniel Veillard34099b42004-11-04 17:34:35 +000028808 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28809 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28810 mem_base = xmlMemBlocks();
28811 input = gen_xmlParserInputBufferPtr(n_input, 0);
28812 URI = gen_filepath(n_URI, 1);
28813
28814 ret_val = xmlNewTextReader(input, URI);
28815 desret_xmlTextReaderPtr(ret_val);
28816 call_tests++;
28817 des_xmlParserInputBufferPtr(n_input, input, 0);
28818 des_filepath(n_URI, URI, 1);
28819 xmlResetLastError();
28820 if (mem_base != xmlMemBlocks()) {
28821 printf("Leak of %d blocks found in xmlNewTextReader",
28822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028823 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028824 printf(" %d", n_input);
28825 printf(" %d", n_URI);
28826 printf("\n");
28827 }
28828 }
28829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028830 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028831#endif
28832
Daniel Veillard42595322004-11-08 10:52:06 +000028833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028834}
28835
28836
28837static int
28838test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028840
William M. Brack21e4ef22005-01-02 09:53:13 +000028841#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028842 int mem_base;
28843 xmlTextReaderPtr ret_val;
28844 const char * URI; /* the URI of the resource to process */
28845 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028846
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028847 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28848 mem_base = xmlMemBlocks();
28849 URI = gen_filepath(n_URI, 0);
28850
28851 ret_val = xmlNewTextReaderFilename(URI);
28852 desret_xmlTextReaderPtr(ret_val);
28853 call_tests++;
28854 des_filepath(n_URI, URI, 0);
28855 xmlResetLastError();
28856 if (mem_base != xmlMemBlocks()) {
28857 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028859 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028860 printf(" %d", n_URI);
28861 printf("\n");
28862 }
28863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028864 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028865#endif
28866
Daniel Veillard42595322004-11-08 10:52:06 +000028867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028868}
28869
28870
28871static int
28872test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028874
William M. Brack21e4ef22005-01-02 09:53:13 +000028875#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028876 int mem_base;
28877 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028878 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028879 int n_cur;
28880 const char * URL; /* the base URL to use for the document */
28881 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028882 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028883 int n_encoding;
28884 int options; /* a combination of xmlParserOption */
28885 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028886
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028887 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28888 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28889 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028890 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028891 mem_base = xmlMemBlocks();
28892 cur = gen_const_xmlChar_ptr(n_cur, 0);
28893 URL = gen_filepath(n_URL, 1);
28894 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028895 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028896
William M. Brackf13f77f2004-11-12 16:03:48 +000028897 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028898 desret_xmlTextReaderPtr(ret_val);
28899 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028900 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028901 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028902 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028903 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028904 xmlResetLastError();
28905 if (mem_base != xmlMemBlocks()) {
28906 printf("Leak of %d blocks found in xmlReaderForDoc",
28907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028908 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028909 printf(" %d", n_cur);
28910 printf(" %d", n_URL);
28911 printf(" %d", n_encoding);
28912 printf(" %d", n_options);
28913 printf("\n");
28914 }
28915 }
28916 }
28917 }
28918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028919 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028920#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028921
Daniel Veillard42595322004-11-08 10:52:06 +000028922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028923}
28924
28925
28926static int
28927test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028929
William M. Brack21e4ef22005-01-02 09:53:13 +000028930#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028931 int mem_base;
28932 xmlTextReaderPtr ret_val;
28933 const char * filename; /* a file or URL */
28934 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028935 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028936 int n_encoding;
28937 int options; /* a combination of xmlParserOption */
28938 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028939
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028940 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28941 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028942 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028943 mem_base = xmlMemBlocks();
28944 filename = gen_filepath(n_filename, 0);
28945 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028946 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028947
William M. Brackf13f77f2004-11-12 16:03:48 +000028948 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028949 desret_xmlTextReaderPtr(ret_val);
28950 call_tests++;
28951 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028952 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028953 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028954 xmlResetLastError();
28955 if (mem_base != xmlMemBlocks()) {
28956 printf("Leak of %d blocks found in xmlReaderForFile",
28957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028958 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028959 printf(" %d", n_filename);
28960 printf(" %d", n_encoding);
28961 printf(" %d", n_options);
28962 printf("\n");
28963 }
28964 }
28965 }
28966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028967 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028968#endif
28969
Daniel Veillard42595322004-11-08 10:52:06 +000028970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028971}
28972
28973
28974static int
28975test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028977
William M. Brack21e4ef22005-01-02 09:53:13 +000028978#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028979 int mem_base;
28980 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028981 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028982 int n_buffer;
28983 int size; /* the size of the array */
28984 int n_size;
28985 const char * URL; /* the base URL to use for the document */
28986 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028987 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028988 int n_encoding;
28989 int options; /* a combination of xmlParserOption */
28990 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028991
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028992 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28993 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28994 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28995 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028996 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028997 mem_base = xmlMemBlocks();
28998 buffer = gen_const_char_ptr(n_buffer, 0);
28999 size = gen_int(n_size, 1);
29000 URL = gen_filepath(n_URL, 2);
29001 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000029002 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029003
William M. Brackf13f77f2004-11-12 16:03:48 +000029004 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029005 desret_xmlTextReaderPtr(ret_val);
29006 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000029007 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029008 des_int(n_size, size, 1);
29009 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000029010 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000029011 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029012 xmlResetLastError();
29013 if (mem_base != xmlMemBlocks()) {
29014 printf("Leak of %d blocks found in xmlReaderForMemory",
29015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029016 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029017 printf(" %d", n_buffer);
29018 printf(" %d", n_size);
29019 printf(" %d", n_URL);
29020 printf(" %d", n_encoding);
29021 printf(" %d", n_options);
29022 printf("\n");
29023 }
29024 }
29025 }
29026 }
29027 }
29028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029029 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029030#endif
29031
Daniel Veillard42595322004-11-08 10:52:06 +000029032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029033}
29034
29035
29036static int
29037test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029039
William M. Brack21e4ef22005-01-02 09:53:13 +000029040#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029041 int mem_base;
29042 int ret_val;
29043 xmlTextReaderPtr reader; /* an XML reader */
29044 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029045 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029046 int n_cur;
29047 const char * URL; /* the base URL to use for the document */
29048 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029049 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029050 int n_encoding;
29051 int options; /* a combination of xmlParserOption */
29052 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029053
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029054 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29055 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
29056 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
29057 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000029058 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029060 reader = gen_xmlTextReaderPtr(n_reader, 0);
29061 cur = gen_const_xmlChar_ptr(n_cur, 1);
29062 URL = gen_filepath(n_URL, 2);
29063 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000029064 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029065
William M. Brackf13f77f2004-11-12 16:03:48 +000029066 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029067 desret_int(ret_val);
29068 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029069 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029070 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000029071 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000029072 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000029073 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029074 xmlResetLastError();
29075 if (mem_base != xmlMemBlocks()) {
29076 printf("Leak of %d blocks found in xmlReaderNewDoc",
29077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029078 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029079 printf(" %d", n_reader);
29080 printf(" %d", n_cur);
29081 printf(" %d", n_URL);
29082 printf(" %d", n_encoding);
29083 printf(" %d", n_options);
29084 printf("\n");
29085 }
29086 }
29087 }
29088 }
29089 }
29090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029091 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029092#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000029093
Daniel Veillard42595322004-11-08 10:52:06 +000029094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029095}
29096
29097
29098static int
29099test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029101
William M. Brack21e4ef22005-01-02 09:53:13 +000029102#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029103 int mem_base;
29104 int ret_val;
29105 xmlTextReaderPtr reader; /* an XML reader */
29106 int n_reader;
29107 const char * filename; /* a file or URL */
29108 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029109 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029110 int n_encoding;
29111 int options; /* a combination of xmlParserOption */
29112 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029113
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029114 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29115 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
29116 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000029117 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029119 reader = gen_xmlTextReaderPtr(n_reader, 0);
29120 filename = gen_filepath(n_filename, 1);
29121 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000029122 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029123
William M. Brackf13f77f2004-11-12 16:03:48 +000029124 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029125 desret_int(ret_val);
29126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029127 des_xmlTextReaderPtr(n_reader, reader, 0);
29128 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000029129 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000029130 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029131 xmlResetLastError();
29132 if (mem_base != xmlMemBlocks()) {
29133 printf("Leak of %d blocks found in xmlReaderNewFile",
29134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029135 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029136 printf(" %d", n_reader);
29137 printf(" %d", n_filename);
29138 printf(" %d", n_encoding);
29139 printf(" %d", n_options);
29140 printf("\n");
29141 }
29142 }
29143 }
29144 }
29145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029146 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029147#endif
29148
Daniel Veillard42595322004-11-08 10:52:06 +000029149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029150}
29151
29152
29153static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029154test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029156
William M. Brack21e4ef22005-01-02 09:53:13 +000029157#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029158 int mem_base;
29159 int ret_val;
29160 xmlTextReaderPtr reader; /* an XML reader */
29161 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029162 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029163 int n_buffer;
29164 int size; /* the size of the array */
29165 int n_size;
29166 const char * URL; /* the base URL to use for the document */
29167 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029168 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029169 int n_encoding;
29170 int options; /* a combination of xmlParserOption */
29171 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029172
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029173 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29174 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
29175 for (n_size = 0;n_size < gen_nb_int;n_size++) {
29176 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
29177 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000029178 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029180 reader = gen_xmlTextReaderPtr(n_reader, 0);
29181 buffer = gen_const_char_ptr(n_buffer, 1);
29182 size = gen_int(n_size, 2);
29183 URL = gen_filepath(n_URL, 3);
29184 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000029185 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029186
William M. Brackf13f77f2004-11-12 16:03:48 +000029187 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029188 desret_int(ret_val);
29189 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029190 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029191 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000029192 des_int(n_size, size, 2);
29193 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000029194 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000029195 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029196 xmlResetLastError();
29197 if (mem_base != xmlMemBlocks()) {
29198 printf("Leak of %d blocks found in xmlReaderNewMemory",
29199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029200 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029201 printf(" %d", n_reader);
29202 printf(" %d", n_buffer);
29203 printf(" %d", n_size);
29204 printf(" %d", n_URL);
29205 printf(" %d", n_encoding);
29206 printf(" %d", n_options);
29207 printf("\n");
29208 }
29209 }
29210 }
29211 }
29212 }
29213 }
29214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029215 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029216#endif
29217
Daniel Veillard42595322004-11-08 10:52:06 +000029218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029219}
29220
29221
29222static int
29223test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029225
William M. Brack21e4ef22005-01-02 09:53:13 +000029226#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029227 int mem_base;
29228 int ret_val;
29229 xmlTextReaderPtr reader; /* an XML reader */
29230 int n_reader;
29231 xmlDocPtr doc; /* a preparsed document */
29232 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029233
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029234 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29235 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029237 reader = gen_xmlTextReaderPtr(n_reader, 0);
29238 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029239
29240 ret_val = xmlReaderNewWalker(reader, doc);
29241 desret_int(ret_val);
29242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029243 des_xmlTextReaderPtr(n_reader, reader, 0);
29244 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029245 xmlResetLastError();
29246 if (mem_base != xmlMemBlocks()) {
29247 printf("Leak of %d blocks found in xmlReaderNewWalker",
29248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029249 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029250 printf(" %d", n_reader);
29251 printf(" %d", n_doc);
29252 printf("\n");
29253 }
29254 }
29255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029256 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029257#endif
29258
Daniel Veillard42595322004-11-08 10:52:06 +000029259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029260}
29261
29262
29263static int
29264test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029266
William M. Brack21e4ef22005-01-02 09:53:13 +000029267#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029268 int mem_base;
29269 xmlTextReaderPtr ret_val;
29270 xmlDocPtr doc; /* a preparsed document */
29271 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029272
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29274 mem_base = xmlMemBlocks();
29275 doc = gen_xmlDocPtr(n_doc, 0);
29276
29277 ret_val = xmlReaderWalker(doc);
29278 desret_xmlTextReaderPtr(ret_val);
29279 call_tests++;
29280 des_xmlDocPtr(n_doc, doc, 0);
29281 xmlResetLastError();
29282 if (mem_base != xmlMemBlocks()) {
29283 printf("Leak of %d blocks found in xmlReaderWalker",
29284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029285 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029286 printf(" %d", n_doc);
29287 printf("\n");
29288 }
29289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029290 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029291#endif
29292
Daniel Veillard42595322004-11-08 10:52:06 +000029293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029294}
29295
29296
29297static int
29298test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029300
William M. Brack21e4ef22005-01-02 09:53:13 +000029301#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029302 int mem_base;
29303 int ret_val;
29304 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29305 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029306
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029307 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29308 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029309 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029310
29311 ret_val = xmlTextReaderAttributeCount(reader);
29312 desret_int(ret_val);
29313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029314 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029315 xmlResetLastError();
29316 if (mem_base != xmlMemBlocks()) {
29317 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029319 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029320 printf(" %d", n_reader);
29321 printf("\n");
29322 }
29323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029324 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029325#endif
29326
Daniel Veillard42595322004-11-08 10:52:06 +000029327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029328}
29329
29330
29331static int
29332test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029334
William M. Brack21e4ef22005-01-02 09:53:13 +000029335#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029336 int mem_base;
29337 xmlChar * ret_val;
29338 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29339 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029340
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029341 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029343 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029344
29345 ret_val = xmlTextReaderBaseUri(reader);
29346 desret_xmlChar_ptr(ret_val);
29347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029348 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029349 xmlResetLastError();
29350 if (mem_base != xmlMemBlocks()) {
29351 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029353 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029354 printf(" %d", n_reader);
29355 printf("\n");
29356 }
29357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029358 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029359#endif
29360
Daniel Veillard42595322004-11-08 10:52:06 +000029361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029362}
29363
29364
29365static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000029366test_xmlTextReaderByteConsumed(void) {
29367 int test_ret = 0;
29368
29369#if defined(LIBXML_READER_ENABLED)
29370 int mem_base;
29371 long ret_val;
29372 xmlTextReaderPtr reader; /* an XML reader */
29373 int n_reader;
29374
29375 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29376 mem_base = xmlMemBlocks();
29377 reader = gen_xmlTextReaderPtr(n_reader, 0);
29378
29379 ret_val = xmlTextReaderByteConsumed(reader);
29380 desret_long(ret_val);
29381 call_tests++;
29382 des_xmlTextReaderPtr(n_reader, reader, 0);
29383 xmlResetLastError();
29384 if (mem_base != xmlMemBlocks()) {
29385 printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
29386 xmlMemBlocks() - mem_base);
29387 test_ret++;
29388 printf(" %d", n_reader);
29389 printf("\n");
29390 }
29391 }
29392 function_tests++;
29393#endif
29394
29395 return(test_ret);
29396}
29397
29398
29399static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029400test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029402
William M. Brack21e4ef22005-01-02 09:53:13 +000029403#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029404 int mem_base;
29405 int ret_val;
29406 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29407 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029408
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029409 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29410 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029411 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029412
29413 ret_val = xmlTextReaderClose(reader);
29414 desret_int(ret_val);
29415 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029416 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029417 xmlResetLastError();
29418 if (mem_base != xmlMemBlocks()) {
29419 printf("Leak of %d blocks found in xmlTextReaderClose",
29420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029421 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029422 printf(" %d", n_reader);
29423 printf("\n");
29424 }
29425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029426 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427#endif
29428
Daniel Veillard42595322004-11-08 10:52:06 +000029429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029430}
29431
29432
29433static int
29434test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029436
William M. Brack21e4ef22005-01-02 09:53:13 +000029437#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029438 int mem_base;
29439 const xmlChar * ret_val;
29440 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29441 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029442
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029443 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29444 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029445 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029446
29447 ret_val = xmlTextReaderConstBaseUri(reader);
29448 desret_const_xmlChar_ptr(ret_val);
29449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029450 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029451 xmlResetLastError();
29452 if (mem_base != xmlMemBlocks()) {
29453 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029455 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029456 printf(" %d", n_reader);
29457 printf("\n");
29458 }
29459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029460 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029461#endif
29462
Daniel Veillard42595322004-11-08 10:52:06 +000029463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029464}
29465
29466
29467static int
29468test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029470
William M. Brack21e4ef22005-01-02 09:53:13 +000029471#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029472 int mem_base;
29473 const xmlChar * ret_val;
29474 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29475 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029476
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029477 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29478 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029479 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029480
29481 ret_val = xmlTextReaderConstEncoding(reader);
29482 desret_const_xmlChar_ptr(ret_val);
29483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029484 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029485 xmlResetLastError();
29486 if (mem_base != xmlMemBlocks()) {
29487 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029489 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029490 printf(" %d", n_reader);
29491 printf("\n");
29492 }
29493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029494 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029495#endif
29496
Daniel Veillard42595322004-11-08 10:52:06 +000029497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029498}
29499
29500
29501static int
29502test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029504
William M. Brack21e4ef22005-01-02 09:53:13 +000029505#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029506 int mem_base;
29507 const xmlChar * ret_val;
29508 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29509 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029510
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029511 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29512 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029513 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029514
29515 ret_val = xmlTextReaderConstLocalName(reader);
29516 desret_const_xmlChar_ptr(ret_val);
29517 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029518 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029519 xmlResetLastError();
29520 if (mem_base != xmlMemBlocks()) {
29521 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029523 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029524 printf(" %d", n_reader);
29525 printf("\n");
29526 }
29527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029528 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029529#endif
29530
Daniel Veillard42595322004-11-08 10:52:06 +000029531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029532}
29533
29534
29535static int
29536test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029538
William M. Brack21e4ef22005-01-02 09:53:13 +000029539#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029540 int mem_base;
29541 const xmlChar * ret_val;
29542 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29543 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029544
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029545 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029547 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029548
29549 ret_val = xmlTextReaderConstName(reader);
29550 desret_const_xmlChar_ptr(ret_val);
29551 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029552 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029553 xmlResetLastError();
29554 if (mem_base != xmlMemBlocks()) {
29555 printf("Leak of %d blocks found in xmlTextReaderConstName",
29556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029557 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029558 printf(" %d", n_reader);
29559 printf("\n");
29560 }
29561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029562 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029563#endif
29564
Daniel Veillard42595322004-11-08 10:52:06 +000029565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029566}
29567
29568
29569static int
29570test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029572
William M. Brack21e4ef22005-01-02 09:53:13 +000029573#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029574 int mem_base;
29575 const xmlChar * ret_val;
29576 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29577 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029578
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029579 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29580 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029581 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029582
29583 ret_val = xmlTextReaderConstNamespaceUri(reader);
29584 desret_const_xmlChar_ptr(ret_val);
29585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029586 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029587 xmlResetLastError();
29588 if (mem_base != xmlMemBlocks()) {
29589 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029591 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029592 printf(" %d", n_reader);
29593 printf("\n");
29594 }
29595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029596 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029597#endif
29598
Daniel Veillard42595322004-11-08 10:52:06 +000029599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029600}
29601
29602
29603static int
29604test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029606
William M. Brack21e4ef22005-01-02 09:53:13 +000029607#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029608 int mem_base;
29609 const xmlChar * ret_val;
29610 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29611 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029612
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029613 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029615 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029616
29617 ret_val = xmlTextReaderConstPrefix(reader);
29618 desret_const_xmlChar_ptr(ret_val);
29619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029620 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029621 xmlResetLastError();
29622 if (mem_base != xmlMemBlocks()) {
29623 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029625 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029626 printf(" %d", n_reader);
29627 printf("\n");
29628 }
29629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029630 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029631#endif
29632
Daniel Veillard42595322004-11-08 10:52:06 +000029633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029634}
29635
29636
29637static int
29638test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029640
William M. Brack21e4ef22005-01-02 09:53:13 +000029641#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029642 int mem_base;
29643 const xmlChar * ret_val;
29644 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29645 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029646 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029647 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029648
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029649 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29650 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29651 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029652 reader = gen_xmlTextReaderPtr(n_reader, 0);
29653 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029654
William M. Brackf13f77f2004-11-12 16:03:48 +000029655 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029656 desret_const_xmlChar_ptr(ret_val);
29657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029658 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029659 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029660 xmlResetLastError();
29661 if (mem_base != xmlMemBlocks()) {
29662 printf("Leak of %d blocks found in xmlTextReaderConstString",
29663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029664 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029665 printf(" %d", n_reader);
29666 printf(" %d", n_str);
29667 printf("\n");
29668 }
29669 }
29670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029671 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029672#endif
29673
Daniel Veillard42595322004-11-08 10:52:06 +000029674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029675}
29676
29677
29678static int
29679test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029681
William M. Brack21e4ef22005-01-02 09:53:13 +000029682#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029683 int mem_base;
29684 const xmlChar * ret_val;
29685 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29686 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029687
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029688 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029690 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029691
29692 ret_val = xmlTextReaderConstValue(reader);
29693 desret_const_xmlChar_ptr(ret_val);
29694 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029695 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029696 xmlResetLastError();
29697 if (mem_base != xmlMemBlocks()) {
29698 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029700 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029701 printf(" %d", n_reader);
29702 printf("\n");
29703 }
29704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029705 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029706#endif
29707
Daniel Veillard42595322004-11-08 10:52:06 +000029708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029709}
29710
29711
29712static int
29713test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715
William M. Brack21e4ef22005-01-02 09:53:13 +000029716#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029717 int mem_base;
29718 const xmlChar * ret_val;
29719 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29720 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029721
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029722 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029724 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029725
29726 ret_val = xmlTextReaderConstXmlLang(reader);
29727 desret_const_xmlChar_ptr(ret_val);
29728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029729 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029730 xmlResetLastError();
29731 if (mem_base != xmlMemBlocks()) {
29732 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029734 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029735 printf(" %d", n_reader);
29736 printf("\n");
29737 }
29738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029739 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029740#endif
29741
Daniel Veillard42595322004-11-08 10:52:06 +000029742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029743}
29744
29745
29746static int
29747test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029749
William M. Brack21e4ef22005-01-02 09:53:13 +000029750#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029751 int mem_base;
29752 const xmlChar * ret_val;
29753 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29754 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029755
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029756 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029758 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029759
29760 ret_val = xmlTextReaderConstXmlVersion(reader);
29761 desret_const_xmlChar_ptr(ret_val);
29762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029763 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029764 xmlResetLastError();
29765 if (mem_base != xmlMemBlocks()) {
29766 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029768 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029769 printf(" %d", n_reader);
29770 printf("\n");
29771 }
29772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029773 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029774#endif
29775
Daniel Veillard42595322004-11-08 10:52:06 +000029776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029777}
29778
29779
29780static int
29781test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783
William M. Brack21e4ef22005-01-02 09:53:13 +000029784#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029785 int mem_base;
29786 xmlDocPtr ret_val;
29787 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29788 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029792 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029793
29794 ret_val = xmlTextReaderCurrentDoc(reader);
29795 desret_xmlDocPtr(ret_val);
29796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029797 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 xmlResetLastError();
29799 if (mem_base != xmlMemBlocks()) {
29800 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029802 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803 printf(" %d", n_reader);
29804 printf("\n");
29805 }
29806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029807 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029808#endif
29809
Daniel Veillard42595322004-11-08 10:52:06 +000029810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029811}
29812
29813
29814static int
29815test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029817
William M. Brack21e4ef22005-01-02 09:53:13 +000029818#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 int mem_base;
29820 xmlNodePtr ret_val;
29821 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29822 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029823
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029826 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029827
29828 ret_val = xmlTextReaderCurrentNode(reader);
29829 desret_xmlNodePtr(ret_val);
29830 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029831 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832 xmlResetLastError();
29833 if (mem_base != xmlMemBlocks()) {
29834 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029836 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837 printf(" %d", n_reader);
29838 printf("\n");
29839 }
29840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029841 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029842#endif
29843
Daniel Veillard42595322004-11-08 10:52:06 +000029844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029845}
29846
29847
29848static int
29849test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029851
William M. Brack21e4ef22005-01-02 09:53:13 +000029852#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029853 int mem_base;
29854 int ret_val;
29855 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29856 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029857
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029860 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029861
29862 ret_val = xmlTextReaderDepth(reader);
29863 desret_int(ret_val);
29864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029865 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029866 xmlResetLastError();
29867 if (mem_base != xmlMemBlocks()) {
29868 printf("Leak of %d blocks found in xmlTextReaderDepth",
29869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029870 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029871 printf(" %d", n_reader);
29872 printf("\n");
29873 }
29874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029875 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029876#endif
29877
Daniel Veillard42595322004-11-08 10:52:06 +000029878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029879}
29880
29881
29882static int
29883test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029885
William M. Brack21e4ef22005-01-02 09:53:13 +000029886#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029887 int mem_base;
29888 xmlNodePtr ret_val;
29889 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29890 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029891
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029894 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029895
29896 ret_val = xmlTextReaderExpand(reader);
29897 desret_xmlNodePtr(ret_val);
29898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029899 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900 xmlResetLastError();
29901 if (mem_base != xmlMemBlocks()) {
29902 printf("Leak of %d blocks found in xmlTextReaderExpand",
29903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029904 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029905 printf(" %d", n_reader);
29906 printf("\n");
29907 }
29908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029909 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029910#endif
29911
Daniel Veillard42595322004-11-08 10:52:06 +000029912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029913}
29914
29915
29916static int
29917test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029919
William M. Brack21e4ef22005-01-02 09:53:13 +000029920#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921 int mem_base;
29922 xmlChar * ret_val;
29923 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29924 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029925 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029927
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029928 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29929 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029931 reader = gen_xmlTextReaderPtr(n_reader, 0);
29932 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029933
William M. Brackf13f77f2004-11-12 16:03:48 +000029934 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029935 desret_xmlChar_ptr(ret_val);
29936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029937 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029938 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939 xmlResetLastError();
29940 if (mem_base != xmlMemBlocks()) {
29941 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029943 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029944 printf(" %d", n_reader);
29945 printf(" %d", n_name);
29946 printf("\n");
29947 }
29948 }
29949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029950 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029951#endif
29952
Daniel Veillard42595322004-11-08 10:52:06 +000029953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029954}
29955
29956
29957static int
29958test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029960
William M. Brack21e4ef22005-01-02 09:53:13 +000029961#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029962 int mem_base;
29963 xmlChar * ret_val;
29964 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29965 int n_reader;
29966 int no; /* the zero-based index of the attribute relative to the containing element */
29967 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029968
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029969 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29970 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029972 reader = gen_xmlTextReaderPtr(n_reader, 0);
29973 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029974
29975 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29976 desret_xmlChar_ptr(ret_val);
29977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029978 des_xmlTextReaderPtr(n_reader, reader, 0);
29979 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029980 xmlResetLastError();
29981 if (mem_base != xmlMemBlocks()) {
29982 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029984 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029985 printf(" %d", n_reader);
29986 printf(" %d", n_no);
29987 printf("\n");
29988 }
29989 }
29990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029991 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029992#endif
29993
Daniel Veillard42595322004-11-08 10:52:06 +000029994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029995}
29996
29997
29998static int
29999test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030001
William M. Brack21e4ef22005-01-02 09:53:13 +000030002#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030003 int mem_base;
30004 xmlChar * ret_val;
30005 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30006 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030007 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030008 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030009 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030010 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030011
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030012 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30013 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30014 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030016 reader = gen_xmlTextReaderPtr(n_reader, 0);
30017 localName = gen_const_xmlChar_ptr(n_localName, 1);
30018 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030019
William M. Brackf13f77f2004-11-12 16:03:48 +000030020 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030021 desret_xmlChar_ptr(ret_val);
30022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030023 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030024 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30025 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030026 xmlResetLastError();
30027 if (mem_base != xmlMemBlocks()) {
30028 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
30029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030030 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030031 printf(" %d", n_reader);
30032 printf(" %d", n_localName);
30033 printf(" %d", n_namespaceURI);
30034 printf("\n");
30035 }
30036 }
30037 }
30038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030039 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030040#endif
30041
Daniel Veillard42595322004-11-08 10:52:06 +000030042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030043}
30044
Daniel Veillarda521d282004-11-09 14:59:59 +000030045#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030046
Daniel Veillardce682bc2004-11-05 17:22:25 +000030047#define gen_nb_xmlTextReaderErrorFunc_ptr 1
30048static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30049 return(NULL);
30050}
30051static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30052}
Daniel Veillarda521d282004-11-09 14:59:59 +000030053#endif
30054
Daniel Veillardce682bc2004-11-05 17:22:25 +000030055
Daniel Veillardd93f6252004-11-02 15:53:51 +000030056static int
30057test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030059
William M. Brack21e4ef22005-01-02 09:53:13 +000030060#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030061 int mem_base;
30062 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30063 int n_reader;
30064 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
30065 int n_f;
30066 void ** arg; /* a user argument */
30067 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030068
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030069 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30070 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
30071 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
30072 mem_base = xmlMemBlocks();
30073 reader = gen_xmlTextReaderPtr(n_reader, 0);
30074 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
30075 arg = gen_void_ptr_ptr(n_arg, 2);
30076
30077 xmlTextReaderGetErrorHandler(reader, f, arg);
30078 call_tests++;
30079 des_xmlTextReaderPtr(n_reader, reader, 0);
30080 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
30081 des_void_ptr_ptr(n_arg, arg, 2);
30082 xmlResetLastError();
30083 if (mem_base != xmlMemBlocks()) {
30084 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
30085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030086 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030087 printf(" %d", n_reader);
30088 printf(" %d", n_f);
30089 printf(" %d", n_arg);
30090 printf("\n");
30091 }
30092 }
30093 }
30094 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030095 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030096#endif
30097
Daniel Veillard42595322004-11-08 10:52:06 +000030098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030099}
30100
30101
30102static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000030103test_xmlTextReaderGetParserColumnNumber(void) {
30104 int test_ret = 0;
30105
30106#if defined(LIBXML_READER_ENABLED)
30107 int mem_base;
30108 int ret_val;
30109 xmlTextReaderPtr reader; /* the user data (XML reader context) */
30110 int n_reader;
30111
30112 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30113 mem_base = xmlMemBlocks();
30114 reader = gen_xmlTextReaderPtr(n_reader, 0);
30115
30116 ret_val = xmlTextReaderGetParserColumnNumber(reader);
30117 desret_int(ret_val);
30118 call_tests++;
30119 des_xmlTextReaderPtr(n_reader, reader, 0);
30120 xmlResetLastError();
30121 if (mem_base != xmlMemBlocks()) {
30122 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
30123 xmlMemBlocks() - mem_base);
30124 test_ret++;
30125 printf(" %d", n_reader);
30126 printf("\n");
30127 }
30128 }
30129 function_tests++;
30130#endif
30131
30132 return(test_ret);
30133}
30134
30135
30136static int
30137test_xmlTextReaderGetParserLineNumber(void) {
30138 int test_ret = 0;
30139
30140#if defined(LIBXML_READER_ENABLED)
30141 int mem_base;
30142 int ret_val;
30143 xmlTextReaderPtr reader; /* the user data (XML reader context) */
30144 int n_reader;
30145
30146 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30147 mem_base = xmlMemBlocks();
30148 reader = gen_xmlTextReaderPtr(n_reader, 0);
30149
30150 ret_val = xmlTextReaderGetParserLineNumber(reader);
30151 desret_int(ret_val);
30152 call_tests++;
30153 des_xmlTextReaderPtr(n_reader, reader, 0);
30154 xmlResetLastError();
30155 if (mem_base != xmlMemBlocks()) {
30156 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
30157 xmlMemBlocks() - mem_base);
30158 test_ret++;
30159 printf(" %d", n_reader);
30160 printf("\n");
30161 }
30162 }
30163 function_tests++;
30164#endif
30165
30166 return(test_ret);
30167}
30168
30169
30170static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000030171test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030173
William M. Brack21e4ef22005-01-02 09:53:13 +000030174#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030175 int mem_base;
30176 int ret_val;
30177 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30178 int n_reader;
30179 int prop; /* the xmlParserProperties to get */
30180 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030181
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30183 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030185 reader = gen_xmlTextReaderPtr(n_reader, 0);
30186 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030187
30188 ret_val = xmlTextReaderGetParserProp(reader, prop);
30189 desret_int(ret_val);
30190 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030191 des_xmlTextReaderPtr(n_reader, reader, 0);
30192 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030193 xmlResetLastError();
30194 if (mem_base != xmlMemBlocks()) {
30195 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
30196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030197 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030198 printf(" %d", n_reader);
30199 printf(" %d", n_prop);
30200 printf("\n");
30201 }
30202 }
30203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030204 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030205#endif
30206
Daniel Veillard42595322004-11-08 10:52:06 +000030207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030208}
30209
30210
30211static int
30212test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030214
William M. Brack21e4ef22005-01-02 09:53:13 +000030215#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030216 int mem_base;
30217 xmlParserInputBufferPtr ret_val;
30218 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30219 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030220
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030221 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30222 mem_base = xmlMemBlocks();
30223 reader = gen_xmlTextReaderPtr(n_reader, 0);
30224
30225 ret_val = xmlTextReaderGetRemainder(reader);
30226 desret_xmlParserInputBufferPtr(ret_val);
30227 call_tests++;
30228 des_xmlTextReaderPtr(n_reader, reader, 0);
30229 xmlResetLastError();
30230 if (mem_base != xmlMemBlocks()) {
30231 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
30232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030233 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030234 printf(" %d", n_reader);
30235 printf("\n");
30236 }
30237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030238 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030239#endif
30240
Daniel Veillard42595322004-11-08 10:52:06 +000030241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030242}
30243
30244
30245static int
30246test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030248
William M. Brack21e4ef22005-01-02 09:53:13 +000030249#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250 int mem_base;
30251 int ret_val;
30252 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30253 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030254
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030255 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030257 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030258
30259 ret_val = xmlTextReaderHasAttributes(reader);
30260 desret_int(ret_val);
30261 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030262 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030263 xmlResetLastError();
30264 if (mem_base != xmlMemBlocks()) {
30265 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
30266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030267 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030268 printf(" %d", n_reader);
30269 printf("\n");
30270 }
30271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030272 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030273#endif
30274
Daniel Veillard42595322004-11-08 10:52:06 +000030275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030276}
30277
30278
30279static int
30280test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030282
William M. Brack21e4ef22005-01-02 09:53:13 +000030283#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030284 int mem_base;
30285 int ret_val;
30286 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30287 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030288
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030289 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30290 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030291 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030292
30293 ret_val = xmlTextReaderHasValue(reader);
30294 desret_int(ret_val);
30295 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030296 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030297 xmlResetLastError();
30298 if (mem_base != xmlMemBlocks()) {
30299 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030301 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030302 printf(" %d", n_reader);
30303 printf("\n");
30304 }
30305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030306 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030307#endif
30308
Daniel Veillard42595322004-11-08 10:52:06 +000030309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030310}
30311
30312
30313static int
30314test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030316
William M. Brack21e4ef22005-01-02 09:53:13 +000030317#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030318 int mem_base;
30319 int ret_val;
30320 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30321 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030322
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030323 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030325 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030326
30327 ret_val = xmlTextReaderIsDefault(reader);
30328 desret_int(ret_val);
30329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030330 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030331 xmlResetLastError();
30332 if (mem_base != xmlMemBlocks()) {
30333 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030335 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030336 printf(" %d", n_reader);
30337 printf("\n");
30338 }
30339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030340 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030341#endif
30342
Daniel Veillard42595322004-11-08 10:52:06 +000030343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030344}
30345
30346
30347static int
30348test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030350
William M. Brack21e4ef22005-01-02 09:53:13 +000030351#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030352 int mem_base;
30353 int ret_val;
30354 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30355 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030356
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030357 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030359 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030360
30361 ret_val = xmlTextReaderIsEmptyElement(reader);
30362 desret_int(ret_val);
30363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030364 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030365 xmlResetLastError();
30366 if (mem_base != xmlMemBlocks()) {
30367 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030369 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030370 printf(" %d", n_reader);
30371 printf("\n");
30372 }
30373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030374 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030375#endif
30376
Daniel Veillard42595322004-11-08 10:52:06 +000030377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030378}
30379
30380
30381static int
30382test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030384
William M. Brack21e4ef22005-01-02 09:53:13 +000030385#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030386 int mem_base;
30387 int ret_val;
30388 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30389 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030390
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030391 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030393 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030394
30395 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30396 desret_int(ret_val);
30397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030398 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030399 xmlResetLastError();
30400 if (mem_base != xmlMemBlocks()) {
30401 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030403 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030404 printf(" %d", n_reader);
30405 printf("\n");
30406 }
30407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030408 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030409#endif
30410
Daniel Veillard42595322004-11-08 10:52:06 +000030411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030412}
30413
30414
30415static int
30416test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030418
William M. Brack21e4ef22005-01-02 09:53:13 +000030419#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030420 int mem_base;
30421 int ret_val;
30422 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30423 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030424
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030425 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030427 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030428
30429 ret_val = xmlTextReaderIsValid(reader);
30430 desret_int(ret_val);
30431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030432 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030433 xmlResetLastError();
30434 if (mem_base != xmlMemBlocks()) {
30435 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030437 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030438 printf(" %d", n_reader);
30439 printf("\n");
30440 }
30441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030442 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030443#endif
30444
Daniel Veillard42595322004-11-08 10:52:06 +000030445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030446}
30447
30448
30449static int
30450test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030452
William M. Brack21e4ef22005-01-02 09:53:13 +000030453#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030454 int mem_base;
30455 xmlChar * ret_val;
30456 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30457 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030458
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030459 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30460 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030461 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030462
30463 ret_val = xmlTextReaderLocalName(reader);
30464 desret_xmlChar_ptr(ret_val);
30465 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030466 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030467 xmlResetLastError();
30468 if (mem_base != xmlMemBlocks()) {
30469 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030471 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030472 printf(" %d", n_reader);
30473 printf("\n");
30474 }
30475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030476 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030477#endif
30478
Daniel Veillard42595322004-11-08 10:52:06 +000030479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030480}
30481
Daniel Veillarda521d282004-11-09 14:59:59 +000030482#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030483
Daniel Veillardce682bc2004-11-05 17:22:25 +000030484#define gen_nb_xmlTextReaderLocatorPtr 1
30485static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30486 return(NULL);
30487}
30488static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30489}
Daniel Veillarda521d282004-11-09 14:59:59 +000030490#endif
30491
Daniel Veillardce682bc2004-11-05 17:22:25 +000030492
Daniel Veillardd93f6252004-11-02 15:53:51 +000030493static int
30494test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030496
William M. Brack21e4ef22005-01-02 09:53:13 +000030497#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030498 int mem_base;
30499 xmlChar * ret_val;
30500 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30501 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030502
Daniel Veillardce682bc2004-11-05 17:22:25 +000030503 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30504 mem_base = xmlMemBlocks();
30505 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30506
30507 ret_val = xmlTextReaderLocatorBaseURI(locator);
30508 desret_xmlChar_ptr(ret_val);
30509 call_tests++;
30510 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30511 xmlResetLastError();
30512 if (mem_base != xmlMemBlocks()) {
30513 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030516 printf(" %d", n_locator);
30517 printf("\n");
30518 }
30519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030520 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030521#endif
30522
Daniel Veillard42595322004-11-08 10:52:06 +000030523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030524}
30525
30526
30527static int
30528test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030530
William M. Brack21e4ef22005-01-02 09:53:13 +000030531#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030532 int mem_base;
30533 int ret_val;
30534 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30535 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030536
Daniel Veillardce682bc2004-11-05 17:22:25 +000030537 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30538 mem_base = xmlMemBlocks();
30539 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30540
30541 ret_val = xmlTextReaderLocatorLineNumber(locator);
30542 desret_int(ret_val);
30543 call_tests++;
30544 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30545 xmlResetLastError();
30546 if (mem_base != xmlMemBlocks()) {
30547 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030549 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030550 printf(" %d", n_locator);
30551 printf("\n");
30552 }
30553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030554 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030555#endif
30556
Daniel Veillard42595322004-11-08 10:52:06 +000030557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030558}
30559
30560
30561static int
30562test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030564
William M. Brack21e4ef22005-01-02 09:53:13 +000030565#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030566 int mem_base;
30567 xmlChar * ret_val;
30568 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30569 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030570 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 +000030571 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030572
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030573 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30574 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030576 reader = gen_xmlTextReaderPtr(n_reader, 0);
30577 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030578
William M. Brackf13f77f2004-11-12 16:03:48 +000030579 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030580 desret_xmlChar_ptr(ret_val);
30581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030582 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030583 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030584 xmlResetLastError();
30585 if (mem_base != xmlMemBlocks()) {
30586 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030588 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030589 printf(" %d", n_reader);
30590 printf(" %d", n_prefix);
30591 printf("\n");
30592 }
30593 }
30594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030595 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030596#endif
30597
Daniel Veillard42595322004-11-08 10:52:06 +000030598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030599}
30600
30601
30602static int
30603test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030605
William M. Brack21e4ef22005-01-02 09:53:13 +000030606#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030607 int mem_base;
30608 int ret_val;
30609 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30610 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030611 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030612 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030613
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030614 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30615 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030617 reader = gen_xmlTextReaderPtr(n_reader, 0);
30618 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030619
William M. Brackf13f77f2004-11-12 16:03:48 +000030620 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030621 desret_int(ret_val);
30622 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030623 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030624 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030625 xmlResetLastError();
30626 if (mem_base != xmlMemBlocks()) {
30627 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030629 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030630 printf(" %d", n_reader);
30631 printf(" %d", n_name);
30632 printf("\n");
30633 }
30634 }
30635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030636 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030637#endif
30638
Daniel Veillard42595322004-11-08 10:52:06 +000030639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030640}
30641
30642
30643static int
30644test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030646
William M. Brack21e4ef22005-01-02 09:53:13 +000030647#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030648 int mem_base;
30649 int ret_val;
30650 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30651 int n_reader;
30652 int no; /* the zero-based index of the attribute relative to the containing element. */
30653 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030654
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030655 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30656 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030658 reader = gen_xmlTextReaderPtr(n_reader, 0);
30659 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030660
30661 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30662 desret_int(ret_val);
30663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030664 des_xmlTextReaderPtr(n_reader, reader, 0);
30665 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030666 xmlResetLastError();
30667 if (mem_base != xmlMemBlocks()) {
30668 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030670 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030671 printf(" %d", n_reader);
30672 printf(" %d", n_no);
30673 printf("\n");
30674 }
30675 }
30676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030677 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030678#endif
30679
Daniel Veillard42595322004-11-08 10:52:06 +000030680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030681}
30682
30683
30684static int
30685test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030687
William M. Brack21e4ef22005-01-02 09:53:13 +000030688#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030689 int mem_base;
30690 int ret_val;
30691 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30692 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030693 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030694 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030695 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030696 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030697
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030698 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30699 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30700 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030702 reader = gen_xmlTextReaderPtr(n_reader, 0);
30703 localName = gen_const_xmlChar_ptr(n_localName, 1);
30704 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030705
William M. Brackf13f77f2004-11-12 16:03:48 +000030706 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030707 desret_int(ret_val);
30708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030709 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030710 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30711 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030712 xmlResetLastError();
30713 if (mem_base != xmlMemBlocks()) {
30714 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030716 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030717 printf(" %d", n_reader);
30718 printf(" %d", n_localName);
30719 printf(" %d", n_namespaceURI);
30720 printf("\n");
30721 }
30722 }
30723 }
30724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030725 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030726#endif
30727
Daniel Veillard42595322004-11-08 10:52:06 +000030728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030729}
30730
30731
30732static int
30733test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030735
William M. Brack21e4ef22005-01-02 09:53:13 +000030736#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737 int mem_base;
30738 int ret_val;
30739 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30740 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030741
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030742 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30743 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030744 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745
30746 ret_val = xmlTextReaderMoveToElement(reader);
30747 desret_int(ret_val);
30748 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030749 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030750 xmlResetLastError();
30751 if (mem_base != xmlMemBlocks()) {
30752 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030754 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030755 printf(" %d", n_reader);
30756 printf("\n");
30757 }
30758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030759 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030760#endif
30761
Daniel Veillard42595322004-11-08 10:52:06 +000030762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030763}
30764
30765
30766static int
30767test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030769
William M. Brack21e4ef22005-01-02 09:53:13 +000030770#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030771 int mem_base;
30772 int ret_val;
30773 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30774 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030775
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030776 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30777 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030778 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779
30780 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30781 desret_int(ret_val);
30782 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030783 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030784 xmlResetLastError();
30785 if (mem_base != xmlMemBlocks()) {
30786 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030788 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030789 printf(" %d", n_reader);
30790 printf("\n");
30791 }
30792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030793 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030794#endif
30795
Daniel Veillard42595322004-11-08 10:52:06 +000030796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030797}
30798
30799
30800static int
30801test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030803
William M. Brack21e4ef22005-01-02 09:53:13 +000030804#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030805 int mem_base;
30806 int ret_val;
30807 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30808 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030809
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030810 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30811 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030812 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030813
30814 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30815 desret_int(ret_val);
30816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030817 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030818 xmlResetLastError();
30819 if (mem_base != xmlMemBlocks()) {
30820 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030822 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030823 printf(" %d", n_reader);
30824 printf("\n");
30825 }
30826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030827 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030828#endif
30829
Daniel Veillard42595322004-11-08 10:52:06 +000030830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030831}
30832
30833
30834static int
30835test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030837
William M. Brack21e4ef22005-01-02 09:53:13 +000030838#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030839 int mem_base;
30840 xmlChar * ret_val;
30841 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30842 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030843
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030844 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30845 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030846 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030847
30848 ret_val = xmlTextReaderName(reader);
30849 desret_xmlChar_ptr(ret_val);
30850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030851 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030852 xmlResetLastError();
30853 if (mem_base != xmlMemBlocks()) {
30854 printf("Leak of %d blocks found in xmlTextReaderName",
30855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030856 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030857 printf(" %d", n_reader);
30858 printf("\n");
30859 }
30860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030861 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030862#endif
30863
Daniel Veillard42595322004-11-08 10:52:06 +000030864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030865}
30866
30867
30868static int
30869test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030871
William M. Brack21e4ef22005-01-02 09:53:13 +000030872#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030873 int mem_base;
30874 xmlChar * ret_val;
30875 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30876 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030877
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030878 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030880 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030881
30882 ret_val = xmlTextReaderNamespaceUri(reader);
30883 desret_xmlChar_ptr(ret_val);
30884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030885 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030886 xmlResetLastError();
30887 if (mem_base != xmlMemBlocks()) {
30888 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030890 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030891 printf(" %d", n_reader);
30892 printf("\n");
30893 }
30894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030895 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030896#endif
30897
Daniel Veillard42595322004-11-08 10:52:06 +000030898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030899}
30900
30901
30902static int
30903test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030905
William M. Brack21e4ef22005-01-02 09:53:13 +000030906#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030907 int mem_base;
30908 int ret_val;
30909 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30910 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030911
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030912 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030914 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030915
30916 ret_val = xmlTextReaderNext(reader);
30917 desret_int(ret_val);
30918 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030919 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030920 xmlResetLastError();
30921 if (mem_base != xmlMemBlocks()) {
30922 printf("Leak of %d blocks found in xmlTextReaderNext",
30923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030924 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030925 printf(" %d", n_reader);
30926 printf("\n");
30927 }
30928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030929 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030930#endif
30931
Daniel Veillard42595322004-11-08 10:52:06 +000030932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030933}
30934
30935
30936static int
30937test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030939
William M. Brack21e4ef22005-01-02 09:53:13 +000030940#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030941 int mem_base;
30942 int ret_val;
30943 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30944 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030945
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030946 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30947 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030948 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030949
30950 ret_val = xmlTextReaderNextSibling(reader);
30951 desret_int(ret_val);
30952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030953 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030954 xmlResetLastError();
30955 if (mem_base != xmlMemBlocks()) {
30956 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030958 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030959 printf(" %d", n_reader);
30960 printf("\n");
30961 }
30962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030963 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030964#endif
30965
Daniel Veillard42595322004-11-08 10:52:06 +000030966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030967}
30968
30969
30970static int
30971test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030973
William M. Brack21e4ef22005-01-02 09:53:13 +000030974#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030975 int mem_base;
30976 int ret_val;
30977 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30978 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030979
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030980 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030982 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983
30984 ret_val = xmlTextReaderNodeType(reader);
30985 desret_int(ret_val);
30986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030987 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030988 xmlResetLastError();
30989 if (mem_base != xmlMemBlocks()) {
30990 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030992 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030993 printf(" %d", n_reader);
30994 printf("\n");
30995 }
30996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030997 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030998#endif
30999
Daniel Veillard42595322004-11-08 10:52:06 +000031000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031001}
31002
31003
31004static int
31005test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031007
William M. Brack21e4ef22005-01-02 09:53:13 +000031008#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031009 int mem_base;
31010 int ret_val;
31011 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31012 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031013
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031014 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031016 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031017
31018 ret_val = xmlTextReaderNormalization(reader);
31019 desret_int(ret_val);
31020 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031021 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031022 xmlResetLastError();
31023 if (mem_base != xmlMemBlocks()) {
31024 printf("Leak of %d blocks found in xmlTextReaderNormalization",
31025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031026 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031027 printf(" %d", n_reader);
31028 printf("\n");
31029 }
31030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031031 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031032#endif
31033
Daniel Veillard42595322004-11-08 10:52:06 +000031034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031035}
31036
31037
31038static int
31039test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031041
William M. Brack21e4ef22005-01-02 09:53:13 +000031042#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031043 int mem_base;
31044 xmlChar * ret_val;
31045 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31046 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031047
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031048 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031050 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031051
31052 ret_val = xmlTextReaderPrefix(reader);
31053 desret_xmlChar_ptr(ret_val);
31054 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031055 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031056 xmlResetLastError();
31057 if (mem_base != xmlMemBlocks()) {
31058 printf("Leak of %d blocks found in xmlTextReaderPrefix",
31059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031060 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031061 printf(" %d", n_reader);
31062 printf("\n");
31063 }
31064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031065 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031066#endif
31067
Daniel Veillard42595322004-11-08 10:52:06 +000031068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031069}
31070
31071
31072static int
31073test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031075
William M. Brack21e4ef22005-01-02 09:53:13 +000031076#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031077 int mem_base;
31078 xmlNodePtr ret_val;
31079 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31080 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031081
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031082 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031084 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031085
31086 ret_val = xmlTextReaderPreserve(reader);
31087 desret_xmlNodePtr(ret_val);
31088 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031089 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031090 xmlResetLastError();
31091 if (mem_base != xmlMemBlocks()) {
31092 printf("Leak of %d blocks found in xmlTextReaderPreserve",
31093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031094 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031095 printf(" %d", n_reader);
31096 printf("\n");
31097 }
31098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031099 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031100#endif
31101
Daniel Veillard42595322004-11-08 10:52:06 +000031102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031103}
31104
31105
31106static int
31107test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031109
William M. Brack21e4ef22005-01-02 09:53:13 +000031110#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031111#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031112 int mem_base;
31113 int ret_val;
31114 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31115 int n_reader;
31116 xmlChar * pattern; /* an XPath subset pattern */
31117 int n_pattern;
31118 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
31119 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031120
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031121 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31122 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
31123 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
31124 mem_base = xmlMemBlocks();
31125 reader = gen_xmlTextReaderPtr(n_reader, 0);
31126 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
31127 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
31128
William M. Brackf13f77f2004-11-12 16:03:48 +000031129 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031130 desret_int(ret_val);
31131 call_tests++;
31132 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031133 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
31134 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031135 xmlResetLastError();
31136 if (mem_base != xmlMemBlocks()) {
31137 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
31138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031139 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031140 printf(" %d", n_reader);
31141 printf(" %d", n_pattern);
31142 printf(" %d", n_namespaces);
31143 printf("\n");
31144 }
31145 }
31146 }
31147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031148 function_tests++;
31149#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031150#endif
31151
Daniel Veillard42595322004-11-08 10:52:06 +000031152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031153}
31154
31155
31156static int
31157test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031159
William M. Brack21e4ef22005-01-02 09:53:13 +000031160#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031161 int mem_base;
31162 int ret_val;
31163 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31164 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031165
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031166 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031168 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031169
31170 ret_val = xmlTextReaderQuoteChar(reader);
31171 desret_int(ret_val);
31172 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031173 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031174 xmlResetLastError();
31175 if (mem_base != xmlMemBlocks()) {
31176 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
31177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031178 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031179 printf(" %d", n_reader);
31180 printf("\n");
31181 }
31182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031183 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031184#endif
31185
Daniel Veillard42595322004-11-08 10:52:06 +000031186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031187}
31188
31189
31190static int
31191test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031193
William M. Brack21e4ef22005-01-02 09:53:13 +000031194#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031195 int mem_base;
31196 int ret_val;
31197 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31198 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031199
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031200 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031202 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031203
31204 ret_val = xmlTextReaderRead(reader);
31205 desret_int(ret_val);
31206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031207 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031208 xmlResetLastError();
31209 if (mem_base != xmlMemBlocks()) {
31210 printf("Leak of %d blocks found in xmlTextReaderRead",
31211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031212 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031213 printf(" %d", n_reader);
31214 printf("\n");
31215 }
31216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031217 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031218#endif
31219
Daniel Veillard42595322004-11-08 10:52:06 +000031220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031221}
31222
31223
31224static int
31225test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031227
William M. Brack21e4ef22005-01-02 09:53:13 +000031228#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031229 int mem_base;
31230 int ret_val;
31231 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31232 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031233
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031234 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031236 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031237
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031238 ret_val = xmlTextReaderReadAttributeValue(reader);
31239 desret_int(ret_val);
31240 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031241 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031242 xmlResetLastError();
31243 if (mem_base != xmlMemBlocks()) {
31244 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
31245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031246 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031247 printf(" %d", n_reader);
31248 printf("\n");
31249 }
31250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031251 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031252#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031253
Daniel Veillard42595322004-11-08 10:52:06 +000031254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031255}
31256
31257
31258static int
31259test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031261
William M. Brack21e4ef22005-01-02 09:53:13 +000031262#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031263 int mem_base;
31264 int ret_val;
31265 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31266 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031267
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031268 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031270 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031271
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031272 ret_val = xmlTextReaderReadState(reader);
31273 desret_int(ret_val);
31274 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031275 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031276 xmlResetLastError();
31277 if (mem_base != xmlMemBlocks()) {
31278 printf("Leak of %d blocks found in xmlTextReaderReadState",
31279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031280 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031281 printf(" %d", n_reader);
31282 printf("\n");
31283 }
31284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031285 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031286#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031287
Daniel Veillard42595322004-11-08 10:52:06 +000031288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031289}
31290
31291
31292static int
31293test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031295
William M. Brack21e4ef22005-01-02 09:53:13 +000031296#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031297 int mem_base;
31298 int ret_val;
31299 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31300 int n_reader;
31301 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31302 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031303
Daniel Veillardce682bc2004-11-05 17:22:25 +000031304 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31305 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31306 mem_base = xmlMemBlocks();
31307 reader = gen_xmlTextReaderPtr(n_reader, 0);
31308 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31309
31310 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31311 desret_int(ret_val);
31312 call_tests++;
31313 des_xmlTextReaderPtr(n_reader, reader, 0);
31314 des_xmlRelaxNGPtr(n_schema, schema, 1);
31315 xmlResetLastError();
31316 if (mem_base != xmlMemBlocks()) {
31317 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031319 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031320 printf(" %d", n_reader);
31321 printf(" %d", n_schema);
31322 printf("\n");
31323 }
31324 }
31325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031326 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031327#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031328
Daniel Veillard42595322004-11-08 10:52:06 +000031329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031330}
31331
31332
31333static int
31334test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031336
William M. Brack21e4ef22005-01-02 09:53:13 +000031337#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031338 int mem_base;
31339 int ret_val;
31340 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31341 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031342 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031343 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031344
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031345 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31346 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031348 reader = gen_xmlTextReaderPtr(n_reader, 0);
31349 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031350
William M. Brackf13f77f2004-11-12 16:03:48 +000031351 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031352 desret_int(ret_val);
31353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031354 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031355 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031356 xmlResetLastError();
31357 if (mem_base != xmlMemBlocks()) {
31358 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031360 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031361 printf(" %d", n_reader);
31362 printf(" %d", n_rng);
31363 printf("\n");
31364 }
31365 }
31366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031367 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031368#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031369
Daniel Veillard42595322004-11-08 10:52:06 +000031370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031371}
31372
31373
31374static int
31375test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031377
31378
31379 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031381}
31382
31383
31384static int
31385test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031387
William M. Brack21e4ef22005-01-02 09:53:13 +000031388#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031389 int mem_base;
31390 int ret_val;
31391 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31392 int n_reader;
31393 int prop; /* the xmlParserProperties to set */
31394 int n_prop;
31395 int value; /* usually 0 or 1 to (de)activate it */
31396 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031397
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031398 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31399 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31400 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031402 reader = gen_xmlTextReaderPtr(n_reader, 0);
31403 prop = gen_int(n_prop, 1);
31404 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031405
31406 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31407 desret_int(ret_val);
31408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031409 des_xmlTextReaderPtr(n_reader, reader, 0);
31410 des_int(n_prop, prop, 1);
31411 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031412 xmlResetLastError();
31413 if (mem_base != xmlMemBlocks()) {
31414 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031416 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031417 printf(" %d", n_reader);
31418 printf(" %d", n_prop);
31419 printf(" %d", n_value);
31420 printf("\n");
31421 }
31422 }
31423 }
31424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031425 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031426#endif
31427
Daniel Veillard42595322004-11-08 10:52:06 +000031428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031429}
31430
31431
31432static int
31433test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031435
31436
31437 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031439}
31440
31441
31442static int
31443test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031445
William M. Brack21e4ef22005-01-02 09:53:13 +000031446#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031447 int mem_base;
31448 int ret_val;
31449 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31450 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031451
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031452 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031454 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031455
31456 ret_val = xmlTextReaderStandalone(reader);
31457 desret_int(ret_val);
31458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031459 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031460 xmlResetLastError();
31461 if (mem_base != xmlMemBlocks()) {
31462 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031464 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031465 printf(" %d", n_reader);
31466 printf("\n");
31467 }
31468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031469 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031470#endif
31471
Daniel Veillard42595322004-11-08 10:52:06 +000031472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031473}
31474
31475
31476static int
31477test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031479
William M. Brack21e4ef22005-01-02 09:53:13 +000031480#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031481 int mem_base;
31482 xmlChar * ret_val;
31483 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31484 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031485
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031486 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031488 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031489
31490 ret_val = xmlTextReaderValue(reader);
31491 desret_xmlChar_ptr(ret_val);
31492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031493 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031494 xmlResetLastError();
31495 if (mem_base != xmlMemBlocks()) {
31496 printf("Leak of %d blocks found in xmlTextReaderValue",
31497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031498 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031499 printf(" %d", n_reader);
31500 printf("\n");
31501 }
31502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031503 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031504#endif
31505
Daniel Veillard42595322004-11-08 10:52:06 +000031506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031507}
31508
31509
31510static int
31511test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031513
William M. Brack21e4ef22005-01-02 09:53:13 +000031514#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031515 int mem_base;
31516 xmlChar * ret_val;
31517 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31518 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031519
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031520 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031522 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031523
31524 ret_val = xmlTextReaderXmlLang(reader);
31525 desret_xmlChar_ptr(ret_val);
31526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031527 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031528 xmlResetLastError();
31529 if (mem_base != xmlMemBlocks()) {
31530 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031532 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031533 printf(" %d", n_reader);
31534 printf("\n");
31535 }
31536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031537 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031538#endif
31539
Daniel Veillard42595322004-11-08 10:52:06 +000031540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031541}
31542
31543static int
31544test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031546
Daniel Veillardb5839c32005-02-19 18:27:14 +000031547 if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031548 test_ret += test_xmlNewTextReader();
31549 test_ret += test_xmlNewTextReaderFilename();
31550 test_ret += test_xmlReaderForDoc();
31551 test_ret += test_xmlReaderForFile();
31552 test_ret += test_xmlReaderForMemory();
31553 test_ret += test_xmlReaderNewDoc();
31554 test_ret += test_xmlReaderNewFile();
31555 test_ret += test_xmlReaderNewMemory();
31556 test_ret += test_xmlReaderNewWalker();
31557 test_ret += test_xmlReaderWalker();
31558 test_ret += test_xmlTextReaderAttributeCount();
31559 test_ret += test_xmlTextReaderBaseUri();
Daniel Veillardb5839c32005-02-19 18:27:14 +000031560 test_ret += test_xmlTextReaderByteConsumed();
Daniel Veillard42595322004-11-08 10:52:06 +000031561 test_ret += test_xmlTextReaderClose();
31562 test_ret += test_xmlTextReaderConstBaseUri();
31563 test_ret += test_xmlTextReaderConstEncoding();
31564 test_ret += test_xmlTextReaderConstLocalName();
31565 test_ret += test_xmlTextReaderConstName();
31566 test_ret += test_xmlTextReaderConstNamespaceUri();
31567 test_ret += test_xmlTextReaderConstPrefix();
31568 test_ret += test_xmlTextReaderConstString();
31569 test_ret += test_xmlTextReaderConstValue();
31570 test_ret += test_xmlTextReaderConstXmlLang();
31571 test_ret += test_xmlTextReaderConstXmlVersion();
31572 test_ret += test_xmlTextReaderCurrentDoc();
31573 test_ret += test_xmlTextReaderCurrentNode();
31574 test_ret += test_xmlTextReaderDepth();
31575 test_ret += test_xmlTextReaderExpand();
31576 test_ret += test_xmlTextReaderGetAttribute();
31577 test_ret += test_xmlTextReaderGetAttributeNo();
31578 test_ret += test_xmlTextReaderGetAttributeNs();
31579 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031580 test_ret += test_xmlTextReaderGetParserColumnNumber();
31581 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031582 test_ret += test_xmlTextReaderGetParserProp();
31583 test_ret += test_xmlTextReaderGetRemainder();
31584 test_ret += test_xmlTextReaderHasAttributes();
31585 test_ret += test_xmlTextReaderHasValue();
31586 test_ret += test_xmlTextReaderIsDefault();
31587 test_ret += test_xmlTextReaderIsEmptyElement();
31588 test_ret += test_xmlTextReaderIsNamespaceDecl();
31589 test_ret += test_xmlTextReaderIsValid();
31590 test_ret += test_xmlTextReaderLocalName();
31591 test_ret += test_xmlTextReaderLocatorBaseURI();
31592 test_ret += test_xmlTextReaderLocatorLineNumber();
31593 test_ret += test_xmlTextReaderLookupNamespace();
31594 test_ret += test_xmlTextReaderMoveToAttribute();
31595 test_ret += test_xmlTextReaderMoveToAttributeNo();
31596 test_ret += test_xmlTextReaderMoveToAttributeNs();
31597 test_ret += test_xmlTextReaderMoveToElement();
31598 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31599 test_ret += test_xmlTextReaderMoveToNextAttribute();
31600 test_ret += test_xmlTextReaderName();
31601 test_ret += test_xmlTextReaderNamespaceUri();
31602 test_ret += test_xmlTextReaderNext();
31603 test_ret += test_xmlTextReaderNextSibling();
31604 test_ret += test_xmlTextReaderNodeType();
31605 test_ret += test_xmlTextReaderNormalization();
31606 test_ret += test_xmlTextReaderPrefix();
31607 test_ret += test_xmlTextReaderPreserve();
31608 test_ret += test_xmlTextReaderPreservePattern();
31609 test_ret += test_xmlTextReaderQuoteChar();
31610 test_ret += test_xmlTextReaderRead();
31611 test_ret += test_xmlTextReaderReadAttributeValue();
31612 test_ret += test_xmlTextReaderReadState();
31613 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31614 test_ret += test_xmlTextReaderRelaxNGValidate();
31615 test_ret += test_xmlTextReaderSetErrorHandler();
31616 test_ret += test_xmlTextReaderSetParserProp();
31617 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31618 test_ret += test_xmlTextReaderStandalone();
31619 test_ret += test_xmlTextReaderValue();
31620 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031621
Daniel Veillard42595322004-11-08 10:52:06 +000031622 if (test_ret != 0)
31623 printf("Module xmlreader: %d errors\n", test_ret);
31624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031625}
Daniel Veillarda521d282004-11-09 14:59:59 +000031626#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031627
Daniel Veillarda82b1822004-11-08 16:24:57 +000031628#define gen_nb_xmlRegExecCtxtPtr 1
31629static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31630 return(NULL);
31631}
31632static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31633}
Daniel Veillarda521d282004-11-09 14:59:59 +000031634#endif
31635
Daniel Veillarda82b1822004-11-08 16:24:57 +000031636
31637static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031638test_xmlRegExecErrInfo(void) {
31639 int test_ret = 0;
31640
31641#if defined(LIBXML_REGEXP_ENABLED)
31642 int mem_base;
31643 int ret_val;
31644 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31645 int n_exec;
31646 xmlChar ** string; /* return value for the error string */
31647 int n_string;
31648 int * nbval; /* pointer to the number of accepted values IN/OUT */
31649 int n_nbval;
31650 int * nbneg; /* return number of negative transitions */
31651 int n_nbneg;
31652 xmlChar ** values; /* pointer to the array of acceptable values */
31653 int n_values;
31654 int * terminal; /* return value if this was a terminal state */
31655 int n_terminal;
31656
31657 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31658 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31659 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31660 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31661 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31662 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31663 mem_base = xmlMemBlocks();
31664 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31665 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31666 nbval = gen_int_ptr(n_nbval, 2);
31667 nbneg = gen_int_ptr(n_nbneg, 3);
31668 values = gen_xmlChar_ptr_ptr(n_values, 4);
31669 terminal = gen_int_ptr(n_terminal, 5);
31670
31671 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31672 desret_int(ret_val);
31673 call_tests++;
31674 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31675 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31676 des_int_ptr(n_nbval, nbval, 2);
31677 des_int_ptr(n_nbneg, nbneg, 3);
31678 des_xmlChar_ptr_ptr(n_values, values, 4);
31679 des_int_ptr(n_terminal, terminal, 5);
31680 xmlResetLastError();
31681 if (mem_base != xmlMemBlocks()) {
31682 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31683 xmlMemBlocks() - mem_base);
31684 test_ret++;
31685 printf(" %d", n_exec);
31686 printf(" %d", n_string);
31687 printf(" %d", n_nbval);
31688 printf(" %d", n_nbneg);
31689 printf(" %d", n_values);
31690 printf(" %d", n_terminal);
31691 printf("\n");
31692 }
31693 }
31694 }
31695 }
31696 }
31697 }
31698 }
31699 function_tests++;
31700#endif
31701
31702 return(test_ret);
31703}
31704
31705
31706static int
31707test_xmlRegExecNextValues(void) {
31708 int test_ret = 0;
31709
31710#if defined(LIBXML_REGEXP_ENABLED)
31711 int mem_base;
31712 int ret_val;
31713 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31714 int n_exec;
31715 int * nbval; /* pointer to the number of accepted values IN/OUT */
31716 int n_nbval;
31717 int * nbneg; /* return number of negative transitions */
31718 int n_nbneg;
31719 xmlChar ** values; /* pointer to the array of acceptable values */
31720 int n_values;
31721 int * terminal; /* return value if this was a terminal state */
31722 int n_terminal;
31723
31724 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31725 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31726 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31727 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31728 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31729 mem_base = xmlMemBlocks();
31730 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31731 nbval = gen_int_ptr(n_nbval, 1);
31732 nbneg = gen_int_ptr(n_nbneg, 2);
31733 values = gen_xmlChar_ptr_ptr(n_values, 3);
31734 terminal = gen_int_ptr(n_terminal, 4);
31735
31736 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31737 desret_int(ret_val);
31738 call_tests++;
31739 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31740 des_int_ptr(n_nbval, nbval, 1);
31741 des_int_ptr(n_nbneg, nbneg, 2);
31742 des_xmlChar_ptr_ptr(n_values, values, 3);
31743 des_int_ptr(n_terminal, terminal, 4);
31744 xmlResetLastError();
31745 if (mem_base != xmlMemBlocks()) {
31746 printf("Leak of %d blocks found in xmlRegExecNextValues",
31747 xmlMemBlocks() - mem_base);
31748 test_ret++;
31749 printf(" %d", n_exec);
31750 printf(" %d", n_nbval);
31751 printf(" %d", n_nbneg);
31752 printf(" %d", n_values);
31753 printf(" %d", n_terminal);
31754 printf("\n");
31755 }
31756 }
31757 }
31758 }
31759 }
31760 }
31761 function_tests++;
31762#endif
31763
31764 return(test_ret);
31765}
31766
31767
31768static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031769test_xmlRegExecPushString(void) {
31770 int test_ret = 0;
31771
William M. Brack21e4ef22005-01-02 09:53:13 +000031772#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031773 int mem_base;
31774 int ret_val;
31775 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31776 int n_exec;
31777 xmlChar * value; /* a string token input */
31778 int n_value;
31779 void * data; /* data associated to the token to reuse in callbacks */
31780 int n_data;
31781
31782 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31783 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31784 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31785 mem_base = xmlMemBlocks();
31786 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31787 value = gen_const_xmlChar_ptr(n_value, 1);
31788 data = gen_userdata(n_data, 2);
31789
William M. Brackf13f77f2004-11-12 16:03:48 +000031790 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031791 desret_int(ret_val);
31792 call_tests++;
31793 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031794 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031795 des_userdata(n_data, data, 2);
31796 xmlResetLastError();
31797 if (mem_base != xmlMemBlocks()) {
31798 printf("Leak of %d blocks found in xmlRegExecPushString",
31799 xmlMemBlocks() - mem_base);
31800 test_ret++;
31801 printf(" %d", n_exec);
31802 printf(" %d", n_value);
31803 printf(" %d", n_data);
31804 printf("\n");
31805 }
31806 }
31807 }
31808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031809 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031810#endif
31811
Daniel Veillarda82b1822004-11-08 16:24:57 +000031812 return(test_ret);
31813}
31814
31815
31816static int
31817test_xmlRegExecPushString2(void) {
31818 int test_ret = 0;
31819
William M. Brack21e4ef22005-01-02 09:53:13 +000031820#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031821 int mem_base;
31822 int ret_val;
31823 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31824 int n_exec;
31825 xmlChar * value; /* the first string token input */
31826 int n_value;
31827 xmlChar * value2; /* the second string token input */
31828 int n_value2;
31829 void * data; /* data associated to the token to reuse in callbacks */
31830 int n_data;
31831
31832 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31833 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31834 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31835 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31836 mem_base = xmlMemBlocks();
31837 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31838 value = gen_const_xmlChar_ptr(n_value, 1);
31839 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31840 data = gen_userdata(n_data, 3);
31841
William M. Brackf13f77f2004-11-12 16:03:48 +000031842 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031843 desret_int(ret_val);
31844 call_tests++;
31845 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031846 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31847 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031848 des_userdata(n_data, data, 3);
31849 xmlResetLastError();
31850 if (mem_base != xmlMemBlocks()) {
31851 printf("Leak of %d blocks found in xmlRegExecPushString2",
31852 xmlMemBlocks() - mem_base);
31853 test_ret++;
31854 printf(" %d", n_exec);
31855 printf(" %d", n_value);
31856 printf(" %d", n_value2);
31857 printf(" %d", n_data);
31858 printf("\n");
31859 }
31860 }
31861 }
31862 }
31863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031864 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031865#endif
31866
Daniel Veillarda82b1822004-11-08 16:24:57 +000031867 return(test_ret);
31868}
31869
Daniel Veillarda521d282004-11-09 14:59:59 +000031870#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031871
31872#define gen_nb_xmlRegexpPtr 1
31873static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31874 return(NULL);
31875}
31876static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31877}
Daniel Veillarda521d282004-11-09 14:59:59 +000031878#endif
31879
Daniel Veillarda82b1822004-11-08 16:24:57 +000031880
31881static int
31882test_xmlRegNewExecCtxt(void) {
31883 int test_ret = 0;
31884
31885
31886 /* missing type support */
31887 return(test_ret);
31888}
31889
31890
31891static int
31892test_xmlRegexpCompile(void) {
31893 int test_ret = 0;
31894
31895
31896 /* missing type support */
31897 return(test_ret);
31898}
31899
31900
31901static int
31902test_xmlRegexpExec(void) {
31903 int test_ret = 0;
31904
William M. Brack21e4ef22005-01-02 09:53:13 +000031905#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031906 int mem_base;
31907 int ret_val;
31908 xmlRegexpPtr comp; /* the compiled regular expression */
31909 int n_comp;
31910 xmlChar * content; /* the value to check against the regular expression */
31911 int n_content;
31912
31913 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31914 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31915 mem_base = xmlMemBlocks();
31916 comp = gen_xmlRegexpPtr(n_comp, 0);
31917 content = gen_const_xmlChar_ptr(n_content, 1);
31918
William M. Brackf13f77f2004-11-12 16:03:48 +000031919 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031920 desret_int(ret_val);
31921 call_tests++;
31922 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031923 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031924 xmlResetLastError();
31925 if (mem_base != xmlMemBlocks()) {
31926 printf("Leak of %d blocks found in xmlRegexpExec",
31927 xmlMemBlocks() - mem_base);
31928 test_ret++;
31929 printf(" %d", n_comp);
31930 printf(" %d", n_content);
31931 printf("\n");
31932 }
31933 }
31934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031935 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031936#endif
31937
Daniel Veillarda82b1822004-11-08 16:24:57 +000031938 return(test_ret);
31939}
31940
31941
31942static int
31943test_xmlRegexpIsDeterminist(void) {
31944 int test_ret = 0;
31945
William M. Brack21e4ef22005-01-02 09:53:13 +000031946#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031947 int mem_base;
31948 int ret_val;
31949 xmlRegexpPtr comp; /* the compiled regular expression */
31950 int n_comp;
31951
31952 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31953 mem_base = xmlMemBlocks();
31954 comp = gen_xmlRegexpPtr(n_comp, 0);
31955
31956 ret_val = xmlRegexpIsDeterminist(comp);
31957 desret_int(ret_val);
31958 call_tests++;
31959 des_xmlRegexpPtr(n_comp, comp, 0);
31960 xmlResetLastError();
31961 if (mem_base != xmlMemBlocks()) {
31962 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31963 xmlMemBlocks() - mem_base);
31964 test_ret++;
31965 printf(" %d", n_comp);
31966 printf("\n");
31967 }
31968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031969 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031970#endif
31971
Daniel Veillarda82b1822004-11-08 16:24:57 +000031972 return(test_ret);
31973}
31974
31975
31976static int
31977test_xmlRegexpPrint(void) {
31978 int test_ret = 0;
31979
William M. Brack21e4ef22005-01-02 09:53:13 +000031980#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031981 int mem_base;
31982 FILE * output; /* the file for the output debug */
31983 int n_output;
31984 xmlRegexpPtr regexp; /* the compiled regexp */
31985 int n_regexp;
31986
31987 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31988 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31989 mem_base = xmlMemBlocks();
31990 output = gen_FILE_ptr(n_output, 0);
31991 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31992
31993 xmlRegexpPrint(output, regexp);
31994 call_tests++;
31995 des_FILE_ptr(n_output, output, 0);
31996 des_xmlRegexpPtr(n_regexp, regexp, 1);
31997 xmlResetLastError();
31998 if (mem_base != xmlMemBlocks()) {
31999 printf("Leak of %d blocks found in xmlRegexpPrint",
32000 xmlMemBlocks() - mem_base);
32001 test_ret++;
32002 printf(" %d", n_output);
32003 printf(" %d", n_regexp);
32004 printf("\n");
32005 }
32006 }
32007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032008 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000032009#endif
32010
Daniel Veillarda82b1822004-11-08 16:24:57 +000032011 return(test_ret);
32012}
32013
32014static int
32015test_xmlregexp(void) {
32016 int test_ret = 0;
32017
Daniel Veillardf47d2e32005-01-12 14:16:08 +000032018 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
32019 test_ret += test_xmlRegExecErrInfo();
32020 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000032021 test_ret += test_xmlRegExecPushString();
32022 test_ret += test_xmlRegExecPushString2();
32023 test_ret += test_xmlRegNewExecCtxt();
32024 test_ret += test_xmlRegexpCompile();
32025 test_ret += test_xmlRegexpExec();
32026 test_ret += test_xmlRegexpIsDeterminist();
32027 test_ret += test_xmlRegexpPrint();
32028
32029 if (test_ret != 0)
32030 printf("Module xmlregexp: %d errors\n", test_ret);
32031 return(test_ret);
32032}
Daniel Veillarda521d282004-11-09 14:59:59 +000032033#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000032034
Daniel Veillardce682bc2004-11-05 17:22:25 +000032035#define gen_nb_xmlSaveCtxtPtr 1
32036static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32037 return(NULL);
32038}
32039static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32040}
Daniel Veillarda521d282004-11-09 14:59:59 +000032041#endif
32042
Daniel Veillardce682bc2004-11-05 17:22:25 +000032043
Daniel Veillardd93f6252004-11-02 15:53:51 +000032044static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032045test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032047
William M. Brack21e4ef22005-01-02 09:53:13 +000032048#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032049 int mem_base;
32050 int ret_val;
32051 xmlSaveCtxtPtr ctxt; /* a document saving context */
32052 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032053
Daniel Veillardce682bc2004-11-05 17:22:25 +000032054 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
32055 mem_base = xmlMemBlocks();
32056 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32057
32058 ret_val = xmlSaveClose(ctxt);
32059 desret_int(ret_val);
32060 call_tests++;
32061 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32062 xmlResetLastError();
32063 if (mem_base != xmlMemBlocks()) {
32064 printf("Leak of %d blocks found in xmlSaveClose",
32065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032066 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032067 printf(" %d", n_ctxt);
32068 printf("\n");
32069 }
32070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032071 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032072#endif
32073
Daniel Veillard42595322004-11-08 10:52:06 +000032074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032075}
32076
32077
32078static int
32079test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032081
William M. Brack21e4ef22005-01-02 09:53:13 +000032082#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032083 int mem_base;
32084 long ret_val;
32085 xmlSaveCtxtPtr ctxt; /* a document saving context */
32086 int n_ctxt;
32087 xmlDocPtr doc; /* a document */
32088 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089
Daniel Veillardce682bc2004-11-05 17:22:25 +000032090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
32091 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32092 mem_base = xmlMemBlocks();
32093 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32094 doc = gen_xmlDocPtr(n_doc, 1);
32095
32096 ret_val = xmlSaveDoc(ctxt, doc);
32097 desret_long(ret_val);
32098 call_tests++;
32099 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32100 des_xmlDocPtr(n_doc, doc, 1);
32101 xmlResetLastError();
32102 if (mem_base != xmlMemBlocks()) {
32103 printf("Leak of %d blocks found in xmlSaveDoc",
32104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032105 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032106 printf(" %d", n_ctxt);
32107 printf(" %d", n_doc);
32108 printf("\n");
32109 }
32110 }
32111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032112 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032113#endif
32114
Daniel Veillard42595322004-11-08 10:52:06 +000032115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032116}
32117
32118
32119static int
32120test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122
William M. Brack21e4ef22005-01-02 09:53:13 +000032123#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032124 int mem_base;
32125 int ret_val;
32126 xmlSaveCtxtPtr ctxt; /* a document saving context */
32127 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032128
Daniel Veillardce682bc2004-11-05 17:22:25 +000032129 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
32130 mem_base = xmlMemBlocks();
32131 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32132
32133 ret_val = xmlSaveFlush(ctxt);
32134 desret_int(ret_val);
32135 call_tests++;
32136 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32137 xmlResetLastError();
32138 if (mem_base != xmlMemBlocks()) {
32139 printf("Leak of %d blocks found in xmlSaveFlush",
32140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032141 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032142 printf(" %d", n_ctxt);
32143 printf("\n");
32144 }
32145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032146 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032147#endif
32148
Daniel Veillard42595322004-11-08 10:52:06 +000032149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032150}
32151
32152
32153static int
32154test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032156
32157
32158 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032160}
32161
32162
32163static int
32164test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032166
32167
32168 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032170}
32171
32172
32173static int
32174test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032176
32177
32178 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032180}
32181
32182
32183static int
32184test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032186
32187
32188 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032190}
32191
32192
32193static int
32194test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032196
William M. Brack21e4ef22005-01-02 09:53:13 +000032197#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032198 int mem_base;
32199 long ret_val;
32200 xmlSaveCtxtPtr ctxt; /* a document saving context */
32201 int n_ctxt;
32202 xmlNodePtr node; /* a document */
32203 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032204
Daniel Veillardce682bc2004-11-05 17:22:25 +000032205 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
32206 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32207 mem_base = xmlMemBlocks();
32208 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
32209 node = gen_xmlNodePtr(n_node, 1);
32210
32211 ret_val = xmlSaveTree(ctxt, node);
32212 desret_long(ret_val);
32213 call_tests++;
32214 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32215 des_xmlNodePtr(n_node, node, 1);
32216 xmlResetLastError();
32217 if (mem_base != xmlMemBlocks()) {
32218 printf("Leak of %d blocks found in xmlSaveTree",
32219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032220 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032221 printf(" %d", n_ctxt);
32222 printf(" %d", n_node);
32223 printf("\n");
32224 }
32225 }
32226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032227 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032228#endif
32229
Daniel Veillard42595322004-11-08 10:52:06 +000032230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032231}
32232
32233static int
32234test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032236
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032237 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032238 test_ret += test_xmlSaveClose();
32239 test_ret += test_xmlSaveDoc();
32240 test_ret += test_xmlSaveFlush();
32241 test_ret += test_xmlSaveSetAttrEscape();
32242 test_ret += test_xmlSaveSetEscape();
32243 test_ret += test_xmlSaveToFd();
32244 test_ret += test_xmlSaveToFilename();
32245 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032246
Daniel Veillard42595322004-11-08 10:52:06 +000032247 if (test_ret != 0)
32248 printf("Module xmlsave: %d errors\n", test_ret);
32249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032250}
Daniel Veillarda521d282004-11-09 14:59:59 +000032251#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032252
Daniel Veillardce682bc2004-11-05 17:22:25 +000032253#define gen_nb_xmlSchemaPtr 1
32254static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32255 return(NULL);
32256}
32257static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32258}
Daniel Veillarda521d282004-11-09 14:59:59 +000032259#endif
32260
Daniel Veillardce682bc2004-11-05 17:22:25 +000032261
Daniel Veillardd93f6252004-11-02 15:53:51 +000032262static int
32263test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032265
William M. Brack21e4ef22005-01-02 09:53:13 +000032266#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032267 int mem_base;
32268 FILE * output; /* the file output */
32269 int n_output;
32270 xmlSchemaPtr schema; /* a schema structure */
32271 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032272
Daniel Veillardce682bc2004-11-05 17:22:25 +000032273 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32274 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32275 mem_base = xmlMemBlocks();
32276 output = gen_FILE_ptr(n_output, 0);
32277 schema = gen_xmlSchemaPtr(n_schema, 1);
32278
32279 xmlSchemaDump(output, schema);
32280 call_tests++;
32281 des_FILE_ptr(n_output, output, 0);
32282 des_xmlSchemaPtr(n_schema, schema, 1);
32283 xmlResetLastError();
32284 if (mem_base != xmlMemBlocks()) {
32285 printf("Leak of %d blocks found in xmlSchemaDump",
32286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032287 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032288 printf(" %d", n_output);
32289 printf(" %d", n_schema);
32290 printf("\n");
32291 }
32292 }
32293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032294 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032295#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032296
Daniel Veillard42595322004-11-08 10:52:06 +000032297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032298}
32299
Daniel Veillarda521d282004-11-09 14:59:59 +000032300#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032301
Daniel Veillardce682bc2004-11-05 17:22:25 +000032302#define gen_nb_xmlSchemaParserCtxtPtr 1
32303static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32304 return(NULL);
32305}
32306static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32307}
Daniel Veillarda521d282004-11-09 14:59:59 +000032308#endif
32309
32310#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032311
32312#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32313static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32314 return(NULL);
32315}
32316static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32317}
Daniel Veillarda521d282004-11-09 14:59:59 +000032318#endif
32319
32320#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032321
32322#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32323static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32324 return(NULL);
32325}
32326static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32327}
Daniel Veillarda521d282004-11-09 14:59:59 +000032328#endif
32329
Daniel Veillardce682bc2004-11-05 17:22:25 +000032330
Daniel Veillardd93f6252004-11-02 15:53:51 +000032331static int
32332test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032334
William M. Brack21e4ef22005-01-02 09:53:13 +000032335#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032336 int mem_base;
32337 int ret_val;
32338 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32339 int n_ctxt;
32340 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32341 int n_err;
32342 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32343 int n_warn;
32344 void ** ctx; /* contextual data for the callbacks result */
32345 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032346
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032347 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32348 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32349 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32350 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32351 mem_base = xmlMemBlocks();
32352 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32353 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32354 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32355 ctx = gen_void_ptr_ptr(n_ctx, 3);
32356
32357 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32358 desret_int(ret_val);
32359 call_tests++;
32360 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32361 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32362 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32363 des_void_ptr_ptr(n_ctx, ctx, 3);
32364 xmlResetLastError();
32365 if (mem_base != xmlMemBlocks()) {
32366 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032368 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032369 printf(" %d", n_ctxt);
32370 printf(" %d", n_err);
32371 printf(" %d", n_warn);
32372 printf(" %d", n_ctx);
32373 printf("\n");
32374 }
32375 }
32376 }
32377 }
32378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032379 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032380#endif
32381
Daniel Veillard42595322004-11-08 10:52:06 +000032382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032383}
32384
Daniel Veillarda521d282004-11-09 14:59:59 +000032385#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032386
Daniel Veillardce682bc2004-11-05 17:22:25 +000032387#define gen_nb_xmlSchemaValidCtxtPtr 1
32388static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32389 return(NULL);
32390}
32391static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32392}
Daniel Veillarda521d282004-11-09 14:59:59 +000032393#endif
32394
Daniel Veillardce682bc2004-11-05 17:22:25 +000032395
Daniel Veillardd93f6252004-11-02 15:53:51 +000032396static int
32397test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032399
William M. Brack21e4ef22005-01-02 09:53:13 +000032400#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032401 int mem_base;
32402 int ret_val;
32403 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32404 int n_ctxt;
32405 xmlSchemaValidityErrorFunc * err; /* the error function result */
32406 int n_err;
32407 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32408 int n_warn;
32409 void ** ctx; /* the functions context result */
32410 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032411
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032412 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32413 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32414 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32415 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32416 mem_base = xmlMemBlocks();
32417 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32418 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32419 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32420 ctx = gen_void_ptr_ptr(n_ctx, 3);
32421
32422 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32423 desret_int(ret_val);
32424 call_tests++;
32425 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32426 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32427 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32428 des_void_ptr_ptr(n_ctx, ctx, 3);
32429 xmlResetLastError();
32430 if (mem_base != xmlMemBlocks()) {
32431 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032433 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032434 printf(" %d", n_ctxt);
32435 printf(" %d", n_err);
32436 printf(" %d", n_warn);
32437 printf(" %d", n_ctx);
32438 printf("\n");
32439 }
32440 }
32441 }
32442 }
32443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032444 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032445#endif
32446
Daniel Veillard42595322004-11-08 10:52:06 +000032447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032448}
32449
32450
32451static int
32452test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032454
William M. Brack21e4ef22005-01-02 09:53:13 +000032455#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032456 int mem_base;
32457 xmlSchemaParserCtxtPtr ret_val;
32458 xmlDocPtr doc; /* a preparsed document tree */
32459 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032460
Daniel Veillard42595322004-11-08 10:52:06 +000032461 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32462 mem_base = xmlMemBlocks();
32463 doc = gen_xmlDocPtr(n_doc, 0);
32464
32465 ret_val = xmlSchemaNewDocParserCtxt(doc);
32466 desret_xmlSchemaParserCtxtPtr(ret_val);
32467 call_tests++;
32468 des_xmlDocPtr(n_doc, doc, 0);
32469 xmlResetLastError();
32470 if (mem_base != xmlMemBlocks()) {
32471 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32472 xmlMemBlocks() - mem_base);
32473 test_ret++;
32474 printf(" %d", n_doc);
32475 printf("\n");
32476 }
32477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032478 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032479#endif
32480
Daniel Veillard42595322004-11-08 10:52:06 +000032481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032482}
32483
32484
32485static int
32486test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032488
William M. Brack21e4ef22005-01-02 09:53:13 +000032489#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032490 int mem_base;
32491 xmlSchemaParserCtxtPtr ret_val;
32492 char * buffer; /* a pointer to a char array containing the schemas */
32493 int n_buffer;
32494 int size; /* the size of the array */
32495 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032496
Daniel Veillard42595322004-11-08 10:52:06 +000032497 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32498 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32499 mem_base = xmlMemBlocks();
32500 buffer = gen_const_char_ptr(n_buffer, 0);
32501 size = gen_int(n_size, 1);
32502
William M. Brackf13f77f2004-11-12 16:03:48 +000032503 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032504 desret_xmlSchemaParserCtxtPtr(ret_val);
32505 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032506 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032507 des_int(n_size, size, 1);
32508 xmlResetLastError();
32509 if (mem_base != xmlMemBlocks()) {
32510 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32511 xmlMemBlocks() - mem_base);
32512 test_ret++;
32513 printf(" %d", n_buffer);
32514 printf(" %d", n_size);
32515 printf("\n");
32516 }
32517 }
32518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032519 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032520#endif
32521
Daniel Veillard42595322004-11-08 10:52:06 +000032522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032523}
32524
32525
32526static int
32527test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032529
William M. Brack21e4ef22005-01-02 09:53:13 +000032530#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032531 int mem_base;
32532 xmlSchemaParserCtxtPtr ret_val;
32533 char * URL; /* the location of the schema */
32534 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032535
Daniel Veillard42595322004-11-08 10:52:06 +000032536 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32537 mem_base = xmlMemBlocks();
32538 URL = gen_const_char_ptr(n_URL, 0);
32539
William M. Brackf13f77f2004-11-12 16:03:48 +000032540 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032541 desret_xmlSchemaParserCtxtPtr(ret_val);
32542 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032543 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032544 xmlResetLastError();
32545 if (mem_base != xmlMemBlocks()) {
32546 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32547 xmlMemBlocks() - mem_base);
32548 test_ret++;
32549 printf(" %d", n_URL);
32550 printf("\n");
32551 }
32552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032553 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032554#endif
32555
Daniel Veillard42595322004-11-08 10:52:06 +000032556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032557}
32558
32559
32560static int
32561test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032563
32564
32565 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032567}
32568
32569
32570static int
32571test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032573
32574
32575 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032577}
32578
32579
32580static int
32581test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032583
32584
32585 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032587}
32588
32589
32590static int
32591test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032593
32594
32595 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032597}
32598
32599
32600static int
32601test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603
William M. Brack21e4ef22005-01-02 09:53:13 +000032604#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032605 int mem_base;
32606 int ret_val;
32607 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32608 int n_ctxt;
32609 int options; /* a combination of xmlSchemaValidOption */
32610 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032611
Daniel Veillardce682bc2004-11-05 17:22:25 +000032612 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32613 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32614 mem_base = xmlMemBlocks();
32615 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32616 options = gen_int(n_options, 1);
32617
32618 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32619 desret_int(ret_val);
32620 call_tests++;
32621 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32622 des_int(n_options, options, 1);
32623 xmlResetLastError();
32624 if (mem_base != xmlMemBlocks()) {
32625 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032627 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032628 printf(" %d", n_ctxt);
32629 printf(" %d", n_options);
32630 printf("\n");
32631 }
32632 }
32633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032634 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032635#endif
32636
Daniel Veillard42595322004-11-08 10:52:06 +000032637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032638}
32639
32640
32641static int
32642test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032644
William M. Brack21e4ef22005-01-02 09:53:13 +000032645#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032646 int mem_base;
32647 int ret_val;
32648 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32649 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032650
Daniel Veillardce682bc2004-11-05 17:22:25 +000032651 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32652 mem_base = xmlMemBlocks();
32653 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32654
32655 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32656 desret_int(ret_val);
32657 call_tests++;
32658 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32659 xmlResetLastError();
32660 if (mem_base != xmlMemBlocks()) {
32661 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032663 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032664 printf(" %d", n_ctxt);
32665 printf("\n");
32666 }
32667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032668 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032669#endif
32670
Daniel Veillard42595322004-11-08 10:52:06 +000032671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032672}
32673
32674
32675static int
32676test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032678
William M. Brack21e4ef22005-01-02 09:53:13 +000032679#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032680 int mem_base;
32681 int ret_val;
32682 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32683 int n_ctxt;
32684 xmlDocPtr doc; /* a parsed document tree */
32685 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032686
Daniel Veillardce682bc2004-11-05 17:22:25 +000032687 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32688 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32689 mem_base = xmlMemBlocks();
32690 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32691 doc = gen_xmlDocPtr(n_doc, 1);
32692
32693 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32694 desret_int(ret_val);
32695 call_tests++;
32696 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32697 des_xmlDocPtr(n_doc, doc, 1);
32698 xmlResetLastError();
32699 if (mem_base != xmlMemBlocks()) {
32700 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032702 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032703 printf(" %d", n_ctxt);
32704 printf(" %d", n_doc);
32705 printf("\n");
32706 }
32707 }
32708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032709 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032710#endif
32711
Daniel Veillard42595322004-11-08 10:52:06 +000032712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032713}
32714
32715
32716static int
Daniel Veillard81562d22005-06-15 13:27:56 +000032717test_xmlSchemaValidateFile(void) {
32718 int test_ret = 0;
32719
32720#if defined(LIBXML_SCHEMAS_ENABLED)
32721 int mem_base;
32722 int ret_val;
32723 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32724 int n_ctxt;
32725 const char * filename; /* the URI of the instance */
32726 int n_filename;
32727 int options; /* a future set of options, currently unused */
32728 int n_options;
32729
32730 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32731 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
32732 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32733 mem_base = xmlMemBlocks();
32734 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32735 filename = gen_filepath(n_filename, 1);
32736 options = gen_int(n_options, 2);
32737
32738 ret_val = xmlSchemaValidateFile(ctxt, filename, options);
32739 desret_int(ret_val);
32740 call_tests++;
32741 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32742 des_filepath(n_filename, filename, 1);
32743 des_int(n_options, options, 2);
32744 xmlResetLastError();
32745 if (mem_base != xmlMemBlocks()) {
32746 printf("Leak of %d blocks found in xmlSchemaValidateFile",
32747 xmlMemBlocks() - mem_base);
32748 test_ret++;
32749 printf(" %d", n_ctxt);
32750 printf(" %d", n_filename);
32751 printf(" %d", n_options);
32752 printf("\n");
32753 }
32754 }
32755 }
32756 }
32757 function_tests++;
32758#endif
32759
32760 return(test_ret);
32761}
32762
32763
32764static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032765test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032767
William M. Brack21e4ef22005-01-02 09:53:13 +000032768#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032769 int mem_base;
32770 int ret_val;
32771 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32772 int n_ctxt;
32773 xmlNodePtr elem; /* an element node */
32774 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032775
Daniel Veillardce682bc2004-11-05 17:22:25 +000032776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32777 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32778 mem_base = xmlMemBlocks();
32779 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32780 elem = gen_xmlNodePtr(n_elem, 1);
32781
32782 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32783 desret_int(ret_val);
32784 call_tests++;
32785 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32786 des_xmlNodePtr(n_elem, elem, 1);
32787 xmlResetLastError();
32788 if (mem_base != xmlMemBlocks()) {
32789 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032791 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032792 printf(" %d", n_ctxt);
32793 printf(" %d", n_elem);
32794 printf("\n");
32795 }
32796 }
32797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032798 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032799#endif
32800
Daniel Veillard42595322004-11-08 10:52:06 +000032801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032802}
32803
32804
32805static int
32806test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032808
William M. Brack21e4ef22005-01-02 09:53:13 +000032809#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032810 int mem_base;
32811 int ret_val;
32812 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32813 int n_ctxt;
32814 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32815 int n_input;
32816 xmlCharEncoding enc; /* an optional encoding information */
32817 int n_enc;
32818 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32819 int n_sax;
32820 void * user_data; /* the context to provide to the SAX handler. */
32821 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032822
Daniel Veillardce682bc2004-11-05 17:22:25 +000032823 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32824 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32825 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32826 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32827 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32828 mem_base = xmlMemBlocks();
32829 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32830 input = gen_xmlParserInputBufferPtr(n_input, 1);
32831 enc = gen_xmlCharEncoding(n_enc, 2);
32832 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32833 user_data = gen_userdata(n_user_data, 4);
32834
32835 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32836 desret_int(ret_val);
32837 call_tests++;
32838 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32839 des_xmlParserInputBufferPtr(n_input, input, 1);
32840 des_xmlCharEncoding(n_enc, enc, 2);
32841 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32842 des_userdata(n_user_data, user_data, 4);
32843 xmlResetLastError();
32844 if (mem_base != xmlMemBlocks()) {
32845 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032847 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032848 printf(" %d", n_ctxt);
32849 printf(" %d", n_input);
32850 printf(" %d", n_enc);
32851 printf(" %d", n_sax);
32852 printf(" %d", n_user_data);
32853 printf("\n");
32854 }
32855 }
32856 }
32857 }
32858 }
32859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032860 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032861#endif
32862
Daniel Veillard42595322004-11-08 10:52:06 +000032863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032864}
32865
32866static int
32867test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032869
Daniel Veillard81562d22005-06-15 13:27:56 +000032870 if (quiet == 0) printf("Testing xmlschemas : 12 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032871 test_ret += test_xmlSchemaDump();
32872 test_ret += test_xmlSchemaGetParserErrors();
32873 test_ret += test_xmlSchemaGetValidErrors();
32874 test_ret += test_xmlSchemaNewDocParserCtxt();
32875 test_ret += test_xmlSchemaNewMemParserCtxt();
32876 test_ret += test_xmlSchemaNewParserCtxt();
32877 test_ret += test_xmlSchemaNewValidCtxt();
32878 test_ret += test_xmlSchemaParse();
32879 test_ret += test_xmlSchemaSetParserErrors();
32880 test_ret += test_xmlSchemaSetValidErrors();
32881 test_ret += test_xmlSchemaSetValidOptions();
32882 test_ret += test_xmlSchemaValidCtxtGetOptions();
32883 test_ret += test_xmlSchemaValidateDoc();
Daniel Veillard81562d22005-06-15 13:27:56 +000032884 test_ret += test_xmlSchemaValidateFile();
Daniel Veillard42595322004-11-08 10:52:06 +000032885 test_ret += test_xmlSchemaValidateOneElement();
32886 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032887
Daniel Veillard42595322004-11-08 10:52:06 +000032888 if (test_ret != 0)
32889 printf("Module xmlschemas: %d errors\n", test_ret);
32890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032891}
Daniel Veillarda521d282004-11-09 14:59:59 +000032892#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032893
Daniel Veillardce682bc2004-11-05 17:22:25 +000032894#define gen_nb_xmlSchemaFacetPtr 1
32895static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32896 return(NULL);
32897}
32898static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32899}
Daniel Veillarda521d282004-11-09 14:59:59 +000032900#endif
32901
32902#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032903
32904#define gen_nb_xmlSchemaTypePtr 1
32905static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32906 return(NULL);
32907}
32908static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32909}
Daniel Veillarda521d282004-11-09 14:59:59 +000032910#endif
32911
Daniel Veillardce682bc2004-11-05 17:22:25 +000032912
Daniel Veillardd93f6252004-11-02 15:53:51 +000032913static int
32914test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032916
William M. Brack21e4ef22005-01-02 09:53:13 +000032917#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918 int mem_base;
32919 int ret_val;
32920 xmlSchemaFacetPtr facet; /* the facet */
32921 int n_facet;
32922 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32923 int n_typeDecl;
Daniel Veillard81562d22005-06-15 13:27:56 +000032924 xmlSchemaParserCtxtPtr pctxt; /* the schema parser context or NULL */
32925 int n_pctxt;
32926 xmlChar * name; /* the optional name of the type */
Daniel Veillardce682bc2004-11-05 17:22:25 +000032927 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032928
Daniel Veillardce682bc2004-11-05 17:22:25 +000032929 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32930 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
Daniel Veillard81562d22005-06-15 13:27:56 +000032931 for (n_pctxt = 0;n_pctxt < gen_nb_xmlSchemaParserCtxtPtr;n_pctxt++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +000032932 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32933 mem_base = xmlMemBlocks();
32934 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32935 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
Daniel Veillard81562d22005-06-15 13:27:56 +000032936 pctxt = gen_xmlSchemaParserCtxtPtr(n_pctxt, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032937 name = gen_const_xmlChar_ptr(n_name, 3);
32938
Daniel Veillard81562d22005-06-15 13:27:56 +000032939 ret_val = xmlSchemaCheckFacet(facet, typeDecl, pctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032940 desret_int(ret_val);
32941 call_tests++;
32942 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32943 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
Daniel Veillard81562d22005-06-15 13:27:56 +000032944 des_xmlSchemaParserCtxtPtr(n_pctxt, pctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032946 xmlResetLastError();
32947 if (mem_base != xmlMemBlocks()) {
32948 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032950 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032951 printf(" %d", n_facet);
32952 printf(" %d", n_typeDecl);
Daniel Veillard81562d22005-06-15 13:27:56 +000032953 printf(" %d", n_pctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032954 printf(" %d", n_name);
32955 printf("\n");
32956 }
32957 }
32958 }
32959 }
32960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032961 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032962#endif
32963
Daniel Veillard42595322004-11-08 10:52:06 +000032964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032965}
32966
32967
32968static int
32969test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032971
William M. Brack21e4ef22005-01-02 09:53:13 +000032972#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032973 int mem_base;
32974
32975 mem_base = xmlMemBlocks();
32976
32977 xmlSchemaCleanupTypes();
32978 call_tests++;
32979 xmlResetLastError();
32980 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032981 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032983 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032984 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032986 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032987#endif
32988
Daniel Veillard42595322004-11-08 10:52:06 +000032989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032990}
32991
32992
32993static int
32994test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032996
William M. Brack21e4ef22005-01-02 09:53:13 +000032997#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032998 int mem_base;
32999 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033000 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033001 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033002
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033003 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033005 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033006
William M. Brackf13f77f2004-11-12 16:03:48 +000033007 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033008 desret_xmlChar_ptr(ret_val);
33009 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033010 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033011 xmlResetLastError();
33012 if (mem_base != xmlMemBlocks()) {
33013 printf("Leak of %d blocks found in xmlSchemaCollapseString",
33014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033015 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033016 printf(" %d", n_value);
33017 printf("\n");
33018 }
33019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033020 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033021#endif
33022
Daniel Veillard42595322004-11-08 10:52:06 +000033023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033024}
33025
Daniel Veillarda521d282004-11-09 14:59:59 +000033026#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033027
Daniel Veillardce682bc2004-11-05 17:22:25 +000033028#define gen_nb_xmlSchemaValPtr 1
33029static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33030 return(NULL);
33031}
33032static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33033}
Daniel Veillarda521d282004-11-09 14:59:59 +000033034#endif
33035
Daniel Veillardce682bc2004-11-05 17:22:25 +000033036
Daniel Veillardd93f6252004-11-02 15:53:51 +000033037static int
33038test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033040
William M. Brack21e4ef22005-01-02 09:53:13 +000033041#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033042 int mem_base;
33043 int ret_val;
33044 xmlSchemaValPtr x; /* a first value */
33045 int n_x;
33046 xmlSchemaValPtr y; /* a second value */
33047 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033048
Daniel Veillardce682bc2004-11-05 17:22:25 +000033049 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
33050 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
33051 mem_base = xmlMemBlocks();
33052 x = gen_xmlSchemaValPtr(n_x, 0);
33053 y = gen_xmlSchemaValPtr(n_y, 1);
33054
33055 ret_val = xmlSchemaCompareValues(x, y);
33056 desret_int(ret_val);
33057 call_tests++;
33058 des_xmlSchemaValPtr(n_x, x, 0);
33059 des_xmlSchemaValPtr(n_y, y, 1);
33060 xmlResetLastError();
33061 if (mem_base != xmlMemBlocks()) {
33062 printf("Leak of %d blocks found in xmlSchemaCompareValues",
33063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033064 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033065 printf(" %d", n_x);
33066 printf(" %d", n_y);
33067 printf("\n");
33068 }
33069 }
33070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033071 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033072#endif
33073
Daniel Veillard42595322004-11-08 10:52:06 +000033074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033075}
33076
33077
33078static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000033079test_xmlSchemaCompareValuesWhtsp(void) {
33080 int test_ret = 0;
33081
33082#if defined(LIBXML_SCHEMAS_ENABLED)
33083 int mem_base;
33084 int ret_val;
33085 xmlSchemaValPtr x; /* a first value */
33086 int n_x;
33087 xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
33088 int n_xws;
33089 xmlSchemaValPtr y; /* a second value */
33090 int n_y;
33091 xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
33092 int n_yws;
33093
33094 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
33095 for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
33096 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
33097 for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
33098 mem_base = xmlMemBlocks();
33099 x = gen_xmlSchemaValPtr(n_x, 0);
33100 xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
33101 y = gen_xmlSchemaValPtr(n_y, 2);
33102 yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
33103
33104 ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
33105 desret_int(ret_val);
33106 call_tests++;
33107 des_xmlSchemaValPtr(n_x, x, 0);
33108 des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
33109 des_xmlSchemaValPtr(n_y, y, 2);
33110 des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
33111 xmlResetLastError();
33112 if (mem_base != xmlMemBlocks()) {
33113 printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
33114 xmlMemBlocks() - mem_base);
33115 test_ret++;
33116 printf(" %d", n_x);
33117 printf(" %d", n_xws);
33118 printf(" %d", n_y);
33119 printf(" %d", n_yws);
33120 printf("\n");
33121 }
33122 }
33123 }
33124 }
33125 }
33126 function_tests++;
33127#endif
33128
33129 return(test_ret);
33130}
33131
33132
33133static int
Daniel Veillard57c000e2005-03-13 18:34:29 +000033134test_xmlSchemaCopyValue(void) {
33135 int test_ret = 0;
33136
33137
33138 /* missing type support */
33139 return(test_ret);
33140}
33141
33142
33143static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033144test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033146
William M. Brack21e4ef22005-01-02 09:53:13 +000033147#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033148 int mem_base;
33149 xmlSchemaTypePtr ret_val;
33150 xmlSchemaTypePtr type; /* the built-in simple type. */
33151 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033152
Daniel Veillard42595322004-11-08 10:52:06 +000033153 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33154 mem_base = xmlMemBlocks();
33155 type = gen_xmlSchemaTypePtr(n_type, 0);
33156
33157 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
33158 desret_xmlSchemaTypePtr(ret_val);
33159 call_tests++;
33160 des_xmlSchemaTypePtr(n_type, type, 0);
33161 xmlResetLastError();
33162 if (mem_base != xmlMemBlocks()) {
33163 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
33164 xmlMemBlocks() - mem_base);
33165 test_ret++;
33166 printf(" %d", n_type);
33167 printf("\n");
33168 }
33169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033170 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033171#endif
33172
Daniel Veillard42595322004-11-08 10:52:06 +000033173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033174}
33175
33176
33177static int
33178test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033180
William M. Brack21e4ef22005-01-02 09:53:13 +000033181#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033182 xmlSchemaTypePtr ret_val;
33183 xmlSchemaValType type; /* the type of the built in type */
33184 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033185
Daniel Veillard42595322004-11-08 10:52:06 +000033186 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
33187 type = gen_xmlSchemaValType(n_type, 0);
33188
33189 ret_val = xmlSchemaGetBuiltInType(type);
33190 desret_xmlSchemaTypePtr(ret_val);
33191 call_tests++;
33192 des_xmlSchemaValType(n_type, type, 0);
33193 xmlResetLastError();
33194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033196#endif
33197
Daniel Veillard42595322004-11-08 10:52:06 +000033198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199}
33200
33201
33202static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000033203test_xmlSchemaGetCanonValue(void) {
33204 int test_ret = 0;
33205
33206#if defined(LIBXML_SCHEMAS_ENABLED)
33207 int mem_base;
33208 int ret_val;
33209 xmlSchemaValPtr val; /* the precomputed value */
33210 int n_val;
33211 xmlChar ** retValue; /* the returned value */
33212 int n_retValue;
33213
33214 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33215 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
33216 mem_base = xmlMemBlocks();
33217 val = gen_xmlSchemaValPtr(n_val, 0);
33218 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
33219
33220 ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue);
33221 desret_int(ret_val);
33222 call_tests++;
33223 des_xmlSchemaValPtr(n_val, val, 0);
33224 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
33225 xmlResetLastError();
33226 if (mem_base != xmlMemBlocks()) {
33227 printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
33228 xmlMemBlocks() - mem_base);
33229 test_ret++;
33230 printf(" %d", n_val);
33231 printf(" %d", n_retValue);
33232 printf("\n");
33233 }
33234 }
33235 }
33236 function_tests++;
33237#endif
33238
33239 return(test_ret);
33240}
33241
33242
33243static int
Daniel Veillard99dd7632005-05-06 11:40:56 +000033244test_xmlSchemaGetCanonValueWhtsp(void) {
33245 int test_ret = 0;
33246
33247#if defined(LIBXML_SCHEMAS_ENABLED)
33248 int mem_base;
33249 int ret_val;
33250 xmlSchemaValPtr val; /* the precomputed value */
33251 int n_val;
33252 xmlChar ** retValue; /* the returned value */
33253 int n_retValue;
33254 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33255 int n_ws;
33256
33257 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33258 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
33259 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33260 mem_base = xmlMemBlocks();
33261 val = gen_xmlSchemaValPtr(n_val, 0);
33262 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
33263 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 2);
33264
33265 ret_val = xmlSchemaGetCanonValueWhtsp(val, (const xmlChar **)retValue, ws);
33266 desret_int(ret_val);
33267 call_tests++;
33268 des_xmlSchemaValPtr(n_val, val, 0);
33269 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
33270 des_xmlSchemaWhitespaceValueType(n_ws, ws, 2);
33271 xmlResetLastError();
33272 if (mem_base != xmlMemBlocks()) {
33273 printf("Leak of %d blocks found in xmlSchemaGetCanonValueWhtsp",
33274 xmlMemBlocks() - mem_base);
33275 test_ret++;
33276 printf(" %d", n_val);
33277 printf(" %d", n_retValue);
33278 printf(" %d", n_ws);
33279 printf("\n");
33280 }
33281 }
33282 }
33283 }
33284 function_tests++;
33285#endif
33286
33287 return(test_ret);
33288}
33289
33290
33291static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033292test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033294
William M. Brack21e4ef22005-01-02 09:53:13 +000033295#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000033296 int mem_base;
33297 unsigned long ret_val;
33298 xmlSchemaFacetPtr facet; /* an schemas type facet */
33299 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033300
William M. Brack094dd862004-11-14 14:28:34 +000033301 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33302 mem_base = xmlMemBlocks();
33303 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33304
33305 ret_val = xmlSchemaGetFacetValueAsULong(facet);
33306 desret_unsigned_long(ret_val);
33307 call_tests++;
33308 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33309 xmlResetLastError();
33310 if (mem_base != xmlMemBlocks()) {
33311 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
33312 xmlMemBlocks() - mem_base);
33313 test_ret++;
33314 printf(" %d", n_facet);
33315 printf("\n");
33316 }
33317 }
33318 function_tests++;
33319#endif
33320
Daniel Veillard42595322004-11-08 10:52:06 +000033321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033322}
33323
33324
33325static int
33326test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033328
William M. Brack21e4ef22005-01-02 09:53:13 +000033329#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033330 int mem_base;
33331 xmlSchemaTypePtr ret_val;
33332 xmlChar * name; /* the type name */
33333 int n_name;
33334 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
33335 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033336
Daniel Veillard42595322004-11-08 10:52:06 +000033337 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33338 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
33339 mem_base = xmlMemBlocks();
33340 name = gen_const_xmlChar_ptr(n_name, 0);
33341 ns = gen_const_xmlChar_ptr(n_ns, 1);
33342
William M. Brackf13f77f2004-11-12 16:03:48 +000033343 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000033344 desret_xmlSchemaTypePtr(ret_val);
33345 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033346 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
33347 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000033348 xmlResetLastError();
33349 if (mem_base != xmlMemBlocks()) {
33350 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
33351 xmlMemBlocks() - mem_base);
33352 test_ret++;
33353 printf(" %d", n_name);
33354 printf(" %d", n_ns);
33355 printf("\n");
33356 }
33357 }
33358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033359 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033360#endif
33361
Daniel Veillard42595322004-11-08 10:52:06 +000033362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033363}
33364
33365
33366static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033367test_xmlSchemaGetValType(void) {
33368 int test_ret = 0;
33369
33370#if defined(LIBXML_SCHEMAS_ENABLED)
33371 int mem_base;
33372 xmlSchemaValType ret_val;
Daniel Veillard771971f2005-04-02 10:49:51 +000033373 xmlSchemaValPtr val; /* a schemas value */
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033374 int n_val;
33375
33376 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33377 mem_base = xmlMemBlocks();
33378 val = gen_xmlSchemaValPtr(n_val, 0);
33379
33380 ret_val = xmlSchemaGetValType(val);
33381 desret_xmlSchemaValType(ret_val);
33382 call_tests++;
33383 des_xmlSchemaValPtr(n_val, val, 0);
33384 xmlResetLastError();
33385 if (mem_base != xmlMemBlocks()) {
33386 printf("Leak of %d blocks found in xmlSchemaGetValType",
33387 xmlMemBlocks() - mem_base);
33388 test_ret++;
33389 printf(" %d", n_val);
33390 printf("\n");
33391 }
33392 }
33393 function_tests++;
33394#endif
33395
33396 return(test_ret);
33397}
33398
33399
33400static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033401test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033403
William M. Brack21e4ef22005-01-02 09:53:13 +000033404#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000033405
33406
33407 xmlSchemaInitTypes();
33408 call_tests++;
33409 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033410 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033411#endif
33412
Daniel Veillard42595322004-11-08 10:52:06 +000033413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033414}
33415
33416
33417static int
33418test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033420
William M. Brack21e4ef22005-01-02 09:53:13 +000033421#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033422 int mem_base;
33423 int ret_val;
33424 xmlSchemaTypePtr type; /* the built-in type */
33425 int n_type;
33426 int facetType; /* the facet type */
33427 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033428
Daniel Veillardce682bc2004-11-05 17:22:25 +000033429 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33430 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
33431 mem_base = xmlMemBlocks();
33432 type = gen_xmlSchemaTypePtr(n_type, 0);
33433 facetType = gen_int(n_facetType, 1);
33434
33435 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
33436 desret_int(ret_val);
33437 call_tests++;
33438 des_xmlSchemaTypePtr(n_type, type, 0);
33439 des_int(n_facetType, facetType, 1);
33440 xmlResetLastError();
33441 if (mem_base != xmlMemBlocks()) {
33442 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
33443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033445 printf(" %d", n_type);
33446 printf(" %d", n_facetType);
33447 printf("\n");
33448 }
33449 }
33450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033451 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033452#endif
33453
Daniel Veillard42595322004-11-08 10:52:06 +000033454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033455}
33456
33457
33458static int
33459test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461
33462
33463 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033465}
33466
Daniel Veillardb5839c32005-02-19 18:27:14 +000033467
33468static int
33469test_xmlSchemaNewNOTATIONValue(void) {
33470 int test_ret = 0;
33471
33472
33473 /* missing type support */
33474 return(test_ret);
33475}
33476
33477
33478static int
Daniel Veillard81562d22005-06-15 13:27:56 +000033479test_xmlSchemaNewQNameValue(void) {
33480 int test_ret = 0;
33481
33482
33483 /* missing type support */
33484 return(test_ret);
33485}
33486
33487
33488static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000033489test_xmlSchemaNewStringValue(void) {
33490 int test_ret = 0;
33491
33492
33493 /* missing type support */
33494 return(test_ret);
33495}
33496
Daniel Veillarda521d282004-11-09 14:59:59 +000033497#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033498
Daniel Veillardce682bc2004-11-05 17:22:25 +000033499#define gen_nb_xmlSchemaValPtr_ptr 1
33500static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33501 return(NULL);
33502}
33503static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33504}
Daniel Veillarda521d282004-11-09 14:59:59 +000033505#endif
33506
Daniel Veillardce682bc2004-11-05 17:22:25 +000033507
Daniel Veillardd93f6252004-11-02 15:53:51 +000033508static int
33509test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511
William M. Brack21e4ef22005-01-02 09:53:13 +000033512#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033513 int mem_base;
33514 int ret_val;
33515 xmlSchemaTypePtr type; /* the predefined type */
33516 int n_type;
33517 xmlChar * value; /* the value to check */
33518 int n_value;
33519 xmlSchemaValPtr * val; /* the return computed value */
33520 int n_val;
33521 xmlNodePtr node; /* the node containing the value */
33522 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033523
Daniel Veillardce682bc2004-11-05 17:22:25 +000033524 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33525 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33526 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33527 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33528 mem_base = xmlMemBlocks();
33529 type = gen_xmlSchemaTypePtr(n_type, 0);
33530 value = gen_const_xmlChar_ptr(n_value, 1);
33531 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33532 node = gen_xmlNodePtr(n_node, 3);
33533
William M. Brackf13f77f2004-11-12 16:03:48 +000033534 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033535 desret_int(ret_val);
33536 call_tests++;
33537 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033538 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033539 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33540 des_xmlNodePtr(n_node, node, 3);
33541 xmlResetLastError();
33542 if (mem_base != xmlMemBlocks()) {
33543 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033545 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033546 printf(" %d", n_type);
33547 printf(" %d", n_value);
33548 printf(" %d", n_val);
33549 printf(" %d", n_node);
33550 printf("\n");
33551 }
33552 }
33553 }
33554 }
33555 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033556 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033557#endif
33558
Daniel Veillard42595322004-11-08 10:52:06 +000033559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033560}
33561
33562
33563static int
33564test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033566
William M. Brack21e4ef22005-01-02 09:53:13 +000033567#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033568 int mem_base;
33569 int ret_val;
33570 xmlSchemaTypePtr type; /* the predefined type */
33571 int n_type;
33572 xmlChar * value; /* the value to check */
33573 int n_value;
33574 xmlSchemaValPtr * val; /* the return computed value */
33575 int n_val;
33576 xmlNodePtr node; /* the node containing the value */
33577 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033578
Daniel Veillardce682bc2004-11-05 17:22:25 +000033579 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33580 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33581 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33582 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33583 mem_base = xmlMemBlocks();
33584 type = gen_xmlSchemaTypePtr(n_type, 0);
33585 value = gen_const_xmlChar_ptr(n_value, 1);
33586 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33587 node = gen_xmlNodePtr(n_node, 3);
33588
William M. Brackf13f77f2004-11-12 16:03:48 +000033589 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033590 desret_int(ret_val);
33591 call_tests++;
33592 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033593 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033594 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33595 des_xmlNodePtr(n_node, node, 3);
33596 xmlResetLastError();
33597 if (mem_base != xmlMemBlocks()) {
33598 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033600 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033601 printf(" %d", n_type);
33602 printf(" %d", n_value);
33603 printf(" %d", n_val);
33604 printf(" %d", n_node);
33605 printf("\n");
33606 }
33607 }
33608 }
33609 }
33610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033611 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033612#endif
33613
Daniel Veillard42595322004-11-08 10:52:06 +000033614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033615}
33616
33617
33618static int
33619test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033621
William M. Brack21e4ef22005-01-02 09:53:13 +000033622#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033623 int mem_base;
33624 int ret_val;
33625 xmlSchemaTypePtr base; /* the base type */
33626 int n_base;
33627 xmlSchemaFacetPtr facet; /* the facet to check */
33628 int n_facet;
33629 xmlChar * value; /* the lexical repr of the value to validate */
33630 int n_value;
33631 xmlSchemaValPtr val; /* the precomputed value */
33632 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033633
Daniel Veillardce682bc2004-11-05 17:22:25 +000033634 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33635 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33636 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33637 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33638 mem_base = xmlMemBlocks();
33639 base = gen_xmlSchemaTypePtr(n_base, 0);
33640 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33641 value = gen_const_xmlChar_ptr(n_value, 2);
33642 val = gen_xmlSchemaValPtr(n_val, 3);
33643
William M. Brackf13f77f2004-11-12 16:03:48 +000033644 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033645 desret_int(ret_val);
33646 call_tests++;
33647 des_xmlSchemaTypePtr(n_base, base, 0);
33648 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033649 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033650 des_xmlSchemaValPtr(n_val, val, 3);
33651 xmlResetLastError();
33652 if (mem_base != xmlMemBlocks()) {
33653 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033655 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033656 printf(" %d", n_base);
33657 printf(" %d", n_facet);
33658 printf(" %d", n_value);
33659 printf(" %d", n_val);
33660 printf("\n");
33661 }
33662 }
33663 }
33664 }
33665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033666 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033667#endif
33668
Daniel Veillard42595322004-11-08 10:52:06 +000033669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033670}
33671
33672
33673static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033674test_xmlSchemaValidateFacetWhtsp(void) {
33675 int test_ret = 0;
33676
33677#if defined(LIBXML_SCHEMAS_ENABLED)
33678 int mem_base;
33679 int ret_val;
33680 xmlSchemaFacetPtr facet; /* the facet to check */
33681 int n_facet;
33682 xmlSchemaWhitespaceValueType fws; /* the whitespace type of the facet's value */
33683 int n_fws;
33684 xmlSchemaValType valType; /* the built-in type of the value */
33685 int n_valType;
33686 xmlChar * value; /* the lexical (or normalized for pattern) repr of the value to validate */
33687 int n_value;
33688 xmlSchemaValPtr val; /* the precomputed value */
33689 int n_val;
33690 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33691 int n_ws;
33692
33693 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33694 for (n_fws = 0;n_fws < gen_nb_xmlSchemaWhitespaceValueType;n_fws++) {
33695 for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
33696 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33697 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33698 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33699 mem_base = xmlMemBlocks();
33700 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33701 fws = gen_xmlSchemaWhitespaceValueType(n_fws, 1);
33702 valType = gen_xmlSchemaValType(n_valType, 2);
33703 value = gen_const_xmlChar_ptr(n_value, 3);
33704 val = gen_xmlSchemaValPtr(n_val, 4);
33705 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
33706
33707 ret_val = xmlSchemaValidateFacetWhtsp(facet, fws, valType, (const xmlChar *)value, val, ws);
33708 desret_int(ret_val);
33709 call_tests++;
33710 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33711 des_xmlSchemaWhitespaceValueType(n_fws, fws, 1);
33712 des_xmlSchemaValType(n_valType, valType, 2);
33713 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
33714 des_xmlSchemaValPtr(n_val, val, 4);
33715 des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
33716 xmlResetLastError();
33717 if (mem_base != xmlMemBlocks()) {
33718 printf("Leak of %d blocks found in xmlSchemaValidateFacetWhtsp",
33719 xmlMemBlocks() - mem_base);
33720 test_ret++;
33721 printf(" %d", n_facet);
33722 printf(" %d", n_fws);
33723 printf(" %d", n_valType);
33724 printf(" %d", n_value);
33725 printf(" %d", n_val);
33726 printf(" %d", n_ws);
33727 printf("\n");
33728 }
33729 }
33730 }
33731 }
33732 }
33733 }
33734 }
33735 function_tests++;
33736#endif
33737
33738 return(test_ret);
33739}
33740
33741
33742static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033745
William M. Brack21e4ef22005-01-02 09:53:13 +000033746#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033747 int mem_base;
33748 int ret_val;
33749 xmlSchemaTypePtr type; /* the built-in type */
33750 int n_type;
33751 xmlSchemaFacetPtr facet; /* the facet to check */
33752 int n_facet;
33753 xmlChar * value; /* the lexical repr. of the value to be validated */
33754 int n_value;
33755 xmlSchemaValPtr val; /* the precomputed value */
33756 int n_val;
33757 unsigned long * length; /* the actual length of the value */
33758 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033759
Daniel Veillardce682bc2004-11-05 17:22:25 +000033760 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33761 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33762 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33763 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33764 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33765 mem_base = xmlMemBlocks();
33766 type = gen_xmlSchemaTypePtr(n_type, 0);
33767 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33768 value = gen_const_xmlChar_ptr(n_value, 2);
33769 val = gen_xmlSchemaValPtr(n_val, 3);
33770 length = gen_unsigned_long_ptr(n_length, 4);
33771
William M. Brackf13f77f2004-11-12 16:03:48 +000033772 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033773 desret_int(ret_val);
33774 call_tests++;
33775 des_xmlSchemaTypePtr(n_type, type, 0);
33776 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033777 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033778 des_xmlSchemaValPtr(n_val, val, 3);
33779 des_unsigned_long_ptr(n_length, length, 4);
33780 xmlResetLastError();
33781 if (mem_base != xmlMemBlocks()) {
33782 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033784 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033785 printf(" %d", n_type);
33786 printf(" %d", n_facet);
33787 printf(" %d", n_value);
33788 printf(" %d", n_val);
33789 printf(" %d", n_length);
33790 printf("\n");
33791 }
33792 }
33793 }
33794 }
33795 }
33796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033797 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033798#endif
33799
Daniel Veillard42595322004-11-08 10:52:06 +000033800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033801}
33802
33803
33804static int
Daniel Veillard5d4644e2005-04-01 13:11:58 +000033805test_xmlSchemaValidateLengthFacetWhtsp(void) {
33806 int test_ret = 0;
33807
33808#if defined(LIBXML_SCHEMAS_ENABLED)
33809 int mem_base;
33810 int ret_val;
33811 xmlSchemaFacetPtr facet; /* the facet to check */
33812 int n_facet;
33813 xmlSchemaValType valType; /* the built-in type */
33814 int n_valType;
33815 xmlChar * value; /* the lexical repr. of the value to be validated */
33816 int n_value;
33817 xmlSchemaValPtr val; /* the precomputed value */
33818 int n_val;
33819 unsigned long * length; /* the actual length of the value */
33820 int n_length;
33821 xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
33822 int n_ws;
33823
33824 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33825 for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
33826 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33827 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33828 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33829 for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
33830 mem_base = xmlMemBlocks();
33831 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33832 valType = gen_xmlSchemaValType(n_valType, 1);
33833 value = gen_const_xmlChar_ptr(n_value, 2);
33834 val = gen_xmlSchemaValPtr(n_val, 3);
33835 length = gen_unsigned_long_ptr(n_length, 4);
33836 ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
33837
33838 ret_val = xmlSchemaValidateLengthFacetWhtsp(facet, valType, (const xmlChar *)value, val, length, ws);
33839 desret_int(ret_val);
33840 call_tests++;
33841 des_xmlSchemaFacetPtr(n_facet, facet, 0);
33842 des_xmlSchemaValType(n_valType, valType, 1);
33843 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
33844 des_xmlSchemaValPtr(n_val, val, 3);
33845 des_unsigned_long_ptr(n_length, length, 4);
33846 des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
33847 xmlResetLastError();
33848 if (mem_base != xmlMemBlocks()) {
33849 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacetWhtsp",
33850 xmlMemBlocks() - mem_base);
33851 test_ret++;
33852 printf(" %d", n_facet);
33853 printf(" %d", n_valType);
33854 printf(" %d", n_value);
33855 printf(" %d", n_val);
33856 printf(" %d", n_length);
33857 printf(" %d", n_ws);
33858 printf("\n");
33859 }
33860 }
33861 }
33862 }
33863 }
33864 }
33865 }
33866 function_tests++;
33867#endif
33868
33869 return(test_ret);
33870}
33871
33872
33873static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033874test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033876
William M. Brack21e4ef22005-01-02 09:53:13 +000033877#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033878 int mem_base;
33879 int ret_val;
33880 xmlSchemaFacetPtr facet; /* the facet to check */
33881 int n_facet;
33882 xmlChar * value; /* the lexical repr of the value to validate */
33883 int n_value;
33884 unsigned long actualLen; /* the number of list items */
33885 int n_actualLen;
33886 unsigned long * expectedLen; /* the resulting expected number of list items */
33887 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033888
Daniel Veillardce682bc2004-11-05 17:22:25 +000033889 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33890 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33891 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33892 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33893 mem_base = xmlMemBlocks();
33894 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33895 value = gen_const_xmlChar_ptr(n_value, 1);
33896 actualLen = gen_unsigned_long(n_actualLen, 2);
33897 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33898
William M. Brackf13f77f2004-11-12 16:03:48 +000033899 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033900 desret_int(ret_val);
33901 call_tests++;
33902 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033903 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033904 des_unsigned_long(n_actualLen, actualLen, 2);
33905 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33906 xmlResetLastError();
33907 if (mem_base != xmlMemBlocks()) {
33908 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033910 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033911 printf(" %d", n_facet);
33912 printf(" %d", n_value);
33913 printf(" %d", n_actualLen);
33914 printf(" %d", n_expectedLen);
33915 printf("\n");
33916 }
33917 }
33918 }
33919 }
33920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033921 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033922#endif
33923
Daniel Veillard42595322004-11-08 10:52:06 +000033924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033925}
33926
33927
33928static int
33929test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033931
William M. Brack21e4ef22005-01-02 09:53:13 +000033932#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033933 int mem_base;
33934 int ret_val;
33935 xmlSchemaTypePtr type; /* the predefined type */
33936 int n_type;
33937 xmlChar * value; /* the value to check */
33938 int n_value;
33939 xmlSchemaValPtr * val; /* the return computed value */
33940 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941
Daniel Veillardce682bc2004-11-05 17:22:25 +000033942 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33943 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33944 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33945 mem_base = xmlMemBlocks();
33946 type = gen_xmlSchemaTypePtr(n_type, 0);
33947 value = gen_const_xmlChar_ptr(n_value, 1);
33948 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33949
William M. Brackf13f77f2004-11-12 16:03:48 +000033950 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033951 desret_int(ret_val);
33952 call_tests++;
33953 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033954 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033955 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33956 xmlResetLastError();
33957 if (mem_base != xmlMemBlocks()) {
33958 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033960 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033961 printf(" %d", n_type);
33962 printf(" %d", n_value);
33963 printf(" %d", n_val);
33964 printf("\n");
33965 }
33966 }
33967 }
33968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033969 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033970#endif
33971
Daniel Veillard42595322004-11-08 10:52:06 +000033972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033973}
33974
Daniel Veillard91b955c2004-12-10 10:26:42 +000033975
33976static int
Daniel Veillard81562d22005-06-15 13:27:56 +000033977test_xmlSchemaValueAppend(void) {
33978 int test_ret = 0;
33979
33980#if defined(LIBXML_SCHEMAS_ENABLED)
33981 int mem_base;
33982 int ret_val;
Daniel Veillard95175012005-07-03 16:09:51 +000033983 xmlSchemaValPtr prev; /* the value */
Daniel Veillard81562d22005-06-15 13:27:56 +000033984 int n_prev;
Daniel Veillard95175012005-07-03 16:09:51 +000033985 xmlSchemaValPtr cur; /* the value to be appended */
Daniel Veillard81562d22005-06-15 13:27:56 +000033986 int n_cur;
33987
33988 for (n_prev = 0;n_prev < gen_nb_xmlSchemaValPtr;n_prev++) {
33989 for (n_cur = 0;n_cur < gen_nb_xmlSchemaValPtr;n_cur++) {
33990 mem_base = xmlMemBlocks();
33991 prev = gen_xmlSchemaValPtr(n_prev, 0);
33992 cur = gen_xmlSchemaValPtr(n_cur, 1);
33993
33994 ret_val = xmlSchemaValueAppend(prev, cur);
33995 desret_int(ret_val);
33996 call_tests++;
33997 des_xmlSchemaValPtr(n_prev, prev, 0);
33998 des_xmlSchemaValPtr(n_cur, cur, 1);
33999 xmlResetLastError();
34000 if (mem_base != xmlMemBlocks()) {
34001 printf("Leak of %d blocks found in xmlSchemaValueAppend",
34002 xmlMemBlocks() - mem_base);
34003 test_ret++;
34004 printf(" %d", n_prev);
34005 printf(" %d", n_cur);
34006 printf("\n");
34007 }
34008 }
34009 }
34010 function_tests++;
34011#endif
34012
34013 return(test_ret);
34014}
34015
34016
34017static int
34018test_xmlSchemaValueGetAsBoolean(void) {
34019 int test_ret = 0;
34020
34021#if defined(LIBXML_SCHEMAS_ENABLED)
34022 int mem_base;
34023 int ret_val;
Daniel Veillard95175012005-07-03 16:09:51 +000034024 xmlSchemaValPtr val; /* the value */
Daniel Veillard81562d22005-06-15 13:27:56 +000034025 int n_val;
34026
34027 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
34028 mem_base = xmlMemBlocks();
34029 val = gen_xmlSchemaValPtr(n_val, 0);
34030
34031 ret_val = xmlSchemaValueGetAsBoolean(val);
34032 desret_int(ret_val);
34033 call_tests++;
34034 des_xmlSchemaValPtr(n_val, val, 0);
34035 xmlResetLastError();
34036 if (mem_base != xmlMemBlocks()) {
34037 printf("Leak of %d blocks found in xmlSchemaValueGetAsBoolean",
34038 xmlMemBlocks() - mem_base);
34039 test_ret++;
34040 printf(" %d", n_val);
34041 printf("\n");
34042 }
34043 }
34044 function_tests++;
34045#endif
34046
34047 return(test_ret);
34048}
34049
34050
34051static int
34052test_xmlSchemaValueGetAsString(void) {
34053 int test_ret = 0;
34054
34055#if defined(LIBXML_SCHEMAS_ENABLED)
34056 int mem_base;
34057 const xmlChar * ret_val;
Daniel Veillard95175012005-07-03 16:09:51 +000034058 xmlSchemaValPtr val; /* the value */
Daniel Veillard81562d22005-06-15 13:27:56 +000034059 int n_val;
34060
34061 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
34062 mem_base = xmlMemBlocks();
34063 val = gen_xmlSchemaValPtr(n_val, 0);
34064
34065 ret_val = xmlSchemaValueGetAsString(val);
34066 desret_const_xmlChar_ptr(ret_val);
34067 call_tests++;
34068 des_xmlSchemaValPtr(n_val, val, 0);
34069 xmlResetLastError();
34070 if (mem_base != xmlMemBlocks()) {
34071 printf("Leak of %d blocks found in xmlSchemaValueGetAsString",
34072 xmlMemBlocks() - mem_base);
34073 test_ret++;
34074 printf(" %d", n_val);
34075 printf("\n");
34076 }
34077 }
34078 function_tests++;
34079#endif
34080
34081 return(test_ret);
34082}
34083
34084
34085static int
34086test_xmlSchemaValueGetNext(void) {
34087 int test_ret = 0;
34088
34089
34090 /* missing type support */
34091 return(test_ret);
34092}
34093
34094
34095static int
Daniel Veillard91b955c2004-12-10 10:26:42 +000034096test_xmlSchemaWhiteSpaceReplace(void) {
34097 int test_ret = 0;
34098
William M. Brack21e4ef22005-01-02 09:53:13 +000034099#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000034100 int mem_base;
34101 xmlChar * ret_val;
34102 xmlChar * value; /* a value */
34103 int n_value;
34104
34105 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
34106 mem_base = xmlMemBlocks();
34107 value = gen_const_xmlChar_ptr(n_value, 0);
34108
34109 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
34110 desret_xmlChar_ptr(ret_val);
34111 call_tests++;
34112 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
34113 xmlResetLastError();
34114 if (mem_base != xmlMemBlocks()) {
34115 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
34116 xmlMemBlocks() - mem_base);
34117 test_ret++;
34118 printf(" %d", n_value);
34119 printf("\n");
34120 }
34121 }
34122 function_tests++;
34123#endif
34124
34125 return(test_ret);
34126}
34127
Daniel Veillardd93f6252004-11-02 15:53:51 +000034128static int
34129test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034131
Daniel Veillard81562d22005-06-15 13:27:56 +000034132 if (quiet == 0) printf("Testing xmlschemastypes : 26 of 34 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034133 test_ret += test_xmlSchemaCheckFacet();
34134 test_ret += test_xmlSchemaCleanupTypes();
34135 test_ret += test_xmlSchemaCollapseString();
34136 test_ret += test_xmlSchemaCompareValues();
Daniel Veillardb5839c32005-02-19 18:27:14 +000034137 test_ret += test_xmlSchemaCompareValuesWhtsp();
Daniel Veillard57c000e2005-03-13 18:34:29 +000034138 test_ret += test_xmlSchemaCopyValue();
Daniel Veillard42595322004-11-08 10:52:06 +000034139 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
34140 test_ret += test_xmlSchemaGetBuiltInType();
Daniel Veillardb5839c32005-02-19 18:27:14 +000034141 test_ret += test_xmlSchemaGetCanonValue();
Daniel Veillard99dd7632005-05-06 11:40:56 +000034142 test_ret += test_xmlSchemaGetCanonValueWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000034143 test_ret += test_xmlSchemaGetFacetValueAsULong();
34144 test_ret += test_xmlSchemaGetPredefinedType();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000034145 test_ret += test_xmlSchemaGetValType();
Daniel Veillard42595322004-11-08 10:52:06 +000034146 test_ret += test_xmlSchemaInitTypes();
34147 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
34148 test_ret += test_xmlSchemaNewFacet();
Daniel Veillardb5839c32005-02-19 18:27:14 +000034149 test_ret += test_xmlSchemaNewNOTATIONValue();
Daniel Veillard81562d22005-06-15 13:27:56 +000034150 test_ret += test_xmlSchemaNewQNameValue();
Daniel Veillardb5839c32005-02-19 18:27:14 +000034151 test_ret += test_xmlSchemaNewStringValue();
Daniel Veillard42595322004-11-08 10:52:06 +000034152 test_ret += test_xmlSchemaValPredefTypeNode();
34153 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
34154 test_ret += test_xmlSchemaValidateFacet();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000034155 test_ret += test_xmlSchemaValidateFacetWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000034156 test_ret += test_xmlSchemaValidateLengthFacet();
Daniel Veillard5d4644e2005-04-01 13:11:58 +000034157 test_ret += test_xmlSchemaValidateLengthFacetWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000034158 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
34159 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard81562d22005-06-15 13:27:56 +000034160 test_ret += test_xmlSchemaValueAppend();
34161 test_ret += test_xmlSchemaValueGetAsBoolean();
34162 test_ret += test_xmlSchemaValueGetAsString();
34163 test_ret += test_xmlSchemaValueGetNext();
Daniel Veillard91b955c2004-12-10 10:26:42 +000034164 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034165
Daniel Veillard42595322004-11-08 10:52:06 +000034166 if (test_ret != 0)
34167 printf("Module xmlschemastypes: %d errors\n", test_ret);
34168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034169}
34170
34171static int
34172test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034174
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034175 int mem_base;
34176 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034177 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034178 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034179
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034180 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
34181 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034182 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034183
William M. Brackf13f77f2004-11-12 16:03:48 +000034184 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034185 desret_xmlChar_ptr(ret_val);
34186 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034187 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034188 xmlResetLastError();
34189 if (mem_base != xmlMemBlocks()) {
34190 printf("Leak of %d blocks found in xmlCharStrdup",
34191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034192 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034193 printf(" %d", n_cur);
34194 printf("\n");
34195 }
34196 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034197 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034198
Daniel Veillard42595322004-11-08 10:52:06 +000034199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034200}
34201
34202
34203static int
34204test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034206
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034207 int mem_base;
34208 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034209 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034210 int n_cur;
34211 int len; /* the len of @cur */
34212 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034213
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034214 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
34215 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034217 cur = gen_const_char_ptr(n_cur, 0);
34218 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034219
William M. Brackf13f77f2004-11-12 16:03:48 +000034220 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034221 desret_xmlChar_ptr(ret_val);
34222 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034223 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034224 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034225 xmlResetLastError();
34226 if (mem_base != xmlMemBlocks()) {
34227 printf("Leak of %d blocks found in xmlCharStrndup",
34228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034229 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034230 printf(" %d", n_cur);
34231 printf(" %d", n_len);
34232 printf("\n");
34233 }
34234 }
34235 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034237
Daniel Veillard42595322004-11-08 10:52:06 +000034238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034239}
34240
34241
34242static int
34243test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034245
Daniel Veillardce682bc2004-11-05 17:22:25 +000034246 int mem_base;
34247 int ret_val;
34248 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
34249 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034250
Daniel Veillardce682bc2004-11-05 17:22:25 +000034251 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
34252 mem_base = xmlMemBlocks();
34253 utf = gen_const_unsigned_char_ptr(n_utf, 0);
34254
William M. Brackf13f77f2004-11-12 16:03:48 +000034255 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034256 desret_int(ret_val);
34257 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034258 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034259 xmlResetLastError();
34260 if (mem_base != xmlMemBlocks()) {
34261 printf("Leak of %d blocks found in xmlCheckUTF8",
34262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034263 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034264 printf(" %d", n_utf);
34265 printf("\n");
34266 }
34267 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000034268 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034269
Daniel Veillard42595322004-11-08 10:52:06 +000034270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034271}
34272
34273
34274static int
34275test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034277
Daniel Veillardce682bc2004-11-05 17:22:25 +000034278 int mem_base;
34279 int ret_val;
34280 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
34281 int n_utf;
34282 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. */
34283 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034284
Daniel Veillardce682bc2004-11-05 17:22:25 +000034285 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
34286 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
34287 mem_base = xmlMemBlocks();
34288 utf = gen_const_unsigned_char_ptr(n_utf, 0);
34289 len = gen_int_ptr(n_len, 1);
34290
William M. Brackf13f77f2004-11-12 16:03:48 +000034291 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034292 desret_int(ret_val);
34293 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034294 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000034295 des_int_ptr(n_len, len, 1);
34296 xmlResetLastError();
34297 if (mem_base != xmlMemBlocks()) {
34298 printf("Leak of %d blocks found in xmlGetUTF8Char",
34299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034300 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034301 printf(" %d", n_utf);
34302 printf(" %d", n_len);
34303 printf("\n");
34304 }
34305 }
34306 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000034307 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034308
Daniel Veillard42595322004-11-08 10:52:06 +000034309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034310}
34311
34312
34313static int
34314test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034316
34317 int mem_base;
34318 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034319 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034320 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034321 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034322 int n_str2;
34323
34324 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34325 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034327 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34328 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034329
William M. Brackf13f77f2004-11-12 16:03:48 +000034330 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034331 desret_int(ret_val);
34332 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034333 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34334 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034335 xmlResetLastError();
34336 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034337 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034339 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034340 printf(" %d", n_str1);
34341 printf(" %d", n_str2);
34342 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034343 }
34344 }
34345 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034347
Daniel Veillard42595322004-11-08 10:52:06 +000034348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034349}
34350
34351
34352static int
34353test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034355
34356
34357 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000034358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034359}
34360
34361
34362static int
34363test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034365
34366 int mem_base;
34367 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034368 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034369 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034370 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034371 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034372 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034373 int n_str;
34374
34375 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
34376 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
34377 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034379 pref = gen_const_xmlChar_ptr(n_pref, 0);
34380 name = gen_const_xmlChar_ptr(n_name, 1);
34381 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034382
William M. Brackf13f77f2004-11-12 16:03:48 +000034383 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034384 desret_int(ret_val);
34385 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034386 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
34387 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
34388 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034389 xmlResetLastError();
34390 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034391 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034393 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034394 printf(" %d", n_pref);
34395 printf(" %d", n_name);
34396 printf(" %d", n_str);
34397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034398 }
34399 }
34400 }
34401 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034403
Daniel Veillard42595322004-11-08 10:52:06 +000034404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034405}
34406
34407
34408static int
34409test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034411
34412
34413 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000034414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034415}
34416
34417
34418static int
34419test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034421
34422 int mem_base;
34423 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034424 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034425 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034426 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034427 int n_str2;
34428
34429 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34430 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034432 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34433 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034434
William M. Brackf13f77f2004-11-12 16:03:48 +000034435 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034436 desret_int(ret_val);
34437 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034438 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34439 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034440 xmlResetLastError();
34441 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034442 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034444 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034445 printf(" %d", n_str1);
34446 printf(" %d", n_str2);
34447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034448 }
34449 }
34450 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034452
Daniel Veillard42595322004-11-08 10:52:06 +000034453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034454}
34455
34456
34457static int
34458test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034460
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034461 int mem_base;
34462 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034463 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034464 int n_str;
34465 xmlChar * val; /* the xmlChar to search (needle) */
34466 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034467
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034468 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34469 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
34470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034471 str = gen_const_xmlChar_ptr(n_str, 0);
34472 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034473
William M. Brackf13f77f2004-11-12 16:03:48 +000034474 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034475 desret_const_xmlChar_ptr(ret_val);
34476 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034477 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034478 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034479 xmlResetLastError();
34480 if (mem_base != xmlMemBlocks()) {
34481 printf("Leak of %d blocks found in xmlStrcasestr",
34482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034483 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034484 printf(" %d", n_str);
34485 printf(" %d", n_val);
34486 printf("\n");
34487 }
34488 }
34489 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034491
Daniel Veillard42595322004-11-08 10:52:06 +000034492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034493}
34494
34495
34496static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034497test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034499
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034500 int mem_base;
34501 const xmlChar * ret_val;
34502 xmlChar * str; /* the xmlChar * array */
34503 int n_str;
34504 xmlChar val; /* the xmlChar to search */
34505 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034506
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034507 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34508 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
34509 mem_base = xmlMemBlocks();
34510 str = gen_const_xmlChar_ptr(n_str, 0);
34511 val = gen_xmlChar(n_val, 1);
34512
William M. Brackf13f77f2004-11-12 16:03:48 +000034513 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034514 desret_const_xmlChar_ptr(ret_val);
34515 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034516 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034517 des_xmlChar(n_val, val, 1);
34518 xmlResetLastError();
34519 if (mem_base != xmlMemBlocks()) {
34520 printf("Leak of %d blocks found in xmlStrchr",
34521 xmlMemBlocks() - mem_base);
34522 test_ret++;
34523 printf(" %d", n_str);
34524 printf(" %d", n_val);
34525 printf("\n");
34526 }
34527 }
34528 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000034529 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034530
Daniel Veillard42595322004-11-08 10:52:06 +000034531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034532}
34533
34534
34535static int
34536test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034538
34539 int mem_base;
34540 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034541 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034542 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034543 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034544 int n_str2;
34545
34546 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34547 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034549 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34550 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034551
William M. Brackf13f77f2004-11-12 16:03:48 +000034552 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034553 desret_int(ret_val);
34554 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034555 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34556 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034557 xmlResetLastError();
34558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034559 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034562 printf(" %d", n_str1);
34563 printf(" %d", n_str2);
34564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034565 }
34566 }
34567 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034569
Daniel Veillard42595322004-11-08 10:52:06 +000034570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034571}
34572
34573
34574static int
34575test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034577
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034578 int mem_base;
34579 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034580 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034581 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034582
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034583 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34584 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034585 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034586
William M. Brackf13f77f2004-11-12 16:03:48 +000034587 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034588 desret_xmlChar_ptr(ret_val);
34589 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034590 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034591 xmlResetLastError();
34592 if (mem_base != xmlMemBlocks()) {
34593 printf("Leak of %d blocks found in xmlStrdup",
34594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034595 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034596 printf(" %d", n_cur);
34597 printf("\n");
34598 }
34599 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034601
Daniel Veillard42595322004-11-08 10:52:06 +000034602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034603}
34604
34605
34606static int
34607test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034609
34610 int mem_base;
34611 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034612 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034613 int n_str;
34614
34615 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034617 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034618
William M. Brackf13f77f2004-11-12 16:03:48 +000034619 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034620 desret_int(ret_val);
34621 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034622 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034623 xmlResetLastError();
34624 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034625 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034627 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034628 printf(" %d", n_str);
34629 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034630 }
34631 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034632 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034633
Daniel Veillard42595322004-11-08 10:52:06 +000034634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034635}
34636
34637
34638static int
34639test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034641
34642 int mem_base;
34643 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034644 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034645 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034646 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034647 int n_str2;
34648 int len; /* the max comparison length */
34649 int n_len;
34650
34651 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34652 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34653 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034655 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34656 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34657 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034658
William M. Brackf13f77f2004-11-12 16:03:48 +000034659 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034660 desret_int(ret_val);
34661 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034662 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34663 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034664 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034665 xmlResetLastError();
34666 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034667 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034669 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034670 printf(" %d", n_str1);
34671 printf(" %d", n_str2);
34672 printf(" %d", n_len);
34673 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034674 }
34675 }
34676 }
34677 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034678 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034679
Daniel Veillard42595322004-11-08 10:52:06 +000034680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034681}
34682
34683
34684static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034685test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034687
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034688 int mem_base;
34689 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034690 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034691 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034692 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034693 int n_str2;
34694 int len; /* the len of @str2 */
34695 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034696
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034697 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34698 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34699 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34700 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034701 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34702 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34703 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034704
William M. Brackf13f77f2004-11-12 16:03:48 +000034705 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034706 desret_xmlChar_ptr(ret_val);
34707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034708 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34709 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034710 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034711 xmlResetLastError();
34712 if (mem_base != xmlMemBlocks()) {
34713 printf("Leak of %d blocks found in xmlStrncatNew",
34714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034715 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034716 printf(" %d", n_str1);
34717 printf(" %d", n_str2);
34718 printf(" %d", n_len);
34719 printf("\n");
34720 }
34721 }
34722 }
34723 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034725
Daniel Veillard42595322004-11-08 10:52:06 +000034726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034727}
34728
34729
34730static int
34731test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034733
34734 int mem_base;
34735 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034736 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034737 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034738 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034739 int n_str2;
34740 int len; /* the max comparison length */
34741 int n_len;
34742
34743 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34744 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34745 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034747 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34748 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34749 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034750
William M. Brackf13f77f2004-11-12 16:03:48 +000034751 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034752 desret_int(ret_val);
34753 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034754 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34755 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034756 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034757 xmlResetLastError();
34758 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034759 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034761 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034762 printf(" %d", n_str1);
34763 printf(" %d", n_str2);
34764 printf(" %d", n_len);
34765 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034766 }
34767 }
34768 }
34769 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034770 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034771
Daniel Veillard42595322004-11-08 10:52:06 +000034772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034773}
34774
34775
34776static int
34777test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034779
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034780 int mem_base;
34781 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034782 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034783 int n_cur;
34784 int len; /* the len of @cur */
34785 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034786
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034787 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34788 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034790 cur = gen_const_xmlChar_ptr(n_cur, 0);
34791 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034792
William M. Brackf13f77f2004-11-12 16:03:48 +000034793 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034794 desret_xmlChar_ptr(ret_val);
34795 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034796 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034797 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034798 xmlResetLastError();
34799 if (mem_base != xmlMemBlocks()) {
34800 printf("Leak of %d blocks found in xmlStrndup",
34801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034802 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034803 printf(" %d", n_cur);
34804 printf(" %d", n_len);
34805 printf("\n");
34806 }
34807 }
34808 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034809 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034810
Daniel Veillard42595322004-11-08 10:52:06 +000034811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034812}
34813
34814
34815static int
34816test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034818
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034819 int mem_base;
34820 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034821 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034822 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034823 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034824 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034825
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034826 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34827 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034829 str = gen_const_xmlChar_ptr(n_str, 0);
34830 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034831
William M. Brackf13f77f2004-11-12 16:03:48 +000034832 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034833 desret_const_xmlChar_ptr(ret_val);
34834 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034835 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34836 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034837 xmlResetLastError();
34838 if (mem_base != xmlMemBlocks()) {
34839 printf("Leak of %d blocks found in xmlStrstr",
34840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034841 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034842 printf(" %d", n_str);
34843 printf(" %d", n_val);
34844 printf("\n");
34845 }
34846 }
34847 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034848 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034849
Daniel Veillard42595322004-11-08 10:52:06 +000034850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034851}
34852
34853
34854static int
34855test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034857
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034858 int mem_base;
34859 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034860 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034861 int n_str;
34862 int start; /* the index of the first char (zero based) */
34863 int n_start;
34864 int len; /* the length of the substring */
34865 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034866
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034867 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34868 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34869 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034871 str = gen_const_xmlChar_ptr(n_str, 0);
34872 start = gen_int(n_start, 1);
34873 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034874
William M. Brackf13f77f2004-11-12 16:03:48 +000034875 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034876 desret_xmlChar_ptr(ret_val);
34877 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034878 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034879 des_int(n_start, start, 1);
34880 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034881 xmlResetLastError();
34882 if (mem_base != xmlMemBlocks()) {
34883 printf("Leak of %d blocks found in xmlStrsub",
34884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034885 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034886 printf(" %d", n_str);
34887 printf(" %d", n_start);
34888 printf(" %d", n_len);
34889 printf("\n");
34890 }
34891 }
34892 }
34893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034895
Daniel Veillard42595322004-11-08 10:52:06 +000034896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034897}
34898
34899
34900static int
34901test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034903
34904 int mem_base;
34905 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034906 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034907 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034908 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034909 int n_utf2;
34910
34911 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34912 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034914 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34915 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034916
William M. Brackf13f77f2004-11-12 16:03:48 +000034917 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034918 desret_int(ret_val);
34919 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034920 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34921 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034922 xmlResetLastError();
34923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034924 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034927 printf(" %d", n_utf1);
34928 printf(" %d", n_utf2);
34929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034930 }
34931 }
34932 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034933 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034934
Daniel Veillard42595322004-11-08 10:52:06 +000034935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034936}
34937
34938
34939static int
34940test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034942
34943 int mem_base;
34944 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034945 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034946 int n_utf;
34947
34948 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34949 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034950 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034951
William M. Brackf13f77f2004-11-12 16:03:48 +000034952 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034953 desret_int(ret_val);
34954 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034955 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034956 xmlResetLastError();
34957 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034958 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034960 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034961 printf(" %d", n_utf);
34962 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034963 }
34964 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034965 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034966
Daniel Veillard42595322004-11-08 10:52:06 +000034967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034968}
34969
34970
34971static int
34972test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034974
34975 int mem_base;
34976 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034977 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034978 int n_utf;
34979
34980 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034982 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034983
William M. Brackf13f77f2004-11-12 16:03:48 +000034984 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034985 desret_int(ret_val);
34986 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034987 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034988 xmlResetLastError();
34989 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034990 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034992 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034993 printf(" %d", n_utf);
34994 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034995 }
34996 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034998
Daniel Veillard42595322004-11-08 10:52:06 +000034999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035000}
35001
35002
35003static int
35004test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035006
35007 int mem_base;
35008 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035009 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000035010 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035011 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000035012 int n_utfchar;
35013
35014 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
35015 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
35016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035017 utf = gen_const_xmlChar_ptr(n_utf, 0);
35018 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035019
William M. Brackf13f77f2004-11-12 16:03:48 +000035020 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035021 desret_int(ret_val);
35022 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000035023 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
35024 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035025 xmlResetLastError();
35026 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000035027 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000035028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035029 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000035030 printf(" %d", n_utf);
35031 printf(" %d", n_utfchar);
35032 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000035033 }
35034 }
35035 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035036 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035037
Daniel Veillard42595322004-11-08 10:52:06 +000035038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035039}
35040
35041
35042static int
35043test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035045
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035046 int mem_base;
35047 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035048 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035049 int n_utf;
35050 int len; /* the len of @utf (in chars) */
35051 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035052
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035053 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
35054 for (n_len = 0;n_len < gen_nb_int;n_len++) {
35055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035056 utf = gen_const_xmlChar_ptr(n_utf, 0);
35057 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035058
William M. Brackf13f77f2004-11-12 16:03:48 +000035059 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035060 desret_xmlChar_ptr(ret_val);
35061 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000035062 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000035063 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035064 xmlResetLastError();
35065 if (mem_base != xmlMemBlocks()) {
35066 printf("Leak of %d blocks found in xmlUTF8Strndup",
35067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035068 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035069 printf(" %d", n_utf);
35070 printf(" %d", n_len);
35071 printf("\n");
35072 }
35073 }
35074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035076
Daniel Veillard42595322004-11-08 10:52:06 +000035077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035078}
35079
35080
35081static int
35082test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035084
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035085 int mem_base;
35086 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035087 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035088 int n_utf;
35089 int pos; /* the position of the desired UTF8 char (in chars) */
35090 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035091
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035092 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
35093 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
35094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035095 utf = gen_const_xmlChar_ptr(n_utf, 0);
35096 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035097
William M. Brackf13f77f2004-11-12 16:03:48 +000035098 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035099 desret_const_xmlChar_ptr(ret_val);
35100 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000035101 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000035102 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035103 xmlResetLastError();
35104 if (mem_base != xmlMemBlocks()) {
35105 printf("Leak of %d blocks found in xmlUTF8Strpos",
35106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035107 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000035108 printf(" %d", n_utf);
35109 printf(" %d", n_pos);
35110 printf("\n");
35111 }
35112 }
35113 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035115
Daniel Veillard42595322004-11-08 10:52:06 +000035116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035117}
35118
35119
35120static int
35121test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035123
35124 int mem_base;
35125 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035126 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000035127 int n_utf;
35128 int len; /* the number of characters in the array */
35129 int n_len;
35130
35131 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
35132 for (n_len = 0;n_len < gen_nb_int;n_len++) {
35133 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035134 utf = gen_const_xmlChar_ptr(n_utf, 0);
35135 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035136
William M. Brackf13f77f2004-11-12 16:03:48 +000035137 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035138 desret_int(ret_val);
35139 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000035140 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000035141 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035142 xmlResetLastError();
35143 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000035144 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000035145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035146 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000035147 printf(" %d", n_utf);
35148 printf(" %d", n_len);
35149 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000035150 }
35151 }
35152 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035153 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035154
Daniel Veillard42595322004-11-08 10:52:06 +000035155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035156}
35157
35158
35159static int
35160test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035162
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035163 int mem_base;
35164 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035165 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035166 int n_utf;
35167 int start; /* relative pos of first char */
35168 int n_start;
35169 int len; /* total number to copy */
35170 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035171
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035172 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
35173 for (n_start = 0;n_start < gen_nb_int;n_start++) {
35174 for (n_len = 0;n_len < gen_nb_int;n_len++) {
35175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035176 utf = gen_const_xmlChar_ptr(n_utf, 0);
35177 start = gen_int(n_start, 1);
35178 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035179
William M. Brackf13f77f2004-11-12 16:03:48 +000035180 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035181 desret_xmlChar_ptr(ret_val);
35182 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000035183 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000035184 des_int(n_start, start, 1);
35185 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035186 xmlResetLastError();
35187 if (mem_base != xmlMemBlocks()) {
35188 printf("Leak of %d blocks found in xmlUTF8Strsub",
35189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035190 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000035191 printf(" %d", n_utf);
35192 printf(" %d", n_start);
35193 printf(" %d", n_len);
35194 printf("\n");
35195 }
35196 }
35197 }
35198 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000035199 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035200
Daniel Veillard42595322004-11-08 10:52:06 +000035201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035202}
35203
35204static int
35205test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035207
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035208 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000035209 test_ret += test_xmlCharStrdup();
35210 test_ret += test_xmlCharStrndup();
35211 test_ret += test_xmlCheckUTF8();
35212 test_ret += test_xmlGetUTF8Char();
35213 test_ret += test_xmlStrEqual();
35214 test_ret += test_xmlStrPrintf();
35215 test_ret += test_xmlStrQEqual();
35216 test_ret += test_xmlStrVPrintf();
35217 test_ret += test_xmlStrcasecmp();
35218 test_ret += test_xmlStrcasestr();
35219 test_ret += test_xmlStrchr();
35220 test_ret += test_xmlStrcmp();
35221 test_ret += test_xmlStrdup();
35222 test_ret += test_xmlStrlen();
35223 test_ret += test_xmlStrncasecmp();
35224 test_ret += test_xmlStrncatNew();
35225 test_ret += test_xmlStrncmp();
35226 test_ret += test_xmlStrndup();
35227 test_ret += test_xmlStrstr();
35228 test_ret += test_xmlStrsub();
35229 test_ret += test_xmlUTF8Charcmp();
35230 test_ret += test_xmlUTF8Size();
35231 test_ret += test_xmlUTF8Strlen();
35232 test_ret += test_xmlUTF8Strloc();
35233 test_ret += test_xmlUTF8Strndup();
35234 test_ret += test_xmlUTF8Strpos();
35235 test_ret += test_xmlUTF8Strsize();
35236 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000035237
Daniel Veillard42595322004-11-08 10:52:06 +000035238 if (test_ret != 0)
35239 printf("Module xmlstring: %d errors\n", test_ret);
35240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035241}
35242
35243static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035244test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035246
William M. Brack21e4ef22005-01-02 09:53:13 +000035247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035248 int mem_base;
35249 int ret_val;
35250 int code; /* UCS code point */
35251 int n_code;
35252
35253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35254 mem_base = xmlMemBlocks();
35255 code = gen_int(n_code, 0);
35256
35257 ret_val = xmlUCSIsAegeanNumbers(code);
35258 desret_int(ret_val);
35259 call_tests++;
35260 des_int(n_code, code, 0);
35261 xmlResetLastError();
35262 if (mem_base != xmlMemBlocks()) {
35263 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
35264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035266 printf(" %d", n_code);
35267 printf("\n");
35268 }
35269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035271#endif
35272
Daniel Veillard42595322004-11-08 10:52:06 +000035273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035274}
35275
35276
35277static int
35278test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035280
William M. Brack21e4ef22005-01-02 09:53:13 +000035281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035282 int mem_base;
35283 int ret_val;
35284 int code; /* UCS code point */
35285 int n_code;
35286
35287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35288 mem_base = xmlMemBlocks();
35289 code = gen_int(n_code, 0);
35290
35291 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
35292 desret_int(ret_val);
35293 call_tests++;
35294 des_int(n_code, code, 0);
35295 xmlResetLastError();
35296 if (mem_base != xmlMemBlocks()) {
35297 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
35298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035300 printf(" %d", n_code);
35301 printf("\n");
35302 }
35303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035305#endif
35306
Daniel Veillard42595322004-11-08 10:52:06 +000035307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035308}
35309
35310
35311static int
35312test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035314
William M. Brack21e4ef22005-01-02 09:53:13 +000035315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035316 int mem_base;
35317 int ret_val;
35318 int code; /* UCS code point */
35319 int n_code;
35320
35321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35322 mem_base = xmlMemBlocks();
35323 code = gen_int(n_code, 0);
35324
35325 ret_val = xmlUCSIsArabic(code);
35326 desret_int(ret_val);
35327 call_tests++;
35328 des_int(n_code, code, 0);
35329 xmlResetLastError();
35330 if (mem_base != xmlMemBlocks()) {
35331 printf("Leak of %d blocks found in xmlUCSIsArabic",
35332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035334 printf(" %d", n_code);
35335 printf("\n");
35336 }
35337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035339#endif
35340
Daniel Veillard42595322004-11-08 10:52:06 +000035341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035342}
35343
35344
35345static int
35346test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035348
William M. Brack21e4ef22005-01-02 09:53:13 +000035349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035350 int mem_base;
35351 int ret_val;
35352 int code; /* UCS code point */
35353 int n_code;
35354
35355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35356 mem_base = xmlMemBlocks();
35357 code = gen_int(n_code, 0);
35358
35359 ret_val = xmlUCSIsArabicPresentationFormsA(code);
35360 desret_int(ret_val);
35361 call_tests++;
35362 des_int(n_code, code, 0);
35363 xmlResetLastError();
35364 if (mem_base != xmlMemBlocks()) {
35365 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
35366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035368 printf(" %d", n_code);
35369 printf("\n");
35370 }
35371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035373#endif
35374
Daniel Veillard42595322004-11-08 10:52:06 +000035375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035376}
35377
35378
35379static int
35380test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035382
William M. Brack21e4ef22005-01-02 09:53:13 +000035383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035384 int mem_base;
35385 int ret_val;
35386 int code; /* UCS code point */
35387 int n_code;
35388
35389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35390 mem_base = xmlMemBlocks();
35391 code = gen_int(n_code, 0);
35392
35393 ret_val = xmlUCSIsArabicPresentationFormsB(code);
35394 desret_int(ret_val);
35395 call_tests++;
35396 des_int(n_code, code, 0);
35397 xmlResetLastError();
35398 if (mem_base != xmlMemBlocks()) {
35399 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
35400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035402 printf(" %d", n_code);
35403 printf("\n");
35404 }
35405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035407#endif
35408
Daniel Veillard42595322004-11-08 10:52:06 +000035409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035410}
35411
35412
35413static int
35414test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035416
William M. Brack21e4ef22005-01-02 09:53:13 +000035417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035418 int mem_base;
35419 int ret_val;
35420 int code; /* UCS code point */
35421 int n_code;
35422
35423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35424 mem_base = xmlMemBlocks();
35425 code = gen_int(n_code, 0);
35426
35427 ret_val = xmlUCSIsArmenian(code);
35428 desret_int(ret_val);
35429 call_tests++;
35430 des_int(n_code, code, 0);
35431 xmlResetLastError();
35432 if (mem_base != xmlMemBlocks()) {
35433 printf("Leak of %d blocks found in xmlUCSIsArmenian",
35434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035436 printf(" %d", n_code);
35437 printf("\n");
35438 }
35439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035441#endif
35442
Daniel Veillard42595322004-11-08 10:52:06 +000035443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035444}
35445
35446
35447static int
35448test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035450
William M. Brack21e4ef22005-01-02 09:53:13 +000035451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035452 int mem_base;
35453 int ret_val;
35454 int code; /* UCS code point */
35455 int n_code;
35456
35457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35458 mem_base = xmlMemBlocks();
35459 code = gen_int(n_code, 0);
35460
35461 ret_val = xmlUCSIsArrows(code);
35462 desret_int(ret_val);
35463 call_tests++;
35464 des_int(n_code, code, 0);
35465 xmlResetLastError();
35466 if (mem_base != xmlMemBlocks()) {
35467 printf("Leak of %d blocks found in xmlUCSIsArrows",
35468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035470 printf(" %d", n_code);
35471 printf("\n");
35472 }
35473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035475#endif
35476
Daniel Veillard42595322004-11-08 10:52:06 +000035477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035478}
35479
35480
35481static int
35482test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035484
William M. Brack21e4ef22005-01-02 09:53:13 +000035485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035486 int mem_base;
35487 int ret_val;
35488 int code; /* UCS code point */
35489 int n_code;
35490
35491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35492 mem_base = xmlMemBlocks();
35493 code = gen_int(n_code, 0);
35494
35495 ret_val = xmlUCSIsBasicLatin(code);
35496 desret_int(ret_val);
35497 call_tests++;
35498 des_int(n_code, code, 0);
35499 xmlResetLastError();
35500 if (mem_base != xmlMemBlocks()) {
35501 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
35502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035504 printf(" %d", n_code);
35505 printf("\n");
35506 }
35507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035509#endif
35510
Daniel Veillard42595322004-11-08 10:52:06 +000035511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035512}
35513
35514
35515static int
35516test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035518
William M. Brack21e4ef22005-01-02 09:53:13 +000035519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035520 int mem_base;
35521 int ret_val;
35522 int code; /* UCS code point */
35523 int n_code;
35524
35525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35526 mem_base = xmlMemBlocks();
35527 code = gen_int(n_code, 0);
35528
35529 ret_val = xmlUCSIsBengali(code);
35530 desret_int(ret_val);
35531 call_tests++;
35532 des_int(n_code, code, 0);
35533 xmlResetLastError();
35534 if (mem_base != xmlMemBlocks()) {
35535 printf("Leak of %d blocks found in xmlUCSIsBengali",
35536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035538 printf(" %d", n_code);
35539 printf("\n");
35540 }
35541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035543#endif
35544
Daniel Veillard42595322004-11-08 10:52:06 +000035545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035546}
35547
35548
35549static int
35550test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035552
William M. Brack21e4ef22005-01-02 09:53:13 +000035553#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035554 int mem_base;
35555 int ret_val;
35556 int code; /* UCS code point */
35557 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035558 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035559 int n_block;
35560
35561 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35562 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
35563 mem_base = xmlMemBlocks();
35564 code = gen_int(n_code, 0);
35565 block = gen_const_char_ptr(n_block, 1);
35566
William M. Brackf13f77f2004-11-12 16:03:48 +000035567 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035568 desret_int(ret_val);
35569 call_tests++;
35570 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035571 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035572 xmlResetLastError();
35573 if (mem_base != xmlMemBlocks()) {
35574 printf("Leak of %d blocks found in xmlUCSIsBlock",
35575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035576 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035577 printf(" %d", n_code);
35578 printf(" %d", n_block);
35579 printf("\n");
35580 }
35581 }
35582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035583 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584#endif
35585
Daniel Veillard42595322004-11-08 10:52:06 +000035586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035587}
35588
35589
35590static int
35591test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035593
William M. Brack21e4ef22005-01-02 09:53:13 +000035594#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035595 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 = xmlUCSIsBlockElements(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 xmlUCSIsBlockElements",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035617 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618#endif
35619
Daniel Veillard42595322004-11-08 10:52:06 +000035620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035621}
35622
35623
35624static int
35625test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035627
William M. Brack21e4ef22005-01-02 09:53:13 +000035628#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035629 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 = xmlUCSIsBopomofo(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 xmlUCSIsBopomofo",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652#endif
35653
Daniel Veillard42595322004-11-08 10:52:06 +000035654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035655}
35656
35657
35658static int
35659test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035661
William M. Brack21e4ef22005-01-02 09:53:13 +000035662#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035663 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 = xmlUCSIsBopomofoExtended(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 xmlUCSIsBopomofoExtended",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686#endif
35687
Daniel Veillard42595322004-11-08 10:52:06 +000035688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035689}
35690
35691
35692static int
35693test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035695
William M. Brack21e4ef22005-01-02 09:53:13 +000035696#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035697 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 = xmlUCSIsBoxDrawing(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 xmlUCSIsBoxDrawing",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035719 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720#endif
35721
Daniel Veillard42595322004-11-08 10:52:06 +000035722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035723}
35724
35725
35726static int
35727test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035729
William M. Brack21e4ef22005-01-02 09:53:13 +000035730#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035731 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 = xmlUCSIsBraillePatterns(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 xmlUCSIsBraillePatterns",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035753 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754#endif
35755
Daniel Veillard42595322004-11-08 10:52:06 +000035756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035757}
35758
35759
35760static int
35761test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035763
William M. Brack21e4ef22005-01-02 09:53:13 +000035764#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035765 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 = xmlUCSIsBuhid(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 xmlUCSIsBuhid",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035787 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788#endif
35789
Daniel Veillard42595322004-11-08 10:52:06 +000035790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035791}
35792
35793
35794static int
35795test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035797
William M. Brack21e4ef22005-01-02 09:53:13 +000035798#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035799 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 = xmlUCSIsByzantineMusicalSymbols(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 xmlUCSIsByzantineMusicalSymbols",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035821 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822#endif
35823
Daniel Veillard42595322004-11-08 10:52:06 +000035824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035825}
35826
35827
35828static int
35829test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035831
William M. Brack21e4ef22005-01-02 09:53:13 +000035832#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035833 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 = xmlUCSIsCJKCompatibility(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 xmlUCSIsCJKCompatibility",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035855 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856#endif
35857
Daniel Veillard42595322004-11-08 10:52:06 +000035858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035859}
35860
35861
35862static int
35863test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035865
William M. Brack21e4ef22005-01-02 09:53:13 +000035866#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035867 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 = xmlUCSIsCJKCompatibilityForms(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 xmlUCSIsCJKCompatibilityForms",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035889 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890#endif
35891
Daniel Veillard42595322004-11-08 10:52:06 +000035892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035893}
35894
35895
35896static int
35897test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035899
William M. Brack21e4ef22005-01-02 09:53:13 +000035900#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035901 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 = xmlUCSIsCJKCompatibilityIdeographs(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 xmlUCSIsCJKCompatibilityIdeographs",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035923 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924#endif
35925
Daniel Veillard42595322004-11-08 10:52:06 +000035926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035927}
35928
35929
35930static int
35931test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035933
William M. Brack21e4ef22005-01-02 09:53:13 +000035934#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035935 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 = xmlUCSIsCJKCompatibilityIdeographsSupplement(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 xmlUCSIsCJKCompatibilityIdeographsSupplement",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035957 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958#endif
35959
Daniel Veillard42595322004-11-08 10:52:06 +000035960 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035961}
35962
35963
35964static int
35965test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035966 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035967
William M. Brack21e4ef22005-01-02 09:53:13 +000035968#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035969 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 = xmlUCSIsCJKRadicalsSupplement(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 xmlUCSIsCJKRadicalsSupplement",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035991 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992#endif
35993
Daniel Veillard42595322004-11-08 10:52:06 +000035994 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035995}
35996
35997
35998static int
35999test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036000 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036001
William M. Brack21e4ef22005-01-02 09:53:13 +000036002#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036003 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 = xmlUCSIsCJKSymbolsandPunctuation(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 xmlUCSIsCJKSymbolsandPunctuation",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036025 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026#endif
36027
Daniel Veillard42595322004-11-08 10:52:06 +000036028 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036029}
36030
36031
36032static int
36033test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036034 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036035
William M. Brack21e4ef22005-01-02 09:53:13 +000036036#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036037 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 = xmlUCSIsCJKUnifiedIdeographs(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 xmlUCSIsCJKUnifiedIdeographs",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036059 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060#endif
36061
Daniel Veillard42595322004-11-08 10:52:06 +000036062 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036063}
36064
36065
36066static int
36067test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036068 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036069
William M. Brack21e4ef22005-01-02 09:53:13 +000036070#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036071 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 = xmlUCSIsCJKUnifiedIdeographsExtensionA(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 xmlUCSIsCJKUnifiedIdeographsExtensionA",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036093 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094#endif
36095
Daniel Veillard42595322004-11-08 10:52:06 +000036096 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036097}
36098
36099
36100static int
36101test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036102 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036103
William M. Brack21e4ef22005-01-02 09:53:13 +000036104#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036105 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 = xmlUCSIsCJKUnifiedIdeographsExtensionB(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 xmlUCSIsCJKUnifiedIdeographsExtensionB",
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 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036127 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128#endif
36129
Daniel Veillard42595322004-11-08 10:52:06 +000036130 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036131}
36132
36133
36134static int
36135test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036136 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036137
William M. Brack21e4ef22005-01-02 09:53:13 +000036138#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036139 int mem_base;
36140 int ret_val;
36141 int code; /* UCS code point */
36142 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036143 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036144 int n_cat;
36145
36146 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36147 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
36148 mem_base = xmlMemBlocks();
36149 code = gen_int(n_code, 0);
36150 cat = gen_const_char_ptr(n_cat, 1);
36151
William M. Brackf13f77f2004-11-12 16:03:48 +000036152 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036153 desret_int(ret_val);
36154 call_tests++;
36155 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000036156 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036157 xmlResetLastError();
36158 if (mem_base != xmlMemBlocks()) {
36159 printf("Leak of %d blocks found in xmlUCSIsCat",
36160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036161 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162 printf(" %d", n_code);
36163 printf(" %d", n_cat);
36164 printf("\n");
36165 }
36166 }
36167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036169#endif
36170
Daniel Veillard42595322004-11-08 10:52:06 +000036171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036172}
36173
36174
36175static int
36176test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036178
William M. Brack21e4ef22005-01-02 09:53:13 +000036179#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036180 int mem_base;
36181 int ret_val;
36182 int code; /* UCS code point */
36183 int n_code;
36184
36185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36186 mem_base = xmlMemBlocks();
36187 code = gen_int(n_code, 0);
36188
36189 ret_val = xmlUCSIsCatC(code);
36190 desret_int(ret_val);
36191 call_tests++;
36192 des_int(n_code, code, 0);
36193 xmlResetLastError();
36194 if (mem_base != xmlMemBlocks()) {
36195 printf("Leak of %d blocks found in xmlUCSIsCatC",
36196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036198 printf(" %d", n_code);
36199 printf("\n");
36200 }
36201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036203#endif
36204
Daniel Veillard42595322004-11-08 10:52:06 +000036205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036206}
36207
36208
36209static int
36210test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036212
William M. Brack21e4ef22005-01-02 09:53:13 +000036213#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036214 int mem_base;
36215 int ret_val;
36216 int code; /* UCS code point */
36217 int n_code;
36218
36219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36220 mem_base = xmlMemBlocks();
36221 code = gen_int(n_code, 0);
36222
36223 ret_val = xmlUCSIsCatCc(code);
36224 desret_int(ret_val);
36225 call_tests++;
36226 des_int(n_code, code, 0);
36227 xmlResetLastError();
36228 if (mem_base != xmlMemBlocks()) {
36229 printf("Leak of %d blocks found in xmlUCSIsCatCc",
36230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036232 printf(" %d", n_code);
36233 printf("\n");
36234 }
36235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036237#endif
36238
Daniel Veillard42595322004-11-08 10:52:06 +000036239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036240}
36241
36242
36243static int
36244test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036246
William M. Brack21e4ef22005-01-02 09:53:13 +000036247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036248 int mem_base;
36249 int ret_val;
36250 int code; /* UCS code point */
36251 int n_code;
36252
36253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36254 mem_base = xmlMemBlocks();
36255 code = gen_int(n_code, 0);
36256
36257 ret_val = xmlUCSIsCatCf(code);
36258 desret_int(ret_val);
36259 call_tests++;
36260 des_int(n_code, code, 0);
36261 xmlResetLastError();
36262 if (mem_base != xmlMemBlocks()) {
36263 printf("Leak of %d blocks found in xmlUCSIsCatCf",
36264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036266 printf(" %d", n_code);
36267 printf("\n");
36268 }
36269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036271#endif
36272
Daniel Veillard42595322004-11-08 10:52:06 +000036273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036274}
36275
36276
36277static int
36278test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036280
William M. Brack21e4ef22005-01-02 09:53:13 +000036281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036282 int mem_base;
36283 int ret_val;
36284 int code; /* UCS code point */
36285 int n_code;
36286
36287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36288 mem_base = xmlMemBlocks();
36289 code = gen_int(n_code, 0);
36290
36291 ret_val = xmlUCSIsCatCo(code);
36292 desret_int(ret_val);
36293 call_tests++;
36294 des_int(n_code, code, 0);
36295 xmlResetLastError();
36296 if (mem_base != xmlMemBlocks()) {
36297 printf("Leak of %d blocks found in xmlUCSIsCatCo",
36298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036300 printf(" %d", n_code);
36301 printf("\n");
36302 }
36303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036305#endif
36306
Daniel Veillard42595322004-11-08 10:52:06 +000036307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036308}
36309
36310
36311static int
36312test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036314
William M. Brack21e4ef22005-01-02 09:53:13 +000036315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036316 int mem_base;
36317 int ret_val;
36318 int code; /* UCS code point */
36319 int n_code;
36320
36321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36322 mem_base = xmlMemBlocks();
36323 code = gen_int(n_code, 0);
36324
36325 ret_val = xmlUCSIsCatCs(code);
36326 desret_int(ret_val);
36327 call_tests++;
36328 des_int(n_code, code, 0);
36329 xmlResetLastError();
36330 if (mem_base != xmlMemBlocks()) {
36331 printf("Leak of %d blocks found in xmlUCSIsCatCs",
36332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036334 printf(" %d", n_code);
36335 printf("\n");
36336 }
36337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036339#endif
36340
Daniel Veillard42595322004-11-08 10:52:06 +000036341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036342}
36343
36344
36345static int
36346test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036348
William M. Brack21e4ef22005-01-02 09:53:13 +000036349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036350 int mem_base;
36351 int ret_val;
36352 int code; /* UCS code point */
36353 int n_code;
36354
36355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36356 mem_base = xmlMemBlocks();
36357 code = gen_int(n_code, 0);
36358
36359 ret_val = xmlUCSIsCatL(code);
36360 desret_int(ret_val);
36361 call_tests++;
36362 des_int(n_code, code, 0);
36363 xmlResetLastError();
36364 if (mem_base != xmlMemBlocks()) {
36365 printf("Leak of %d blocks found in xmlUCSIsCatL",
36366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036368 printf(" %d", n_code);
36369 printf("\n");
36370 }
36371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036373#endif
36374
Daniel Veillard42595322004-11-08 10:52:06 +000036375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036376}
36377
36378
36379static int
36380test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036382
William M. Brack21e4ef22005-01-02 09:53:13 +000036383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036384 int mem_base;
36385 int ret_val;
36386 int code; /* UCS code point */
36387 int n_code;
36388
36389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36390 mem_base = xmlMemBlocks();
36391 code = gen_int(n_code, 0);
36392
36393 ret_val = xmlUCSIsCatLl(code);
36394 desret_int(ret_val);
36395 call_tests++;
36396 des_int(n_code, code, 0);
36397 xmlResetLastError();
36398 if (mem_base != xmlMemBlocks()) {
36399 printf("Leak of %d blocks found in xmlUCSIsCatLl",
36400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036402 printf(" %d", n_code);
36403 printf("\n");
36404 }
36405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036407#endif
36408
Daniel Veillard42595322004-11-08 10:52:06 +000036409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036410}
36411
36412
36413static int
36414test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036416
William M. Brack21e4ef22005-01-02 09:53:13 +000036417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036418 int mem_base;
36419 int ret_val;
36420 int code; /* UCS code point */
36421 int n_code;
36422
36423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36424 mem_base = xmlMemBlocks();
36425 code = gen_int(n_code, 0);
36426
36427 ret_val = xmlUCSIsCatLm(code);
36428 desret_int(ret_val);
36429 call_tests++;
36430 des_int(n_code, code, 0);
36431 xmlResetLastError();
36432 if (mem_base != xmlMemBlocks()) {
36433 printf("Leak of %d blocks found in xmlUCSIsCatLm",
36434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036436 printf(" %d", n_code);
36437 printf("\n");
36438 }
36439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036441#endif
36442
Daniel Veillard42595322004-11-08 10:52:06 +000036443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036444}
36445
36446
36447static int
36448test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036450
William M. Brack21e4ef22005-01-02 09:53:13 +000036451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036452 int mem_base;
36453 int ret_val;
36454 int code; /* UCS code point */
36455 int n_code;
36456
36457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36458 mem_base = xmlMemBlocks();
36459 code = gen_int(n_code, 0);
36460
36461 ret_val = xmlUCSIsCatLo(code);
36462 desret_int(ret_val);
36463 call_tests++;
36464 des_int(n_code, code, 0);
36465 xmlResetLastError();
36466 if (mem_base != xmlMemBlocks()) {
36467 printf("Leak of %d blocks found in xmlUCSIsCatLo",
36468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036470 printf(" %d", n_code);
36471 printf("\n");
36472 }
36473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036475#endif
36476
Daniel Veillard42595322004-11-08 10:52:06 +000036477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036478}
36479
36480
36481static int
36482test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036484
William M. Brack21e4ef22005-01-02 09:53:13 +000036485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036486 int mem_base;
36487 int ret_val;
36488 int code; /* UCS code point */
36489 int n_code;
36490
36491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36492 mem_base = xmlMemBlocks();
36493 code = gen_int(n_code, 0);
36494
36495 ret_val = xmlUCSIsCatLt(code);
36496 desret_int(ret_val);
36497 call_tests++;
36498 des_int(n_code, code, 0);
36499 xmlResetLastError();
36500 if (mem_base != xmlMemBlocks()) {
36501 printf("Leak of %d blocks found in xmlUCSIsCatLt",
36502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036504 printf(" %d", n_code);
36505 printf("\n");
36506 }
36507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036509#endif
36510
Daniel Veillard42595322004-11-08 10:52:06 +000036511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036512}
36513
36514
36515static int
36516test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036518
William M. Brack21e4ef22005-01-02 09:53:13 +000036519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036520 int mem_base;
36521 int ret_val;
36522 int code; /* UCS code point */
36523 int n_code;
36524
36525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36526 mem_base = xmlMemBlocks();
36527 code = gen_int(n_code, 0);
36528
36529 ret_val = xmlUCSIsCatLu(code);
36530 desret_int(ret_val);
36531 call_tests++;
36532 des_int(n_code, code, 0);
36533 xmlResetLastError();
36534 if (mem_base != xmlMemBlocks()) {
36535 printf("Leak of %d blocks found in xmlUCSIsCatLu",
36536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036538 printf(" %d", n_code);
36539 printf("\n");
36540 }
36541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036543#endif
36544
Daniel Veillard42595322004-11-08 10:52:06 +000036545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036546}
36547
36548
36549static int
36550test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036552
William M. Brack21e4ef22005-01-02 09:53:13 +000036553#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036554 int mem_base;
36555 int ret_val;
36556 int code; /* UCS code point */
36557 int n_code;
36558
36559 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36560 mem_base = xmlMemBlocks();
36561 code = gen_int(n_code, 0);
36562
36563 ret_val = xmlUCSIsCatM(code);
36564 desret_int(ret_val);
36565 call_tests++;
36566 des_int(n_code, code, 0);
36567 xmlResetLastError();
36568 if (mem_base != xmlMemBlocks()) {
36569 printf("Leak of %d blocks found in xmlUCSIsCatM",
36570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036571 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036572 printf(" %d", n_code);
36573 printf("\n");
36574 }
36575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036576 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036577#endif
36578
Daniel Veillard42595322004-11-08 10:52:06 +000036579 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036580}
36581
36582
36583static int
36584test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036585 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036586
William M. Brack21e4ef22005-01-02 09:53:13 +000036587#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036588 int mem_base;
36589 int ret_val;
36590 int code; /* UCS code point */
36591 int n_code;
36592
36593 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36594 mem_base = xmlMemBlocks();
36595 code = gen_int(n_code, 0);
36596
36597 ret_val = xmlUCSIsCatMc(code);
36598 desret_int(ret_val);
36599 call_tests++;
36600 des_int(n_code, code, 0);
36601 xmlResetLastError();
36602 if (mem_base != xmlMemBlocks()) {
36603 printf("Leak of %d blocks found in xmlUCSIsCatMc",
36604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036605 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036606 printf(" %d", n_code);
36607 printf("\n");
36608 }
36609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036610 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036611#endif
36612
Daniel Veillard42595322004-11-08 10:52:06 +000036613 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036614}
36615
36616
36617static int
36618test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036619 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036620
William M. Brack21e4ef22005-01-02 09:53:13 +000036621#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036622 int mem_base;
36623 int ret_val;
36624 int code; /* UCS code point */
36625 int n_code;
36626
36627 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36628 mem_base = xmlMemBlocks();
36629 code = gen_int(n_code, 0);
36630
36631 ret_val = xmlUCSIsCatMe(code);
36632 desret_int(ret_val);
36633 call_tests++;
36634 des_int(n_code, code, 0);
36635 xmlResetLastError();
36636 if (mem_base != xmlMemBlocks()) {
36637 printf("Leak of %d blocks found in xmlUCSIsCatMe",
36638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036639 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036640 printf(" %d", n_code);
36641 printf("\n");
36642 }
36643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036644 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036645#endif
36646
Daniel Veillard42595322004-11-08 10:52:06 +000036647 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036648}
36649
36650
36651static int
36652test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036653 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036654
William M. Brack21e4ef22005-01-02 09:53:13 +000036655#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036656 int mem_base;
36657 int ret_val;
36658 int code; /* UCS code point */
36659 int n_code;
36660
36661 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36662 mem_base = xmlMemBlocks();
36663 code = gen_int(n_code, 0);
36664
36665 ret_val = xmlUCSIsCatMn(code);
36666 desret_int(ret_val);
36667 call_tests++;
36668 des_int(n_code, code, 0);
36669 xmlResetLastError();
36670 if (mem_base != xmlMemBlocks()) {
36671 printf("Leak of %d blocks found in xmlUCSIsCatMn",
36672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036673 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036674 printf(" %d", n_code);
36675 printf("\n");
36676 }
36677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036678 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036679#endif
36680
Daniel Veillard42595322004-11-08 10:52:06 +000036681 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036682}
36683
36684
36685static int
36686test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036687 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036688
William M. Brack21e4ef22005-01-02 09:53:13 +000036689#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036690 int mem_base;
36691 int ret_val;
36692 int code; /* UCS code point */
36693 int n_code;
36694
36695 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36696 mem_base = xmlMemBlocks();
36697 code = gen_int(n_code, 0);
36698
36699 ret_val = xmlUCSIsCatN(code);
36700 desret_int(ret_val);
36701 call_tests++;
36702 des_int(n_code, code, 0);
36703 xmlResetLastError();
36704 if (mem_base != xmlMemBlocks()) {
36705 printf("Leak of %d blocks found in xmlUCSIsCatN",
36706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036707 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036708 printf(" %d", n_code);
36709 printf("\n");
36710 }
36711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036712 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036713#endif
36714
Daniel Veillard42595322004-11-08 10:52:06 +000036715 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036716}
36717
36718
36719static int
36720test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036721 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036722
William M. Brack21e4ef22005-01-02 09:53:13 +000036723#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036724 int mem_base;
36725 int ret_val;
36726 int code; /* UCS code point */
36727 int n_code;
36728
36729 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36730 mem_base = xmlMemBlocks();
36731 code = gen_int(n_code, 0);
36732
36733 ret_val = xmlUCSIsCatNd(code);
36734 desret_int(ret_val);
36735 call_tests++;
36736 des_int(n_code, code, 0);
36737 xmlResetLastError();
36738 if (mem_base != xmlMemBlocks()) {
36739 printf("Leak of %d blocks found in xmlUCSIsCatNd",
36740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036741 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036742 printf(" %d", n_code);
36743 printf("\n");
36744 }
36745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036746 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036747#endif
36748
Daniel Veillard42595322004-11-08 10:52:06 +000036749 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036750}
36751
36752
36753static int
36754test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036755 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036756
William M. Brack21e4ef22005-01-02 09:53:13 +000036757#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036758 int mem_base;
36759 int ret_val;
36760 int code; /* UCS code point */
36761 int n_code;
36762
36763 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36764 mem_base = xmlMemBlocks();
36765 code = gen_int(n_code, 0);
36766
36767 ret_val = xmlUCSIsCatNl(code);
36768 desret_int(ret_val);
36769 call_tests++;
36770 des_int(n_code, code, 0);
36771 xmlResetLastError();
36772 if (mem_base != xmlMemBlocks()) {
36773 printf("Leak of %d blocks found in xmlUCSIsCatNl",
36774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036775 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036776 printf(" %d", n_code);
36777 printf("\n");
36778 }
36779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036780 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036781#endif
36782
Daniel Veillard42595322004-11-08 10:52:06 +000036783 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036784}
36785
36786
36787static int
36788test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036789 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036790
William M. Brack21e4ef22005-01-02 09:53:13 +000036791#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036792 int mem_base;
36793 int ret_val;
36794 int code; /* UCS code point */
36795 int n_code;
36796
36797 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36798 mem_base = xmlMemBlocks();
36799 code = gen_int(n_code, 0);
36800
36801 ret_val = xmlUCSIsCatNo(code);
36802 desret_int(ret_val);
36803 call_tests++;
36804 des_int(n_code, code, 0);
36805 xmlResetLastError();
36806 if (mem_base != xmlMemBlocks()) {
36807 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036809 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036810 printf(" %d", n_code);
36811 printf("\n");
36812 }
36813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036815#endif
36816
Daniel Veillard42595322004-11-08 10:52:06 +000036817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036818}
36819
36820
36821static int
36822test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036824
William M. Brack21e4ef22005-01-02 09:53:13 +000036825#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036826 int mem_base;
36827 int ret_val;
36828 int code; /* UCS code point */
36829 int n_code;
36830
36831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36832 mem_base = xmlMemBlocks();
36833 code = gen_int(n_code, 0);
36834
36835 ret_val = xmlUCSIsCatP(code);
36836 desret_int(ret_val);
36837 call_tests++;
36838 des_int(n_code, code, 0);
36839 xmlResetLastError();
36840 if (mem_base != xmlMemBlocks()) {
36841 printf("Leak of %d blocks found in xmlUCSIsCatP",
36842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036844 printf(" %d", n_code);
36845 printf("\n");
36846 }
36847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036849#endif
36850
Daniel Veillard42595322004-11-08 10:52:06 +000036851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036852}
36853
36854
36855static int
36856test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036858
William M. Brack21e4ef22005-01-02 09:53:13 +000036859#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036860 int mem_base;
36861 int ret_val;
36862 int code; /* UCS code point */
36863 int n_code;
36864
36865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36866 mem_base = xmlMemBlocks();
36867 code = gen_int(n_code, 0);
36868
36869 ret_val = xmlUCSIsCatPc(code);
36870 desret_int(ret_val);
36871 call_tests++;
36872 des_int(n_code, code, 0);
36873 xmlResetLastError();
36874 if (mem_base != xmlMemBlocks()) {
36875 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036878 printf(" %d", n_code);
36879 printf("\n");
36880 }
36881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036883#endif
36884
Daniel Veillard42595322004-11-08 10:52:06 +000036885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036886}
36887
36888
36889static int
36890test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036892
William M. Brack21e4ef22005-01-02 09:53:13 +000036893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036894 int mem_base;
36895 int ret_val;
36896 int code; /* UCS code point */
36897 int n_code;
36898
36899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36900 mem_base = xmlMemBlocks();
36901 code = gen_int(n_code, 0);
36902
36903 ret_val = xmlUCSIsCatPd(code);
36904 desret_int(ret_val);
36905 call_tests++;
36906 des_int(n_code, code, 0);
36907 xmlResetLastError();
36908 if (mem_base != xmlMemBlocks()) {
36909 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036912 printf(" %d", n_code);
36913 printf("\n");
36914 }
36915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036917#endif
36918
Daniel Veillard42595322004-11-08 10:52:06 +000036919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036920}
36921
36922
36923static int
36924test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036926
William M. Brack21e4ef22005-01-02 09:53:13 +000036927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036928 int mem_base;
36929 int ret_val;
36930 int code; /* UCS code point */
36931 int n_code;
36932
36933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36934 mem_base = xmlMemBlocks();
36935 code = gen_int(n_code, 0);
36936
36937 ret_val = xmlUCSIsCatPe(code);
36938 desret_int(ret_val);
36939 call_tests++;
36940 des_int(n_code, code, 0);
36941 xmlResetLastError();
36942 if (mem_base != xmlMemBlocks()) {
36943 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036946 printf(" %d", n_code);
36947 printf("\n");
36948 }
36949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036951#endif
36952
Daniel Veillard42595322004-11-08 10:52:06 +000036953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036954}
36955
36956
36957static int
36958test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036960
William M. Brack21e4ef22005-01-02 09:53:13 +000036961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036962 int mem_base;
36963 int ret_val;
36964 int code; /* UCS code point */
36965 int n_code;
36966
36967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36968 mem_base = xmlMemBlocks();
36969 code = gen_int(n_code, 0);
36970
36971 ret_val = xmlUCSIsCatPf(code);
36972 desret_int(ret_val);
36973 call_tests++;
36974 des_int(n_code, code, 0);
36975 xmlResetLastError();
36976 if (mem_base != xmlMemBlocks()) {
36977 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036980 printf(" %d", n_code);
36981 printf("\n");
36982 }
36983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036985#endif
36986
Daniel Veillard42595322004-11-08 10:52:06 +000036987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036988}
36989
36990
36991static int
36992test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036994
William M. Brack21e4ef22005-01-02 09:53:13 +000036995#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036996 int mem_base;
36997 int ret_val;
36998 int code; /* UCS code point */
36999 int n_code;
37000
37001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37002 mem_base = xmlMemBlocks();
37003 code = gen_int(n_code, 0);
37004
37005 ret_val = xmlUCSIsCatPi(code);
37006 desret_int(ret_val);
37007 call_tests++;
37008 des_int(n_code, code, 0);
37009 xmlResetLastError();
37010 if (mem_base != xmlMemBlocks()) {
37011 printf("Leak of %d blocks found in xmlUCSIsCatPi",
37012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037014 printf(" %d", n_code);
37015 printf("\n");
37016 }
37017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037019#endif
37020
Daniel Veillard42595322004-11-08 10:52:06 +000037021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037022}
37023
37024
37025static int
37026test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037028
William M. Brack21e4ef22005-01-02 09:53:13 +000037029#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037030 int mem_base;
37031 int ret_val;
37032 int code; /* UCS code point */
37033 int n_code;
37034
37035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37036 mem_base = xmlMemBlocks();
37037 code = gen_int(n_code, 0);
37038
37039 ret_val = xmlUCSIsCatPo(code);
37040 desret_int(ret_val);
37041 call_tests++;
37042 des_int(n_code, code, 0);
37043 xmlResetLastError();
37044 if (mem_base != xmlMemBlocks()) {
37045 printf("Leak of %d blocks found in xmlUCSIsCatPo",
37046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037048 printf(" %d", n_code);
37049 printf("\n");
37050 }
37051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037053#endif
37054
Daniel Veillard42595322004-11-08 10:52:06 +000037055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037056}
37057
37058
37059static int
37060test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037062
William M. Brack21e4ef22005-01-02 09:53:13 +000037063#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037064 int mem_base;
37065 int ret_val;
37066 int code; /* UCS code point */
37067 int n_code;
37068
37069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37070 mem_base = xmlMemBlocks();
37071 code = gen_int(n_code, 0);
37072
37073 ret_val = xmlUCSIsCatPs(code);
37074 desret_int(ret_val);
37075 call_tests++;
37076 des_int(n_code, code, 0);
37077 xmlResetLastError();
37078 if (mem_base != xmlMemBlocks()) {
37079 printf("Leak of %d blocks found in xmlUCSIsCatPs",
37080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037082 printf(" %d", n_code);
37083 printf("\n");
37084 }
37085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037087#endif
37088
Daniel Veillard42595322004-11-08 10:52:06 +000037089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037090}
37091
37092
37093static int
37094test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037095 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037096
William M. Brack21e4ef22005-01-02 09:53:13 +000037097#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037098 int mem_base;
37099 int ret_val;
37100 int code; /* UCS code point */
37101 int n_code;
37102
37103 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37104 mem_base = xmlMemBlocks();
37105 code = gen_int(n_code, 0);
37106
37107 ret_val = xmlUCSIsCatS(code);
37108 desret_int(ret_val);
37109 call_tests++;
37110 des_int(n_code, code, 0);
37111 xmlResetLastError();
37112 if (mem_base != xmlMemBlocks()) {
37113 printf("Leak of %d blocks found in xmlUCSIsCatS",
37114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037115 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037116 printf(" %d", n_code);
37117 printf("\n");
37118 }
37119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037120 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037121#endif
37122
Daniel Veillard42595322004-11-08 10:52:06 +000037123 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037124}
37125
37126
37127static int
37128test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037130
William M. Brack21e4ef22005-01-02 09:53:13 +000037131#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037132 int mem_base;
37133 int ret_val;
37134 int code; /* UCS code point */
37135 int n_code;
37136
37137 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37138 mem_base = xmlMemBlocks();
37139 code = gen_int(n_code, 0);
37140
37141 ret_val = xmlUCSIsCatSc(code);
37142 desret_int(ret_val);
37143 call_tests++;
37144 des_int(n_code, code, 0);
37145 xmlResetLastError();
37146 if (mem_base != xmlMemBlocks()) {
37147 printf("Leak of %d blocks found in xmlUCSIsCatSc",
37148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037149 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037150 printf(" %d", n_code);
37151 printf("\n");
37152 }
37153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037154 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037155#endif
37156
Daniel Veillard42595322004-11-08 10:52:06 +000037157 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037158}
37159
37160
37161static int
37162test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037163 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037164
William M. Brack21e4ef22005-01-02 09:53:13 +000037165#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037166 int mem_base;
37167 int ret_val;
37168 int code; /* UCS code point */
37169 int n_code;
37170
37171 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37172 mem_base = xmlMemBlocks();
37173 code = gen_int(n_code, 0);
37174
37175 ret_val = xmlUCSIsCatSk(code);
37176 desret_int(ret_val);
37177 call_tests++;
37178 des_int(n_code, code, 0);
37179 xmlResetLastError();
37180 if (mem_base != xmlMemBlocks()) {
37181 printf("Leak of %d blocks found in xmlUCSIsCatSk",
37182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037183 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037184 printf(" %d", n_code);
37185 printf("\n");
37186 }
37187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037188 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037189#endif
37190
Daniel Veillard42595322004-11-08 10:52:06 +000037191 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037192}
37193
37194
37195static int
37196test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037197 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037198
William M. Brack21e4ef22005-01-02 09:53:13 +000037199#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037200 int mem_base;
37201 int ret_val;
37202 int code; /* UCS code point */
37203 int n_code;
37204
37205 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37206 mem_base = xmlMemBlocks();
37207 code = gen_int(n_code, 0);
37208
37209 ret_val = xmlUCSIsCatSm(code);
37210 desret_int(ret_val);
37211 call_tests++;
37212 des_int(n_code, code, 0);
37213 xmlResetLastError();
37214 if (mem_base != xmlMemBlocks()) {
37215 printf("Leak of %d blocks found in xmlUCSIsCatSm",
37216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037217 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037218 printf(" %d", n_code);
37219 printf("\n");
37220 }
37221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037222 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037223#endif
37224
Daniel Veillard42595322004-11-08 10:52:06 +000037225 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037226}
37227
37228
37229static int
37230test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037231 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037232
William M. Brack21e4ef22005-01-02 09:53:13 +000037233#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037234 int mem_base;
37235 int ret_val;
37236 int code; /* UCS code point */
37237 int n_code;
37238
37239 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37240 mem_base = xmlMemBlocks();
37241 code = gen_int(n_code, 0);
37242
37243 ret_val = xmlUCSIsCatSo(code);
37244 desret_int(ret_val);
37245 call_tests++;
37246 des_int(n_code, code, 0);
37247 xmlResetLastError();
37248 if (mem_base != xmlMemBlocks()) {
37249 printf("Leak of %d blocks found in xmlUCSIsCatSo",
37250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037251 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037252 printf(" %d", n_code);
37253 printf("\n");
37254 }
37255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037256 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037257#endif
37258
Daniel Veillard42595322004-11-08 10:52:06 +000037259 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037260}
37261
37262
37263static int
37264test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037265 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037266
William M. Brack21e4ef22005-01-02 09:53:13 +000037267#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037268 int mem_base;
37269 int ret_val;
37270 int code; /* UCS code point */
37271 int n_code;
37272
37273 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37274 mem_base = xmlMemBlocks();
37275 code = gen_int(n_code, 0);
37276
37277 ret_val = xmlUCSIsCatZ(code);
37278 desret_int(ret_val);
37279 call_tests++;
37280 des_int(n_code, code, 0);
37281 xmlResetLastError();
37282 if (mem_base != xmlMemBlocks()) {
37283 printf("Leak of %d blocks found in xmlUCSIsCatZ",
37284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037285 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037286 printf(" %d", n_code);
37287 printf("\n");
37288 }
37289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037290 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037291#endif
37292
Daniel Veillard42595322004-11-08 10:52:06 +000037293 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037294}
37295
37296
37297static int
37298test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037299 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037300
William M. Brack21e4ef22005-01-02 09:53:13 +000037301#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037302 int mem_base;
37303 int ret_val;
37304 int code; /* UCS code point */
37305 int n_code;
37306
37307 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37308 mem_base = xmlMemBlocks();
37309 code = gen_int(n_code, 0);
37310
37311 ret_val = xmlUCSIsCatZl(code);
37312 desret_int(ret_val);
37313 call_tests++;
37314 des_int(n_code, code, 0);
37315 xmlResetLastError();
37316 if (mem_base != xmlMemBlocks()) {
37317 printf("Leak of %d blocks found in xmlUCSIsCatZl",
37318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037319 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037320 printf(" %d", n_code);
37321 printf("\n");
37322 }
37323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037324 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037325#endif
37326
Daniel Veillard42595322004-11-08 10:52:06 +000037327 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037328}
37329
37330
37331static int
37332test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037333 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037334
William M. Brack21e4ef22005-01-02 09:53:13 +000037335#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037336 int mem_base;
37337 int ret_val;
37338 int code; /* UCS code point */
37339 int n_code;
37340
37341 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37342 mem_base = xmlMemBlocks();
37343 code = gen_int(n_code, 0);
37344
37345 ret_val = xmlUCSIsCatZp(code);
37346 desret_int(ret_val);
37347 call_tests++;
37348 des_int(n_code, code, 0);
37349 xmlResetLastError();
37350 if (mem_base != xmlMemBlocks()) {
37351 printf("Leak of %d blocks found in xmlUCSIsCatZp",
37352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037353 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037354 printf(" %d", n_code);
37355 printf("\n");
37356 }
37357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037358 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037359#endif
37360
Daniel Veillard42595322004-11-08 10:52:06 +000037361 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037362}
37363
37364
37365static int
37366test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037367 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037368
William M. Brack21e4ef22005-01-02 09:53:13 +000037369#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037370 int mem_base;
37371 int ret_val;
37372 int code; /* UCS code point */
37373 int n_code;
37374
37375 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37376 mem_base = xmlMemBlocks();
37377 code = gen_int(n_code, 0);
37378
37379 ret_val = xmlUCSIsCatZs(code);
37380 desret_int(ret_val);
37381 call_tests++;
37382 des_int(n_code, code, 0);
37383 xmlResetLastError();
37384 if (mem_base != xmlMemBlocks()) {
37385 printf("Leak of %d blocks found in xmlUCSIsCatZs",
37386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037387 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037388 printf(" %d", n_code);
37389 printf("\n");
37390 }
37391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037392 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037393#endif
37394
Daniel Veillard42595322004-11-08 10:52:06 +000037395 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037396}
37397
37398
37399static int
37400test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037401 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037402
William M. Brack21e4ef22005-01-02 09:53:13 +000037403#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037404 int mem_base;
37405 int ret_val;
37406 int code; /* UCS code point */
37407 int n_code;
37408
37409 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37410 mem_base = xmlMemBlocks();
37411 code = gen_int(n_code, 0);
37412
37413 ret_val = xmlUCSIsCherokee(code);
37414 desret_int(ret_val);
37415 call_tests++;
37416 des_int(n_code, code, 0);
37417 xmlResetLastError();
37418 if (mem_base != xmlMemBlocks()) {
37419 printf("Leak of %d blocks found in xmlUCSIsCherokee",
37420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037421 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037422 printf(" %d", n_code);
37423 printf("\n");
37424 }
37425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037426 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037427#endif
37428
Daniel Veillard42595322004-11-08 10:52:06 +000037429 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037430}
37431
37432
37433static int
37434test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037435 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037436
William M. Brack21e4ef22005-01-02 09:53:13 +000037437#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037438 int mem_base;
37439 int ret_val;
37440 int code; /* UCS code point */
37441 int n_code;
37442
37443 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37444 mem_base = xmlMemBlocks();
37445 code = gen_int(n_code, 0);
37446
37447 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
37448 desret_int(ret_val);
37449 call_tests++;
37450 des_int(n_code, code, 0);
37451 xmlResetLastError();
37452 if (mem_base != xmlMemBlocks()) {
37453 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
37454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037455 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037456 printf(" %d", n_code);
37457 printf("\n");
37458 }
37459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037460 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037461#endif
37462
Daniel Veillard42595322004-11-08 10:52:06 +000037463 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037464}
37465
37466
37467static int
37468test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037469 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037470
William M. Brack21e4ef22005-01-02 09:53:13 +000037471#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037472 int mem_base;
37473 int ret_val;
37474 int code; /* UCS code point */
37475 int n_code;
37476
37477 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37478 mem_base = xmlMemBlocks();
37479 code = gen_int(n_code, 0);
37480
37481 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
37482 desret_int(ret_val);
37483 call_tests++;
37484 des_int(n_code, code, 0);
37485 xmlResetLastError();
37486 if (mem_base != xmlMemBlocks()) {
37487 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
37488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037489 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037490 printf(" %d", n_code);
37491 printf("\n");
37492 }
37493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037494 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037495#endif
37496
Daniel Veillard42595322004-11-08 10:52:06 +000037497 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037498}
37499
37500
37501static int
37502test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037503 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037504
William M. Brack21e4ef22005-01-02 09:53:13 +000037505#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037506 int mem_base;
37507 int ret_val;
37508 int code; /* UCS code point */
37509 int n_code;
37510
37511 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37512 mem_base = xmlMemBlocks();
37513 code = gen_int(n_code, 0);
37514
37515 ret_val = xmlUCSIsCombiningHalfMarks(code);
37516 desret_int(ret_val);
37517 call_tests++;
37518 des_int(n_code, code, 0);
37519 xmlResetLastError();
37520 if (mem_base != xmlMemBlocks()) {
37521 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
37522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037523 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037524 printf(" %d", n_code);
37525 printf("\n");
37526 }
37527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037528 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037529#endif
37530
Daniel Veillard42595322004-11-08 10:52:06 +000037531 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037532}
37533
37534
37535static int
37536test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037537 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037538
William M. Brack21e4ef22005-01-02 09:53:13 +000037539#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037540 int mem_base;
37541 int ret_val;
37542 int code; /* UCS code point */
37543 int n_code;
37544
37545 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37546 mem_base = xmlMemBlocks();
37547 code = gen_int(n_code, 0);
37548
37549 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
37550 desret_int(ret_val);
37551 call_tests++;
37552 des_int(n_code, code, 0);
37553 xmlResetLastError();
37554 if (mem_base != xmlMemBlocks()) {
37555 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
37556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037557 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037558 printf(" %d", n_code);
37559 printf("\n");
37560 }
37561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037562 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037563#endif
37564
Daniel Veillard42595322004-11-08 10:52:06 +000037565 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037566}
37567
37568
37569static int
37570test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037571 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037572
William M. Brack21e4ef22005-01-02 09:53:13 +000037573#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037574 int mem_base;
37575 int ret_val;
37576 int code; /* UCS code point */
37577 int n_code;
37578
37579 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37580 mem_base = xmlMemBlocks();
37581 code = gen_int(n_code, 0);
37582
37583 ret_val = xmlUCSIsControlPictures(code);
37584 desret_int(ret_val);
37585 call_tests++;
37586 des_int(n_code, code, 0);
37587 xmlResetLastError();
37588 if (mem_base != xmlMemBlocks()) {
37589 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
37590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037591 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037592 printf(" %d", n_code);
37593 printf("\n");
37594 }
37595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037596 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037597#endif
37598
Daniel Veillard42595322004-11-08 10:52:06 +000037599 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037600}
37601
37602
37603static int
37604test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037605 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037606
William M. Brack21e4ef22005-01-02 09:53:13 +000037607#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037608 int mem_base;
37609 int ret_val;
37610 int code; /* UCS code point */
37611 int n_code;
37612
37613 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37614 mem_base = xmlMemBlocks();
37615 code = gen_int(n_code, 0);
37616
37617 ret_val = xmlUCSIsCurrencySymbols(code);
37618 desret_int(ret_val);
37619 call_tests++;
37620 des_int(n_code, code, 0);
37621 xmlResetLastError();
37622 if (mem_base != xmlMemBlocks()) {
37623 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
37624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037625 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037626 printf(" %d", n_code);
37627 printf("\n");
37628 }
37629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037630 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037631#endif
37632
Daniel Veillard42595322004-11-08 10:52:06 +000037633 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037634}
37635
37636
37637static int
37638test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037639 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037640
William M. Brack21e4ef22005-01-02 09:53:13 +000037641#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037642 int mem_base;
37643 int ret_val;
37644 int code; /* UCS code point */
37645 int n_code;
37646
37647 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37648 mem_base = xmlMemBlocks();
37649 code = gen_int(n_code, 0);
37650
37651 ret_val = xmlUCSIsCypriotSyllabary(code);
37652 desret_int(ret_val);
37653 call_tests++;
37654 des_int(n_code, code, 0);
37655 xmlResetLastError();
37656 if (mem_base != xmlMemBlocks()) {
37657 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
37658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037659 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037660 printf(" %d", n_code);
37661 printf("\n");
37662 }
37663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037664 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037665#endif
37666
Daniel Veillard42595322004-11-08 10:52:06 +000037667 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037668}
37669
37670
37671static int
37672test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037673 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037674
William M. Brack21e4ef22005-01-02 09:53:13 +000037675#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037676 int mem_base;
37677 int ret_val;
37678 int code; /* UCS code point */
37679 int n_code;
37680
37681 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37682 mem_base = xmlMemBlocks();
37683 code = gen_int(n_code, 0);
37684
37685 ret_val = xmlUCSIsCyrillic(code);
37686 desret_int(ret_val);
37687 call_tests++;
37688 des_int(n_code, code, 0);
37689 xmlResetLastError();
37690 if (mem_base != xmlMemBlocks()) {
37691 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
37692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037693 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037694 printf(" %d", n_code);
37695 printf("\n");
37696 }
37697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037698 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037699#endif
37700
Daniel Veillard42595322004-11-08 10:52:06 +000037701 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037702}
37703
37704
37705static int
37706test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037707 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037708
William M. Brack21e4ef22005-01-02 09:53:13 +000037709#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037710 int mem_base;
37711 int ret_val;
37712 int code; /* UCS code point */
37713 int n_code;
37714
37715 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37716 mem_base = xmlMemBlocks();
37717 code = gen_int(n_code, 0);
37718
37719 ret_val = xmlUCSIsCyrillicSupplement(code);
37720 desret_int(ret_val);
37721 call_tests++;
37722 des_int(n_code, code, 0);
37723 xmlResetLastError();
37724 if (mem_base != xmlMemBlocks()) {
37725 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
37726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037727 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037728 printf(" %d", n_code);
37729 printf("\n");
37730 }
37731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037732 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037733#endif
37734
Daniel Veillard42595322004-11-08 10:52:06 +000037735 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037736}
37737
37738
37739static int
37740test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037741 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037742
William M. Brack21e4ef22005-01-02 09:53:13 +000037743#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037744 int mem_base;
37745 int ret_val;
37746 int code; /* UCS code point */
37747 int n_code;
37748
37749 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37750 mem_base = xmlMemBlocks();
37751 code = gen_int(n_code, 0);
37752
37753 ret_val = xmlUCSIsDeseret(code);
37754 desret_int(ret_val);
37755 call_tests++;
37756 des_int(n_code, code, 0);
37757 xmlResetLastError();
37758 if (mem_base != xmlMemBlocks()) {
37759 printf("Leak of %d blocks found in xmlUCSIsDeseret",
37760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037761 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037762 printf(" %d", n_code);
37763 printf("\n");
37764 }
37765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037766 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037767#endif
37768
Daniel Veillard42595322004-11-08 10:52:06 +000037769 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037770}
37771
37772
37773static int
37774test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037775 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037776
William M. Brack21e4ef22005-01-02 09:53:13 +000037777#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037778 int mem_base;
37779 int ret_val;
37780 int code; /* UCS code point */
37781 int n_code;
37782
37783 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37784 mem_base = xmlMemBlocks();
37785 code = gen_int(n_code, 0);
37786
37787 ret_val = xmlUCSIsDevanagari(code);
37788 desret_int(ret_val);
37789 call_tests++;
37790 des_int(n_code, code, 0);
37791 xmlResetLastError();
37792 if (mem_base != xmlMemBlocks()) {
37793 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
37794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037795 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037796 printf(" %d", n_code);
37797 printf("\n");
37798 }
37799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037800 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037801#endif
37802
Daniel Veillard42595322004-11-08 10:52:06 +000037803 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037804}
37805
37806
37807static int
37808test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037809 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037810
William M. Brack21e4ef22005-01-02 09:53:13 +000037811#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037812 int mem_base;
37813 int ret_val;
37814 int code; /* UCS code point */
37815 int n_code;
37816
37817 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37818 mem_base = xmlMemBlocks();
37819 code = gen_int(n_code, 0);
37820
37821 ret_val = xmlUCSIsDingbats(code);
37822 desret_int(ret_val);
37823 call_tests++;
37824 des_int(n_code, code, 0);
37825 xmlResetLastError();
37826 if (mem_base != xmlMemBlocks()) {
37827 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037829 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037830 printf(" %d", n_code);
37831 printf("\n");
37832 }
37833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037834 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037835#endif
37836
Daniel Veillard42595322004-11-08 10:52:06 +000037837 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037838}
37839
37840
37841static int
37842test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037843 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037844
William M. Brack21e4ef22005-01-02 09:53:13 +000037845#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037846 int mem_base;
37847 int ret_val;
37848 int code; /* UCS code point */
37849 int n_code;
37850
37851 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37852 mem_base = xmlMemBlocks();
37853 code = gen_int(n_code, 0);
37854
37855 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37856 desret_int(ret_val);
37857 call_tests++;
37858 des_int(n_code, code, 0);
37859 xmlResetLastError();
37860 if (mem_base != xmlMemBlocks()) {
37861 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037863 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037864 printf(" %d", n_code);
37865 printf("\n");
37866 }
37867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037868 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037869#endif
37870
Daniel Veillard42595322004-11-08 10:52:06 +000037871 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037872}
37873
37874
37875static int
37876test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037877 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037878
William M. Brack21e4ef22005-01-02 09:53:13 +000037879#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037880 int mem_base;
37881 int ret_val;
37882 int code; /* UCS code point */
37883 int n_code;
37884
37885 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37886 mem_base = xmlMemBlocks();
37887 code = gen_int(n_code, 0);
37888
37889 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37890 desret_int(ret_val);
37891 call_tests++;
37892 des_int(n_code, code, 0);
37893 xmlResetLastError();
37894 if (mem_base != xmlMemBlocks()) {
37895 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037897 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037898 printf(" %d", n_code);
37899 printf("\n");
37900 }
37901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037902 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037903#endif
37904
Daniel Veillard42595322004-11-08 10:52:06 +000037905 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037906}
37907
37908
37909static int
37910test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037911 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037912
William M. Brack21e4ef22005-01-02 09:53:13 +000037913#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037914 int mem_base;
37915 int ret_val;
37916 int code; /* UCS code point */
37917 int n_code;
37918
37919 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37920 mem_base = xmlMemBlocks();
37921 code = gen_int(n_code, 0);
37922
37923 ret_val = xmlUCSIsEthiopic(code);
37924 desret_int(ret_val);
37925 call_tests++;
37926 des_int(n_code, code, 0);
37927 xmlResetLastError();
37928 if (mem_base != xmlMemBlocks()) {
37929 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037931 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037932 printf(" %d", n_code);
37933 printf("\n");
37934 }
37935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037936 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037937#endif
37938
Daniel Veillard42595322004-11-08 10:52:06 +000037939 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037940}
37941
37942
37943static int
37944test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037945 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037946
William M. Brack21e4ef22005-01-02 09:53:13 +000037947#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037948 int mem_base;
37949 int ret_val;
37950 int code; /* UCS code point */
37951 int n_code;
37952
37953 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37954 mem_base = xmlMemBlocks();
37955 code = gen_int(n_code, 0);
37956
37957 ret_val = xmlUCSIsGeneralPunctuation(code);
37958 desret_int(ret_val);
37959 call_tests++;
37960 des_int(n_code, code, 0);
37961 xmlResetLastError();
37962 if (mem_base != xmlMemBlocks()) {
37963 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037965 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037966 printf(" %d", n_code);
37967 printf("\n");
37968 }
37969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037970 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037971#endif
37972
Daniel Veillard42595322004-11-08 10:52:06 +000037973 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037974}
37975
37976
37977static int
37978test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037979 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037980
William M. Brack21e4ef22005-01-02 09:53:13 +000037981#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037982 int mem_base;
37983 int ret_val;
37984 int code; /* UCS code point */
37985 int n_code;
37986
37987 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37988 mem_base = xmlMemBlocks();
37989 code = gen_int(n_code, 0);
37990
37991 ret_val = xmlUCSIsGeometricShapes(code);
37992 desret_int(ret_val);
37993 call_tests++;
37994 des_int(n_code, code, 0);
37995 xmlResetLastError();
37996 if (mem_base != xmlMemBlocks()) {
37997 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037999 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038000 printf(" %d", n_code);
38001 printf("\n");
38002 }
38003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038004 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038005#endif
38006
Daniel Veillard42595322004-11-08 10:52:06 +000038007 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038008}
38009
38010
38011static int
38012test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038013 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038014
William M. Brack21e4ef22005-01-02 09:53:13 +000038015#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038016 int mem_base;
38017 int ret_val;
38018 int code; /* UCS code point */
38019 int n_code;
38020
38021 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38022 mem_base = xmlMemBlocks();
38023 code = gen_int(n_code, 0);
38024
38025 ret_val = xmlUCSIsGeorgian(code);
38026 desret_int(ret_val);
38027 call_tests++;
38028 des_int(n_code, code, 0);
38029 xmlResetLastError();
38030 if (mem_base != xmlMemBlocks()) {
38031 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
38032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038033 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038034 printf(" %d", n_code);
38035 printf("\n");
38036 }
38037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038038 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038039#endif
38040
Daniel Veillard42595322004-11-08 10:52:06 +000038041 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038042}
38043
38044
38045static int
38046test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038047 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038048
William M. Brack21e4ef22005-01-02 09:53:13 +000038049#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038050 int mem_base;
38051 int ret_val;
38052 int code; /* UCS code point */
38053 int n_code;
38054
38055 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38056 mem_base = xmlMemBlocks();
38057 code = gen_int(n_code, 0);
38058
38059 ret_val = xmlUCSIsGothic(code);
38060 desret_int(ret_val);
38061 call_tests++;
38062 des_int(n_code, code, 0);
38063 xmlResetLastError();
38064 if (mem_base != xmlMemBlocks()) {
38065 printf("Leak of %d blocks found in xmlUCSIsGothic",
38066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038067 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038068 printf(" %d", n_code);
38069 printf("\n");
38070 }
38071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038072 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038073#endif
38074
Daniel Veillard42595322004-11-08 10:52:06 +000038075 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038076}
38077
38078
38079static int
38080test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038081 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038082
William M. Brack21e4ef22005-01-02 09:53:13 +000038083#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038084 int mem_base;
38085 int ret_val;
38086 int code; /* UCS code point */
38087 int n_code;
38088
38089 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38090 mem_base = xmlMemBlocks();
38091 code = gen_int(n_code, 0);
38092
38093 ret_val = xmlUCSIsGreek(code);
38094 desret_int(ret_val);
38095 call_tests++;
38096 des_int(n_code, code, 0);
38097 xmlResetLastError();
38098 if (mem_base != xmlMemBlocks()) {
38099 printf("Leak of %d blocks found in xmlUCSIsGreek",
38100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038101 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038102 printf(" %d", n_code);
38103 printf("\n");
38104 }
38105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038106 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038107#endif
38108
Daniel Veillard42595322004-11-08 10:52:06 +000038109 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038110}
38111
38112
38113static int
38114test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038115 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038116
William M. Brack21e4ef22005-01-02 09:53:13 +000038117#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038118 int mem_base;
38119 int ret_val;
38120 int code; /* UCS code point */
38121 int n_code;
38122
38123 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38124 mem_base = xmlMemBlocks();
38125 code = gen_int(n_code, 0);
38126
38127 ret_val = xmlUCSIsGreekExtended(code);
38128 desret_int(ret_val);
38129 call_tests++;
38130 des_int(n_code, code, 0);
38131 xmlResetLastError();
38132 if (mem_base != xmlMemBlocks()) {
38133 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
38134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038135 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038136 printf(" %d", n_code);
38137 printf("\n");
38138 }
38139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038140 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038141#endif
38142
Daniel Veillard42595322004-11-08 10:52:06 +000038143 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038144}
38145
38146
38147static int
38148test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038149 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038150
William M. Brack21e4ef22005-01-02 09:53:13 +000038151#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038152 int mem_base;
38153 int ret_val;
38154 int code; /* UCS code point */
38155 int n_code;
38156
38157 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38158 mem_base = xmlMemBlocks();
38159 code = gen_int(n_code, 0);
38160
38161 ret_val = xmlUCSIsGreekandCoptic(code);
38162 desret_int(ret_val);
38163 call_tests++;
38164 des_int(n_code, code, 0);
38165 xmlResetLastError();
38166 if (mem_base != xmlMemBlocks()) {
38167 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
38168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038169 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038170 printf(" %d", n_code);
38171 printf("\n");
38172 }
38173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038174 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038175#endif
38176
Daniel Veillard42595322004-11-08 10:52:06 +000038177 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038178}
38179
38180
38181static int
38182test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038183 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038184
William M. Brack21e4ef22005-01-02 09:53:13 +000038185#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038186 int mem_base;
38187 int ret_val;
38188 int code; /* UCS code point */
38189 int n_code;
38190
38191 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38192 mem_base = xmlMemBlocks();
38193 code = gen_int(n_code, 0);
38194
38195 ret_val = xmlUCSIsGujarati(code);
38196 desret_int(ret_val);
38197 call_tests++;
38198 des_int(n_code, code, 0);
38199 xmlResetLastError();
38200 if (mem_base != xmlMemBlocks()) {
38201 printf("Leak of %d blocks found in xmlUCSIsGujarati",
38202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038203 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038204 printf(" %d", n_code);
38205 printf("\n");
38206 }
38207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038208 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038209#endif
38210
Daniel Veillard42595322004-11-08 10:52:06 +000038211 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038212}
38213
38214
38215static int
38216test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038217 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038218
William M. Brack21e4ef22005-01-02 09:53:13 +000038219#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038220 int mem_base;
38221 int ret_val;
38222 int code; /* UCS code point */
38223 int n_code;
38224
38225 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38226 mem_base = xmlMemBlocks();
38227 code = gen_int(n_code, 0);
38228
38229 ret_val = xmlUCSIsGurmukhi(code);
38230 desret_int(ret_val);
38231 call_tests++;
38232 des_int(n_code, code, 0);
38233 xmlResetLastError();
38234 if (mem_base != xmlMemBlocks()) {
38235 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
38236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038237 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038238 printf(" %d", n_code);
38239 printf("\n");
38240 }
38241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038242 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038243#endif
38244
Daniel Veillard42595322004-11-08 10:52:06 +000038245 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038246}
38247
38248
38249static int
38250test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038251 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038252
William M. Brack21e4ef22005-01-02 09:53:13 +000038253#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038254 int mem_base;
38255 int ret_val;
38256 int code; /* UCS code point */
38257 int n_code;
38258
38259 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38260 mem_base = xmlMemBlocks();
38261 code = gen_int(n_code, 0);
38262
38263 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
38264 desret_int(ret_val);
38265 call_tests++;
38266 des_int(n_code, code, 0);
38267 xmlResetLastError();
38268 if (mem_base != xmlMemBlocks()) {
38269 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
38270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038271 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038272 printf(" %d", n_code);
38273 printf("\n");
38274 }
38275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038276 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038277#endif
38278
Daniel Veillard42595322004-11-08 10:52:06 +000038279 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038280}
38281
38282
38283static int
38284test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038285 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038286
William M. Brack21e4ef22005-01-02 09:53:13 +000038287#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038288 int mem_base;
38289 int ret_val;
38290 int code; /* UCS code point */
38291 int n_code;
38292
38293 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38294 mem_base = xmlMemBlocks();
38295 code = gen_int(n_code, 0);
38296
38297 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
38298 desret_int(ret_val);
38299 call_tests++;
38300 des_int(n_code, code, 0);
38301 xmlResetLastError();
38302 if (mem_base != xmlMemBlocks()) {
38303 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
38304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038305 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038306 printf(" %d", n_code);
38307 printf("\n");
38308 }
38309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038310 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038311#endif
38312
Daniel Veillard42595322004-11-08 10:52:06 +000038313 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038314}
38315
38316
38317static int
38318test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038319 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038320
William M. Brack21e4ef22005-01-02 09:53:13 +000038321#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038322 int mem_base;
38323 int ret_val;
38324 int code; /* UCS code point */
38325 int n_code;
38326
38327 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38328 mem_base = xmlMemBlocks();
38329 code = gen_int(n_code, 0);
38330
38331 ret_val = xmlUCSIsHangulJamo(code);
38332 desret_int(ret_val);
38333 call_tests++;
38334 des_int(n_code, code, 0);
38335 xmlResetLastError();
38336 if (mem_base != xmlMemBlocks()) {
38337 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
38338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038339 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038340 printf(" %d", n_code);
38341 printf("\n");
38342 }
38343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038344 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038345#endif
38346
Daniel Veillard42595322004-11-08 10:52:06 +000038347 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038348}
38349
38350
38351static int
38352test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038353 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038354
William M. Brack21e4ef22005-01-02 09:53:13 +000038355#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038356 int mem_base;
38357 int ret_val;
38358 int code; /* UCS code point */
38359 int n_code;
38360
38361 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38362 mem_base = xmlMemBlocks();
38363 code = gen_int(n_code, 0);
38364
38365 ret_val = xmlUCSIsHangulSyllables(code);
38366 desret_int(ret_val);
38367 call_tests++;
38368 des_int(n_code, code, 0);
38369 xmlResetLastError();
38370 if (mem_base != xmlMemBlocks()) {
38371 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
38372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038373 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038374 printf(" %d", n_code);
38375 printf("\n");
38376 }
38377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038378 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038379#endif
38380
Daniel Veillard42595322004-11-08 10:52:06 +000038381 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038382}
38383
38384
38385static int
38386test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038387 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038388
William M. Brack21e4ef22005-01-02 09:53:13 +000038389#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038390 int mem_base;
38391 int ret_val;
38392 int code; /* UCS code point */
38393 int n_code;
38394
38395 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38396 mem_base = xmlMemBlocks();
38397 code = gen_int(n_code, 0);
38398
38399 ret_val = xmlUCSIsHanunoo(code);
38400 desret_int(ret_val);
38401 call_tests++;
38402 des_int(n_code, code, 0);
38403 xmlResetLastError();
38404 if (mem_base != xmlMemBlocks()) {
38405 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
38406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038407 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038408 printf(" %d", n_code);
38409 printf("\n");
38410 }
38411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038412 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038413#endif
38414
Daniel Veillard42595322004-11-08 10:52:06 +000038415 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038416}
38417
38418
38419static int
38420test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038421 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038422
William M. Brack21e4ef22005-01-02 09:53:13 +000038423#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038424 int mem_base;
38425 int ret_val;
38426 int code; /* UCS code point */
38427 int n_code;
38428
38429 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38430 mem_base = xmlMemBlocks();
38431 code = gen_int(n_code, 0);
38432
38433 ret_val = xmlUCSIsHebrew(code);
38434 desret_int(ret_val);
38435 call_tests++;
38436 des_int(n_code, code, 0);
38437 xmlResetLastError();
38438 if (mem_base != xmlMemBlocks()) {
38439 printf("Leak of %d blocks found in xmlUCSIsHebrew",
38440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038441 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038442 printf(" %d", n_code);
38443 printf("\n");
38444 }
38445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038446 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038447#endif
38448
Daniel Veillard42595322004-11-08 10:52:06 +000038449 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038450}
38451
38452
38453static int
38454test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038455 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038456
William M. Brack21e4ef22005-01-02 09:53:13 +000038457#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038458 int mem_base;
38459 int ret_val;
38460 int code; /* UCS code point */
38461 int n_code;
38462
38463 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38464 mem_base = xmlMemBlocks();
38465 code = gen_int(n_code, 0);
38466
38467 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
38468 desret_int(ret_val);
38469 call_tests++;
38470 des_int(n_code, code, 0);
38471 xmlResetLastError();
38472 if (mem_base != xmlMemBlocks()) {
38473 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
38474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038475 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038476 printf(" %d", n_code);
38477 printf("\n");
38478 }
38479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038480 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038481#endif
38482
Daniel Veillard42595322004-11-08 10:52:06 +000038483 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038484}
38485
38486
38487static int
38488test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038489 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038490
William M. Brack21e4ef22005-01-02 09:53:13 +000038491#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038492 int mem_base;
38493 int ret_val;
38494 int code; /* UCS code point */
38495 int n_code;
38496
38497 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38498 mem_base = xmlMemBlocks();
38499 code = gen_int(n_code, 0);
38500
38501 ret_val = xmlUCSIsHighSurrogates(code);
38502 desret_int(ret_val);
38503 call_tests++;
38504 des_int(n_code, code, 0);
38505 xmlResetLastError();
38506 if (mem_base != xmlMemBlocks()) {
38507 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
38508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038509 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038510 printf(" %d", n_code);
38511 printf("\n");
38512 }
38513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038514 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038515#endif
38516
Daniel Veillard42595322004-11-08 10:52:06 +000038517 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038518}
38519
38520
38521static int
38522test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038523 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038524
William M. Brack21e4ef22005-01-02 09:53:13 +000038525#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038526 int mem_base;
38527 int ret_val;
38528 int code; /* UCS code point */
38529 int n_code;
38530
38531 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38532 mem_base = xmlMemBlocks();
38533 code = gen_int(n_code, 0);
38534
38535 ret_val = xmlUCSIsHiragana(code);
38536 desret_int(ret_val);
38537 call_tests++;
38538 des_int(n_code, code, 0);
38539 xmlResetLastError();
38540 if (mem_base != xmlMemBlocks()) {
38541 printf("Leak of %d blocks found in xmlUCSIsHiragana",
38542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038543 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038544 printf(" %d", n_code);
38545 printf("\n");
38546 }
38547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038548 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038549#endif
38550
Daniel Veillard42595322004-11-08 10:52:06 +000038551 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038552}
38553
38554
38555static int
38556test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038557 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038558
William M. Brack21e4ef22005-01-02 09:53:13 +000038559#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038560 int mem_base;
38561 int ret_val;
38562 int code; /* UCS code point */
38563 int n_code;
38564
38565 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38566 mem_base = xmlMemBlocks();
38567 code = gen_int(n_code, 0);
38568
38569 ret_val = xmlUCSIsIPAExtensions(code);
38570 desret_int(ret_val);
38571 call_tests++;
38572 des_int(n_code, code, 0);
38573 xmlResetLastError();
38574 if (mem_base != xmlMemBlocks()) {
38575 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
38576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038577 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038578 printf(" %d", n_code);
38579 printf("\n");
38580 }
38581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038582 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038583#endif
38584
Daniel Veillard42595322004-11-08 10:52:06 +000038585 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038586}
38587
38588
38589static int
38590test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038591 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038592
William M. Brack21e4ef22005-01-02 09:53:13 +000038593#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038594 int mem_base;
38595 int ret_val;
38596 int code; /* UCS code point */
38597 int n_code;
38598
38599 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38600 mem_base = xmlMemBlocks();
38601 code = gen_int(n_code, 0);
38602
38603 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
38604 desret_int(ret_val);
38605 call_tests++;
38606 des_int(n_code, code, 0);
38607 xmlResetLastError();
38608 if (mem_base != xmlMemBlocks()) {
38609 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
38610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038611 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038612 printf(" %d", n_code);
38613 printf("\n");
38614 }
38615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038616 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038617#endif
38618
Daniel Veillard42595322004-11-08 10:52:06 +000038619 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038620}
38621
38622
38623static int
38624test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038625 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038626
William M. Brack21e4ef22005-01-02 09:53:13 +000038627#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038628 int mem_base;
38629 int ret_val;
38630 int code; /* UCS code point */
38631 int n_code;
38632
38633 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38634 mem_base = xmlMemBlocks();
38635 code = gen_int(n_code, 0);
38636
38637 ret_val = xmlUCSIsKanbun(code);
38638 desret_int(ret_val);
38639 call_tests++;
38640 des_int(n_code, code, 0);
38641 xmlResetLastError();
38642 if (mem_base != xmlMemBlocks()) {
38643 printf("Leak of %d blocks found in xmlUCSIsKanbun",
38644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038645 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038646 printf(" %d", n_code);
38647 printf("\n");
38648 }
38649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038650 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038651#endif
38652
Daniel Veillard42595322004-11-08 10:52:06 +000038653 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038654}
38655
38656
38657static int
38658test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038659 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038660
William M. Brack21e4ef22005-01-02 09:53:13 +000038661#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038662 int mem_base;
38663 int ret_val;
38664 int code; /* UCS code point */
38665 int n_code;
38666
38667 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38668 mem_base = xmlMemBlocks();
38669 code = gen_int(n_code, 0);
38670
38671 ret_val = xmlUCSIsKangxiRadicals(code);
38672 desret_int(ret_val);
38673 call_tests++;
38674 des_int(n_code, code, 0);
38675 xmlResetLastError();
38676 if (mem_base != xmlMemBlocks()) {
38677 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
38678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038679 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038680 printf(" %d", n_code);
38681 printf("\n");
38682 }
38683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038684 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038685#endif
38686
Daniel Veillard42595322004-11-08 10:52:06 +000038687 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038688}
38689
38690
38691static int
38692test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038693 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038694
William M. Brack21e4ef22005-01-02 09:53:13 +000038695#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038696 int mem_base;
38697 int ret_val;
38698 int code; /* UCS code point */
38699 int n_code;
38700
38701 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38702 mem_base = xmlMemBlocks();
38703 code = gen_int(n_code, 0);
38704
38705 ret_val = xmlUCSIsKannada(code);
38706 desret_int(ret_val);
38707 call_tests++;
38708 des_int(n_code, code, 0);
38709 xmlResetLastError();
38710 if (mem_base != xmlMemBlocks()) {
38711 printf("Leak of %d blocks found in xmlUCSIsKannada",
38712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038713 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038714 printf(" %d", n_code);
38715 printf("\n");
38716 }
38717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038718 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038719#endif
38720
Daniel Veillard42595322004-11-08 10:52:06 +000038721 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038722}
38723
38724
38725static int
38726test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038727 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038728
William M. Brack21e4ef22005-01-02 09:53:13 +000038729#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038730 int mem_base;
38731 int ret_val;
38732 int code; /* UCS code point */
38733 int n_code;
38734
38735 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38736 mem_base = xmlMemBlocks();
38737 code = gen_int(n_code, 0);
38738
38739 ret_val = xmlUCSIsKatakana(code);
38740 desret_int(ret_val);
38741 call_tests++;
38742 des_int(n_code, code, 0);
38743 xmlResetLastError();
38744 if (mem_base != xmlMemBlocks()) {
38745 printf("Leak of %d blocks found in xmlUCSIsKatakana",
38746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038747 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038748 printf(" %d", n_code);
38749 printf("\n");
38750 }
38751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038752 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038753#endif
38754
Daniel Veillard42595322004-11-08 10:52:06 +000038755 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038756}
38757
38758
38759static int
38760test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038761 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038762
William M. Brack21e4ef22005-01-02 09:53:13 +000038763#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038764 int mem_base;
38765 int ret_val;
38766 int code; /* UCS code point */
38767 int n_code;
38768
38769 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38770 mem_base = xmlMemBlocks();
38771 code = gen_int(n_code, 0);
38772
38773 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
38774 desret_int(ret_val);
38775 call_tests++;
38776 des_int(n_code, code, 0);
38777 xmlResetLastError();
38778 if (mem_base != xmlMemBlocks()) {
38779 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
38780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038781 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038782 printf(" %d", n_code);
38783 printf("\n");
38784 }
38785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038786 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038787#endif
38788
Daniel Veillard42595322004-11-08 10:52:06 +000038789 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038790}
38791
38792
38793static int
38794test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038795 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038796
William M. Brack21e4ef22005-01-02 09:53:13 +000038797#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038798 int mem_base;
38799 int ret_val;
38800 int code; /* UCS code point */
38801 int n_code;
38802
38803 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38804 mem_base = xmlMemBlocks();
38805 code = gen_int(n_code, 0);
38806
38807 ret_val = xmlUCSIsKhmer(code);
38808 desret_int(ret_val);
38809 call_tests++;
38810 des_int(n_code, code, 0);
38811 xmlResetLastError();
38812 if (mem_base != xmlMemBlocks()) {
38813 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038815 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038816 printf(" %d", n_code);
38817 printf("\n");
38818 }
38819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038820 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038821#endif
38822
Daniel Veillard42595322004-11-08 10:52:06 +000038823 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038824}
38825
38826
38827static int
38828test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038829 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038830
William M. Brack21e4ef22005-01-02 09:53:13 +000038831#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038832 int mem_base;
38833 int ret_val;
38834 int code; /* UCS code point */
38835 int n_code;
38836
38837 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38838 mem_base = xmlMemBlocks();
38839 code = gen_int(n_code, 0);
38840
38841 ret_val = xmlUCSIsKhmerSymbols(code);
38842 desret_int(ret_val);
38843 call_tests++;
38844 des_int(n_code, code, 0);
38845 xmlResetLastError();
38846 if (mem_base != xmlMemBlocks()) {
38847 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038849 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038850 printf(" %d", n_code);
38851 printf("\n");
38852 }
38853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038854 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038855#endif
38856
Daniel Veillard42595322004-11-08 10:52:06 +000038857 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038858}
38859
38860
38861static int
38862test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038863 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038864
William M. Brack21e4ef22005-01-02 09:53:13 +000038865#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038866 int mem_base;
38867 int ret_val;
38868 int code; /* UCS code point */
38869 int n_code;
38870
38871 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38872 mem_base = xmlMemBlocks();
38873 code = gen_int(n_code, 0);
38874
38875 ret_val = xmlUCSIsLao(code);
38876 desret_int(ret_val);
38877 call_tests++;
38878 des_int(n_code, code, 0);
38879 xmlResetLastError();
38880 if (mem_base != xmlMemBlocks()) {
38881 printf("Leak of %d blocks found in xmlUCSIsLao",
38882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038883 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038884 printf(" %d", n_code);
38885 printf("\n");
38886 }
38887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038888 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038889#endif
38890
Daniel Veillard42595322004-11-08 10:52:06 +000038891 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038892}
38893
38894
38895static int
38896test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038897 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038898
William M. Brack21e4ef22005-01-02 09:53:13 +000038899#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038900 int mem_base;
38901 int ret_val;
38902 int code; /* UCS code point */
38903 int n_code;
38904
38905 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38906 mem_base = xmlMemBlocks();
38907 code = gen_int(n_code, 0);
38908
38909 ret_val = xmlUCSIsLatin1Supplement(code);
38910 desret_int(ret_val);
38911 call_tests++;
38912 des_int(n_code, code, 0);
38913 xmlResetLastError();
38914 if (mem_base != xmlMemBlocks()) {
38915 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038917 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038918 printf(" %d", n_code);
38919 printf("\n");
38920 }
38921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038922 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038923#endif
38924
Daniel Veillard42595322004-11-08 10:52:06 +000038925 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038926}
38927
38928
38929static int
38930test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038931 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038932
William M. Brack21e4ef22005-01-02 09:53:13 +000038933#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038934 int mem_base;
38935 int ret_val;
38936 int code; /* UCS code point */
38937 int n_code;
38938
38939 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38940 mem_base = xmlMemBlocks();
38941 code = gen_int(n_code, 0);
38942
38943 ret_val = xmlUCSIsLatinExtendedA(code);
38944 desret_int(ret_val);
38945 call_tests++;
38946 des_int(n_code, code, 0);
38947 xmlResetLastError();
38948 if (mem_base != xmlMemBlocks()) {
38949 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038951 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038952 printf(" %d", n_code);
38953 printf("\n");
38954 }
38955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038956 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038957#endif
38958
Daniel Veillard42595322004-11-08 10:52:06 +000038959 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038960}
38961
38962
38963static int
38964test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038965 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038966
William M. Brack21e4ef22005-01-02 09:53:13 +000038967#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038968 int mem_base;
38969 int ret_val;
38970 int code; /* UCS code point */
38971 int n_code;
38972
38973 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38974 mem_base = xmlMemBlocks();
38975 code = gen_int(n_code, 0);
38976
38977 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38978 desret_int(ret_val);
38979 call_tests++;
38980 des_int(n_code, code, 0);
38981 xmlResetLastError();
38982 if (mem_base != xmlMemBlocks()) {
38983 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038985 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038986 printf(" %d", n_code);
38987 printf("\n");
38988 }
38989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038990 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038991#endif
38992
Daniel Veillard42595322004-11-08 10:52:06 +000038993 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038994}
38995
38996
38997static int
38998test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038999 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039000
William M. Brack21e4ef22005-01-02 09:53:13 +000039001#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039002 int mem_base;
39003 int ret_val;
39004 int code; /* UCS code point */
39005 int n_code;
39006
39007 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39008 mem_base = xmlMemBlocks();
39009 code = gen_int(n_code, 0);
39010
39011 ret_val = xmlUCSIsLatinExtendedB(code);
39012 desret_int(ret_val);
39013 call_tests++;
39014 des_int(n_code, code, 0);
39015 xmlResetLastError();
39016 if (mem_base != xmlMemBlocks()) {
39017 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
39018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039019 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039020 printf(" %d", n_code);
39021 printf("\n");
39022 }
39023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039024 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039025#endif
39026
Daniel Veillard42595322004-11-08 10:52:06 +000039027 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039028}
39029
39030
39031static int
39032test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039033 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039034
William M. Brack21e4ef22005-01-02 09:53:13 +000039035#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039036 int mem_base;
39037 int ret_val;
39038 int code; /* UCS code point */
39039 int n_code;
39040
39041 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39042 mem_base = xmlMemBlocks();
39043 code = gen_int(n_code, 0);
39044
39045 ret_val = xmlUCSIsLetterlikeSymbols(code);
39046 desret_int(ret_val);
39047 call_tests++;
39048 des_int(n_code, code, 0);
39049 xmlResetLastError();
39050 if (mem_base != xmlMemBlocks()) {
39051 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
39052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039053 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039054 printf(" %d", n_code);
39055 printf("\n");
39056 }
39057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039058 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039059#endif
39060
Daniel Veillard42595322004-11-08 10:52:06 +000039061 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039062}
39063
39064
39065static int
39066test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039067 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039068
William M. Brack21e4ef22005-01-02 09:53:13 +000039069#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039070 int mem_base;
39071 int ret_val;
39072 int code; /* UCS code point */
39073 int n_code;
39074
39075 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39076 mem_base = xmlMemBlocks();
39077 code = gen_int(n_code, 0);
39078
39079 ret_val = xmlUCSIsLimbu(code);
39080 desret_int(ret_val);
39081 call_tests++;
39082 des_int(n_code, code, 0);
39083 xmlResetLastError();
39084 if (mem_base != xmlMemBlocks()) {
39085 printf("Leak of %d blocks found in xmlUCSIsLimbu",
39086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039087 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039088 printf(" %d", n_code);
39089 printf("\n");
39090 }
39091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039092 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039093#endif
39094
Daniel Veillard42595322004-11-08 10:52:06 +000039095 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039096}
39097
39098
39099static int
39100test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039101 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039102
William M. Brack21e4ef22005-01-02 09:53:13 +000039103#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039104 int mem_base;
39105 int ret_val;
39106 int code; /* UCS code point */
39107 int n_code;
39108
39109 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39110 mem_base = xmlMemBlocks();
39111 code = gen_int(n_code, 0);
39112
39113 ret_val = xmlUCSIsLinearBIdeograms(code);
39114 desret_int(ret_val);
39115 call_tests++;
39116 des_int(n_code, code, 0);
39117 xmlResetLastError();
39118 if (mem_base != xmlMemBlocks()) {
39119 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
39120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039121 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039122 printf(" %d", n_code);
39123 printf("\n");
39124 }
39125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039126 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039127#endif
39128
Daniel Veillard42595322004-11-08 10:52:06 +000039129 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039130}
39131
39132
39133static int
39134test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039135 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039136
William M. Brack21e4ef22005-01-02 09:53:13 +000039137#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039138 int mem_base;
39139 int ret_val;
39140 int code; /* UCS code point */
39141 int n_code;
39142
39143 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39144 mem_base = xmlMemBlocks();
39145 code = gen_int(n_code, 0);
39146
39147 ret_val = xmlUCSIsLinearBSyllabary(code);
39148 desret_int(ret_val);
39149 call_tests++;
39150 des_int(n_code, code, 0);
39151 xmlResetLastError();
39152 if (mem_base != xmlMemBlocks()) {
39153 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
39154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039155 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039156 printf(" %d", n_code);
39157 printf("\n");
39158 }
39159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039160 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039161#endif
39162
Daniel Veillard42595322004-11-08 10:52:06 +000039163 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039164}
39165
39166
39167static int
39168test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039169 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039170
William M. Brack21e4ef22005-01-02 09:53:13 +000039171#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039172 int mem_base;
39173 int ret_val;
39174 int code; /* UCS code point */
39175 int n_code;
39176
39177 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39178 mem_base = xmlMemBlocks();
39179 code = gen_int(n_code, 0);
39180
39181 ret_val = xmlUCSIsLowSurrogates(code);
39182 desret_int(ret_val);
39183 call_tests++;
39184 des_int(n_code, code, 0);
39185 xmlResetLastError();
39186 if (mem_base != xmlMemBlocks()) {
39187 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
39188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039189 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039190 printf(" %d", n_code);
39191 printf("\n");
39192 }
39193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039194 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039195#endif
39196
Daniel Veillard42595322004-11-08 10:52:06 +000039197 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039198}
39199
39200
39201static int
39202test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039203 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039204
William M. Brack21e4ef22005-01-02 09:53:13 +000039205#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039206 int mem_base;
39207 int ret_val;
39208 int code; /* UCS code point */
39209 int n_code;
39210
39211 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39212 mem_base = xmlMemBlocks();
39213 code = gen_int(n_code, 0);
39214
39215 ret_val = xmlUCSIsMalayalam(code);
39216 desret_int(ret_val);
39217 call_tests++;
39218 des_int(n_code, code, 0);
39219 xmlResetLastError();
39220 if (mem_base != xmlMemBlocks()) {
39221 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
39222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039223 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039224 printf(" %d", n_code);
39225 printf("\n");
39226 }
39227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039228 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039229#endif
39230
Daniel Veillard42595322004-11-08 10:52:06 +000039231 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039232}
39233
39234
39235static int
39236test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039237 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039238
William M. Brack21e4ef22005-01-02 09:53:13 +000039239#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039240 int mem_base;
39241 int ret_val;
39242 int code; /* UCS code point */
39243 int n_code;
39244
39245 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39246 mem_base = xmlMemBlocks();
39247 code = gen_int(n_code, 0);
39248
39249 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
39250 desret_int(ret_val);
39251 call_tests++;
39252 des_int(n_code, code, 0);
39253 xmlResetLastError();
39254 if (mem_base != xmlMemBlocks()) {
39255 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
39256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039257 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039258 printf(" %d", n_code);
39259 printf("\n");
39260 }
39261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039262 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039263#endif
39264
Daniel Veillard42595322004-11-08 10:52:06 +000039265 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039266}
39267
39268
39269static int
39270test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039271 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039272
William M. Brack21e4ef22005-01-02 09:53:13 +000039273#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039274 int mem_base;
39275 int ret_val;
39276 int code; /* UCS code point */
39277 int n_code;
39278
39279 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39280 mem_base = xmlMemBlocks();
39281 code = gen_int(n_code, 0);
39282
39283 ret_val = xmlUCSIsMathematicalOperators(code);
39284 desret_int(ret_val);
39285 call_tests++;
39286 des_int(n_code, code, 0);
39287 xmlResetLastError();
39288 if (mem_base != xmlMemBlocks()) {
39289 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
39290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039291 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039292 printf(" %d", n_code);
39293 printf("\n");
39294 }
39295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039296 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039297#endif
39298
Daniel Veillard42595322004-11-08 10:52:06 +000039299 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039300}
39301
39302
39303static int
39304test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039305 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039306
William M. Brack21e4ef22005-01-02 09:53:13 +000039307#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039308 int mem_base;
39309 int ret_val;
39310 int code; /* UCS code point */
39311 int n_code;
39312
39313 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39314 mem_base = xmlMemBlocks();
39315 code = gen_int(n_code, 0);
39316
39317 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
39318 desret_int(ret_val);
39319 call_tests++;
39320 des_int(n_code, code, 0);
39321 xmlResetLastError();
39322 if (mem_base != xmlMemBlocks()) {
39323 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
39324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039325 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039326 printf(" %d", n_code);
39327 printf("\n");
39328 }
39329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039330 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039331#endif
39332
Daniel Veillard42595322004-11-08 10:52:06 +000039333 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039334}
39335
39336
39337static int
39338test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039339 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039340
William M. Brack21e4ef22005-01-02 09:53:13 +000039341#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039342 int mem_base;
39343 int ret_val;
39344 int code; /* UCS code point */
39345 int n_code;
39346
39347 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39348 mem_base = xmlMemBlocks();
39349 code = gen_int(n_code, 0);
39350
39351 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
39352 desret_int(ret_val);
39353 call_tests++;
39354 des_int(n_code, code, 0);
39355 xmlResetLastError();
39356 if (mem_base != xmlMemBlocks()) {
39357 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
39358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039359 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039360 printf(" %d", n_code);
39361 printf("\n");
39362 }
39363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039364 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039365#endif
39366
Daniel Veillard42595322004-11-08 10:52:06 +000039367 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039368}
39369
39370
39371static int
39372test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039373 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039374
William M. Brack21e4ef22005-01-02 09:53:13 +000039375#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039376 int mem_base;
39377 int ret_val;
39378 int code; /* UCS code point */
39379 int n_code;
39380
39381 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39382 mem_base = xmlMemBlocks();
39383 code = gen_int(n_code, 0);
39384
39385 ret_val = xmlUCSIsMiscellaneousSymbols(code);
39386 desret_int(ret_val);
39387 call_tests++;
39388 des_int(n_code, code, 0);
39389 xmlResetLastError();
39390 if (mem_base != xmlMemBlocks()) {
39391 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
39392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039393 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039394 printf(" %d", n_code);
39395 printf("\n");
39396 }
39397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039398 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039399#endif
39400
Daniel Veillard42595322004-11-08 10:52:06 +000039401 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039402}
39403
39404
39405static int
39406test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039407 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039408
William M. Brack21e4ef22005-01-02 09:53:13 +000039409#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039410 int mem_base;
39411 int ret_val;
39412 int code; /* UCS code point */
39413 int n_code;
39414
39415 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39416 mem_base = xmlMemBlocks();
39417 code = gen_int(n_code, 0);
39418
39419 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
39420 desret_int(ret_val);
39421 call_tests++;
39422 des_int(n_code, code, 0);
39423 xmlResetLastError();
39424 if (mem_base != xmlMemBlocks()) {
39425 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
39426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039427 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039428 printf(" %d", n_code);
39429 printf("\n");
39430 }
39431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039432 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039433#endif
39434
Daniel Veillard42595322004-11-08 10:52:06 +000039435 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039436}
39437
39438
39439static int
39440test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039441 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039442
William M. Brack21e4ef22005-01-02 09:53:13 +000039443#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039444 int mem_base;
39445 int ret_val;
39446 int code; /* UCS code point */
39447 int n_code;
39448
39449 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39450 mem_base = xmlMemBlocks();
39451 code = gen_int(n_code, 0);
39452
39453 ret_val = xmlUCSIsMiscellaneousTechnical(code);
39454 desret_int(ret_val);
39455 call_tests++;
39456 des_int(n_code, code, 0);
39457 xmlResetLastError();
39458 if (mem_base != xmlMemBlocks()) {
39459 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
39460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039461 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039462 printf(" %d", n_code);
39463 printf("\n");
39464 }
39465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039466 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039467#endif
39468
Daniel Veillard42595322004-11-08 10:52:06 +000039469 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039470}
39471
39472
39473static int
39474test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039475 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039476
William M. Brack21e4ef22005-01-02 09:53:13 +000039477#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039478 int mem_base;
39479 int ret_val;
39480 int code; /* UCS code point */
39481 int n_code;
39482
39483 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39484 mem_base = xmlMemBlocks();
39485 code = gen_int(n_code, 0);
39486
39487 ret_val = xmlUCSIsMongolian(code);
39488 desret_int(ret_val);
39489 call_tests++;
39490 des_int(n_code, code, 0);
39491 xmlResetLastError();
39492 if (mem_base != xmlMemBlocks()) {
39493 printf("Leak of %d blocks found in xmlUCSIsMongolian",
39494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039495 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039496 printf(" %d", n_code);
39497 printf("\n");
39498 }
39499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039500 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039501#endif
39502
Daniel Veillard42595322004-11-08 10:52:06 +000039503 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039504}
39505
39506
39507static int
39508test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039509 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039510
William M. Brack21e4ef22005-01-02 09:53:13 +000039511#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039512 int mem_base;
39513 int ret_val;
39514 int code; /* UCS code point */
39515 int n_code;
39516
39517 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39518 mem_base = xmlMemBlocks();
39519 code = gen_int(n_code, 0);
39520
39521 ret_val = xmlUCSIsMusicalSymbols(code);
39522 desret_int(ret_val);
39523 call_tests++;
39524 des_int(n_code, code, 0);
39525 xmlResetLastError();
39526 if (mem_base != xmlMemBlocks()) {
39527 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
39528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039529 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039530 printf(" %d", n_code);
39531 printf("\n");
39532 }
39533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039534 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039535#endif
39536
Daniel Veillard42595322004-11-08 10:52:06 +000039537 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039538}
39539
39540
39541static int
39542test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039543 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039544
William M. Brack21e4ef22005-01-02 09:53:13 +000039545#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039546 int mem_base;
39547 int ret_val;
39548 int code; /* UCS code point */
39549 int n_code;
39550
39551 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39552 mem_base = xmlMemBlocks();
39553 code = gen_int(n_code, 0);
39554
39555 ret_val = xmlUCSIsMyanmar(code);
39556 desret_int(ret_val);
39557 call_tests++;
39558 des_int(n_code, code, 0);
39559 xmlResetLastError();
39560 if (mem_base != xmlMemBlocks()) {
39561 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
39562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039563 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039564 printf(" %d", n_code);
39565 printf("\n");
39566 }
39567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039568 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039569#endif
39570
Daniel Veillard42595322004-11-08 10:52:06 +000039571 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039572}
39573
39574
39575static int
39576test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039577 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039578
William M. Brack21e4ef22005-01-02 09:53:13 +000039579#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039580 int mem_base;
39581 int ret_val;
39582 int code; /* UCS code point */
39583 int n_code;
39584
39585 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39586 mem_base = xmlMemBlocks();
39587 code = gen_int(n_code, 0);
39588
39589 ret_val = xmlUCSIsNumberForms(code);
39590 desret_int(ret_val);
39591 call_tests++;
39592 des_int(n_code, code, 0);
39593 xmlResetLastError();
39594 if (mem_base != xmlMemBlocks()) {
39595 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
39596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039597 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039598 printf(" %d", n_code);
39599 printf("\n");
39600 }
39601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039602 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039603#endif
39604
Daniel Veillard42595322004-11-08 10:52:06 +000039605 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039606}
39607
39608
39609static int
39610test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039611 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039612
William M. Brack21e4ef22005-01-02 09:53:13 +000039613#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039614 int mem_base;
39615 int ret_val;
39616 int code; /* UCS code point */
39617 int n_code;
39618
39619 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39620 mem_base = xmlMemBlocks();
39621 code = gen_int(n_code, 0);
39622
39623 ret_val = xmlUCSIsOgham(code);
39624 desret_int(ret_val);
39625 call_tests++;
39626 des_int(n_code, code, 0);
39627 xmlResetLastError();
39628 if (mem_base != xmlMemBlocks()) {
39629 printf("Leak of %d blocks found in xmlUCSIsOgham",
39630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039631 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039632 printf(" %d", n_code);
39633 printf("\n");
39634 }
39635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039636 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039637#endif
39638
Daniel Veillard42595322004-11-08 10:52:06 +000039639 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039640}
39641
39642
39643static int
39644test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039645 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039646
William M. Brack21e4ef22005-01-02 09:53:13 +000039647#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039648 int mem_base;
39649 int ret_val;
39650 int code; /* UCS code point */
39651 int n_code;
39652
39653 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39654 mem_base = xmlMemBlocks();
39655 code = gen_int(n_code, 0);
39656
39657 ret_val = xmlUCSIsOldItalic(code);
39658 desret_int(ret_val);
39659 call_tests++;
39660 des_int(n_code, code, 0);
39661 xmlResetLastError();
39662 if (mem_base != xmlMemBlocks()) {
39663 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
39664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039665 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039666 printf(" %d", n_code);
39667 printf("\n");
39668 }
39669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039670 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039671#endif
39672
Daniel Veillard42595322004-11-08 10:52:06 +000039673 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039674}
39675
39676
39677static int
39678test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039679 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039680
William M. Brack21e4ef22005-01-02 09:53:13 +000039681#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039682 int mem_base;
39683 int ret_val;
39684 int code; /* UCS code point */
39685 int n_code;
39686
39687 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39688 mem_base = xmlMemBlocks();
39689 code = gen_int(n_code, 0);
39690
39691 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
39692 desret_int(ret_val);
39693 call_tests++;
39694 des_int(n_code, code, 0);
39695 xmlResetLastError();
39696 if (mem_base != xmlMemBlocks()) {
39697 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
39698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039699 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039700 printf(" %d", n_code);
39701 printf("\n");
39702 }
39703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039704 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039705#endif
39706
Daniel Veillard42595322004-11-08 10:52:06 +000039707 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039708}
39709
39710
39711static int
39712test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039713 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039714
William M. Brack21e4ef22005-01-02 09:53:13 +000039715#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039716 int mem_base;
39717 int ret_val;
39718 int code; /* UCS code point */
39719 int n_code;
39720
39721 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39722 mem_base = xmlMemBlocks();
39723 code = gen_int(n_code, 0);
39724
39725 ret_val = xmlUCSIsOriya(code);
39726 desret_int(ret_val);
39727 call_tests++;
39728 des_int(n_code, code, 0);
39729 xmlResetLastError();
39730 if (mem_base != xmlMemBlocks()) {
39731 printf("Leak of %d blocks found in xmlUCSIsOriya",
39732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039733 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039734 printf(" %d", n_code);
39735 printf("\n");
39736 }
39737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039738 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039739#endif
39740
Daniel Veillard42595322004-11-08 10:52:06 +000039741 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039742}
39743
39744
39745static int
39746test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039747 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039748
William M. Brack21e4ef22005-01-02 09:53:13 +000039749#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039750 int mem_base;
39751 int ret_val;
39752 int code; /* UCS code point */
39753 int n_code;
39754
39755 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39756 mem_base = xmlMemBlocks();
39757 code = gen_int(n_code, 0);
39758
39759 ret_val = xmlUCSIsOsmanya(code);
39760 desret_int(ret_val);
39761 call_tests++;
39762 des_int(n_code, code, 0);
39763 xmlResetLastError();
39764 if (mem_base != xmlMemBlocks()) {
39765 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
39766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039767 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039768 printf(" %d", n_code);
39769 printf("\n");
39770 }
39771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039772 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039773#endif
39774
Daniel Veillard42595322004-11-08 10:52:06 +000039775 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039776}
39777
39778
39779static int
39780test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039781 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039782
William M. Brack21e4ef22005-01-02 09:53:13 +000039783#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039784 int mem_base;
39785 int ret_val;
39786 int code; /* UCS code point */
39787 int n_code;
39788
39789 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39790 mem_base = xmlMemBlocks();
39791 code = gen_int(n_code, 0);
39792
39793 ret_val = xmlUCSIsPhoneticExtensions(code);
39794 desret_int(ret_val);
39795 call_tests++;
39796 des_int(n_code, code, 0);
39797 xmlResetLastError();
39798 if (mem_base != xmlMemBlocks()) {
39799 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
39800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039801 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039802 printf(" %d", n_code);
39803 printf("\n");
39804 }
39805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039806 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039807#endif
39808
Daniel Veillard42595322004-11-08 10:52:06 +000039809 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039810}
39811
39812
39813static int
39814test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039815 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039816
William M. Brack21e4ef22005-01-02 09:53:13 +000039817#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039818 int mem_base;
39819 int ret_val;
39820 int code; /* UCS code point */
39821 int n_code;
39822
39823 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39824 mem_base = xmlMemBlocks();
39825 code = gen_int(n_code, 0);
39826
39827 ret_val = xmlUCSIsPrivateUse(code);
39828 desret_int(ret_val);
39829 call_tests++;
39830 des_int(n_code, code, 0);
39831 xmlResetLastError();
39832 if (mem_base != xmlMemBlocks()) {
39833 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039835 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039836 printf(" %d", n_code);
39837 printf("\n");
39838 }
39839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039840 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039841#endif
39842
Daniel Veillard42595322004-11-08 10:52:06 +000039843 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039844}
39845
39846
39847static int
39848test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039849 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039850
William M. Brack21e4ef22005-01-02 09:53:13 +000039851#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039852 int mem_base;
39853 int ret_val;
39854 int code; /* UCS code point */
39855 int n_code;
39856
39857 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39858 mem_base = xmlMemBlocks();
39859 code = gen_int(n_code, 0);
39860
39861 ret_val = xmlUCSIsPrivateUseArea(code);
39862 desret_int(ret_val);
39863 call_tests++;
39864 des_int(n_code, code, 0);
39865 xmlResetLastError();
39866 if (mem_base != xmlMemBlocks()) {
39867 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039869 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039870 printf(" %d", n_code);
39871 printf("\n");
39872 }
39873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039874 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039875#endif
39876
Daniel Veillard42595322004-11-08 10:52:06 +000039877 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039878}
39879
39880
39881static int
39882test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039883 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039884
William M. Brack21e4ef22005-01-02 09:53:13 +000039885#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039886 int mem_base;
39887 int ret_val;
39888 int code; /* UCS code point */
39889 int n_code;
39890
39891 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39892 mem_base = xmlMemBlocks();
39893 code = gen_int(n_code, 0);
39894
39895 ret_val = xmlUCSIsRunic(code);
39896 desret_int(ret_val);
39897 call_tests++;
39898 des_int(n_code, code, 0);
39899 xmlResetLastError();
39900 if (mem_base != xmlMemBlocks()) {
39901 printf("Leak of %d blocks found in xmlUCSIsRunic",
39902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039903 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039904 printf(" %d", n_code);
39905 printf("\n");
39906 }
39907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039908 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039909#endif
39910
Daniel Veillard42595322004-11-08 10:52:06 +000039911 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039912}
39913
39914
39915static int
39916test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039917 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039918
William M. Brack21e4ef22005-01-02 09:53:13 +000039919#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039920 int mem_base;
39921 int ret_val;
39922 int code; /* UCS code point */
39923 int n_code;
39924
39925 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39926 mem_base = xmlMemBlocks();
39927 code = gen_int(n_code, 0);
39928
39929 ret_val = xmlUCSIsShavian(code);
39930 desret_int(ret_val);
39931 call_tests++;
39932 des_int(n_code, code, 0);
39933 xmlResetLastError();
39934 if (mem_base != xmlMemBlocks()) {
39935 printf("Leak of %d blocks found in xmlUCSIsShavian",
39936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039937 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039938 printf(" %d", n_code);
39939 printf("\n");
39940 }
39941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039942 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039943#endif
39944
Daniel Veillard42595322004-11-08 10:52:06 +000039945 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039946}
39947
39948
39949static int
39950test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039951 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039952
William M. Brack21e4ef22005-01-02 09:53:13 +000039953#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039954 int mem_base;
39955 int ret_val;
39956 int code; /* UCS code point */
39957 int n_code;
39958
39959 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39960 mem_base = xmlMemBlocks();
39961 code = gen_int(n_code, 0);
39962
39963 ret_val = xmlUCSIsSinhala(code);
39964 desret_int(ret_val);
39965 call_tests++;
39966 des_int(n_code, code, 0);
39967 xmlResetLastError();
39968 if (mem_base != xmlMemBlocks()) {
39969 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039971 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039972 printf(" %d", n_code);
39973 printf("\n");
39974 }
39975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039976 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039977#endif
39978
Daniel Veillard42595322004-11-08 10:52:06 +000039979 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039980}
39981
39982
39983static int
39984test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039985 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039986
William M. Brack21e4ef22005-01-02 09:53:13 +000039987#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039988 int mem_base;
39989 int ret_val;
39990 int code; /* UCS code point */
39991 int n_code;
39992
39993 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39994 mem_base = xmlMemBlocks();
39995 code = gen_int(n_code, 0);
39996
39997 ret_val = xmlUCSIsSmallFormVariants(code);
39998 desret_int(ret_val);
39999 call_tests++;
40000 des_int(n_code, code, 0);
40001 xmlResetLastError();
40002 if (mem_base != xmlMemBlocks()) {
40003 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
40004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040005 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040006 printf(" %d", n_code);
40007 printf("\n");
40008 }
40009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040010 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040011#endif
40012
Daniel Veillard42595322004-11-08 10:52:06 +000040013 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040014}
40015
40016
40017static int
40018test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040019 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040020
William M. Brack21e4ef22005-01-02 09:53:13 +000040021#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040022 int mem_base;
40023 int ret_val;
40024 int code; /* UCS code point */
40025 int n_code;
40026
40027 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40028 mem_base = xmlMemBlocks();
40029 code = gen_int(n_code, 0);
40030
40031 ret_val = xmlUCSIsSpacingModifierLetters(code);
40032 desret_int(ret_val);
40033 call_tests++;
40034 des_int(n_code, code, 0);
40035 xmlResetLastError();
40036 if (mem_base != xmlMemBlocks()) {
40037 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
40038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040039 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040040 printf(" %d", n_code);
40041 printf("\n");
40042 }
40043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040044 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040045#endif
40046
Daniel Veillard42595322004-11-08 10:52:06 +000040047 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040048}
40049
40050
40051static int
40052test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040053 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040054
William M. Brack21e4ef22005-01-02 09:53:13 +000040055#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040056 int mem_base;
40057 int ret_val;
40058 int code; /* UCS code point */
40059 int n_code;
40060
40061 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40062 mem_base = xmlMemBlocks();
40063 code = gen_int(n_code, 0);
40064
40065 ret_val = xmlUCSIsSpecials(code);
40066 desret_int(ret_val);
40067 call_tests++;
40068 des_int(n_code, code, 0);
40069 xmlResetLastError();
40070 if (mem_base != xmlMemBlocks()) {
40071 printf("Leak of %d blocks found in xmlUCSIsSpecials",
40072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040073 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040074 printf(" %d", n_code);
40075 printf("\n");
40076 }
40077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040078 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040079#endif
40080
Daniel Veillard42595322004-11-08 10:52:06 +000040081 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040082}
40083
40084
40085static int
40086test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040087 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040088
William M. Brack21e4ef22005-01-02 09:53:13 +000040089#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040090 int mem_base;
40091 int ret_val;
40092 int code; /* UCS code point */
40093 int n_code;
40094
40095 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40096 mem_base = xmlMemBlocks();
40097 code = gen_int(n_code, 0);
40098
40099 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
40100 desret_int(ret_val);
40101 call_tests++;
40102 des_int(n_code, code, 0);
40103 xmlResetLastError();
40104 if (mem_base != xmlMemBlocks()) {
40105 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
40106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040107 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040108 printf(" %d", n_code);
40109 printf("\n");
40110 }
40111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040112 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040113#endif
40114
Daniel Veillard42595322004-11-08 10:52:06 +000040115 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040116}
40117
40118
40119static int
40120test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040121 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040122
William M. Brack21e4ef22005-01-02 09:53:13 +000040123#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040124 int mem_base;
40125 int ret_val;
40126 int code; /* UCS code point */
40127 int n_code;
40128
40129 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40130 mem_base = xmlMemBlocks();
40131 code = gen_int(n_code, 0);
40132
40133 ret_val = xmlUCSIsSupplementalArrowsA(code);
40134 desret_int(ret_val);
40135 call_tests++;
40136 des_int(n_code, code, 0);
40137 xmlResetLastError();
40138 if (mem_base != xmlMemBlocks()) {
40139 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
40140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040141 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040142 printf(" %d", n_code);
40143 printf("\n");
40144 }
40145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040146 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040147#endif
40148
Daniel Veillard42595322004-11-08 10:52:06 +000040149 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040150}
40151
40152
40153static int
40154test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040155 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040156
William M. Brack21e4ef22005-01-02 09:53:13 +000040157#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040158 int mem_base;
40159 int ret_val;
40160 int code; /* UCS code point */
40161 int n_code;
40162
40163 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40164 mem_base = xmlMemBlocks();
40165 code = gen_int(n_code, 0);
40166
40167 ret_val = xmlUCSIsSupplementalArrowsB(code);
40168 desret_int(ret_val);
40169 call_tests++;
40170 des_int(n_code, code, 0);
40171 xmlResetLastError();
40172 if (mem_base != xmlMemBlocks()) {
40173 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
40174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040175 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040176 printf(" %d", n_code);
40177 printf("\n");
40178 }
40179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040180 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040181#endif
40182
Daniel Veillard42595322004-11-08 10:52:06 +000040183 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040184}
40185
40186
40187static int
40188test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040189 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040190
William M. Brack21e4ef22005-01-02 09:53:13 +000040191#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040192 int mem_base;
40193 int ret_val;
40194 int code; /* UCS code point */
40195 int n_code;
40196
40197 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40198 mem_base = xmlMemBlocks();
40199 code = gen_int(n_code, 0);
40200
40201 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
40202 desret_int(ret_val);
40203 call_tests++;
40204 des_int(n_code, code, 0);
40205 xmlResetLastError();
40206 if (mem_base != xmlMemBlocks()) {
40207 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
40208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040209 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040210 printf(" %d", n_code);
40211 printf("\n");
40212 }
40213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040215#endif
40216
Daniel Veillard42595322004-11-08 10:52:06 +000040217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040218}
40219
40220
40221static int
40222test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040224
William M. Brack21e4ef22005-01-02 09:53:13 +000040225#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040226 int mem_base;
40227 int ret_val;
40228 int code; /* UCS code point */
40229 int n_code;
40230
40231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40232 mem_base = xmlMemBlocks();
40233 code = gen_int(n_code, 0);
40234
40235 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
40236 desret_int(ret_val);
40237 call_tests++;
40238 des_int(n_code, code, 0);
40239 xmlResetLastError();
40240 if (mem_base != xmlMemBlocks()) {
40241 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
40242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040244 printf(" %d", n_code);
40245 printf("\n");
40246 }
40247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040249#endif
40250
Daniel Veillard42595322004-11-08 10:52:06 +000040251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040252}
40253
40254
40255static int
40256test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040258
William M. Brack21e4ef22005-01-02 09:53:13 +000040259#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040260 int mem_base;
40261 int ret_val;
40262 int code; /* UCS code point */
40263 int n_code;
40264
40265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40266 mem_base = xmlMemBlocks();
40267 code = gen_int(n_code, 0);
40268
40269 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
40270 desret_int(ret_val);
40271 call_tests++;
40272 des_int(n_code, code, 0);
40273 xmlResetLastError();
40274 if (mem_base != xmlMemBlocks()) {
40275 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
40276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040278 printf(" %d", n_code);
40279 printf("\n");
40280 }
40281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040283#endif
40284
Daniel Veillard42595322004-11-08 10:52:06 +000040285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040286}
40287
40288
40289static int
40290test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040292
William M. Brack21e4ef22005-01-02 09:53:13 +000040293#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040294 int mem_base;
40295 int ret_val;
40296 int code; /* UCS code point */
40297 int n_code;
40298
40299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40300 mem_base = xmlMemBlocks();
40301 code = gen_int(n_code, 0);
40302
40303 ret_val = xmlUCSIsSyriac(code);
40304 desret_int(ret_val);
40305 call_tests++;
40306 des_int(n_code, code, 0);
40307 xmlResetLastError();
40308 if (mem_base != xmlMemBlocks()) {
40309 printf("Leak of %d blocks found in xmlUCSIsSyriac",
40310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040312 printf(" %d", n_code);
40313 printf("\n");
40314 }
40315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040317#endif
40318
Daniel Veillard42595322004-11-08 10:52:06 +000040319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040320}
40321
40322
40323static int
40324test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040326
William M. Brack21e4ef22005-01-02 09:53:13 +000040327#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040328 int mem_base;
40329 int ret_val;
40330 int code; /* UCS code point */
40331 int n_code;
40332
40333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40334 mem_base = xmlMemBlocks();
40335 code = gen_int(n_code, 0);
40336
40337 ret_val = xmlUCSIsTagalog(code);
40338 desret_int(ret_val);
40339 call_tests++;
40340 des_int(n_code, code, 0);
40341 xmlResetLastError();
40342 if (mem_base != xmlMemBlocks()) {
40343 printf("Leak of %d blocks found in xmlUCSIsTagalog",
40344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040346 printf(" %d", n_code);
40347 printf("\n");
40348 }
40349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040351#endif
40352
Daniel Veillard42595322004-11-08 10:52:06 +000040353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040354}
40355
40356
40357static int
40358test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040360
William M. Brack21e4ef22005-01-02 09:53:13 +000040361#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040362 int mem_base;
40363 int ret_val;
40364 int code; /* UCS code point */
40365 int n_code;
40366
40367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40368 mem_base = xmlMemBlocks();
40369 code = gen_int(n_code, 0);
40370
40371 ret_val = xmlUCSIsTagbanwa(code);
40372 desret_int(ret_val);
40373 call_tests++;
40374 des_int(n_code, code, 0);
40375 xmlResetLastError();
40376 if (mem_base != xmlMemBlocks()) {
40377 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
40378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040380 printf(" %d", n_code);
40381 printf("\n");
40382 }
40383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040385#endif
40386
Daniel Veillard42595322004-11-08 10:52:06 +000040387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040388}
40389
40390
40391static int
40392test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040394
William M. Brack21e4ef22005-01-02 09:53:13 +000040395#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040396 int mem_base;
40397 int ret_val;
40398 int code; /* UCS code point */
40399 int n_code;
40400
40401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40402 mem_base = xmlMemBlocks();
40403 code = gen_int(n_code, 0);
40404
40405 ret_val = xmlUCSIsTags(code);
40406 desret_int(ret_val);
40407 call_tests++;
40408 des_int(n_code, code, 0);
40409 xmlResetLastError();
40410 if (mem_base != xmlMemBlocks()) {
40411 printf("Leak of %d blocks found in xmlUCSIsTags",
40412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040414 printf(" %d", n_code);
40415 printf("\n");
40416 }
40417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040419#endif
40420
Daniel Veillard42595322004-11-08 10:52:06 +000040421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040422}
40423
40424
40425static int
40426test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040428
William M. Brack21e4ef22005-01-02 09:53:13 +000040429#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040430 int mem_base;
40431 int ret_val;
40432 int code; /* UCS code point */
40433 int n_code;
40434
40435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40436 mem_base = xmlMemBlocks();
40437 code = gen_int(n_code, 0);
40438
40439 ret_val = xmlUCSIsTaiLe(code);
40440 desret_int(ret_val);
40441 call_tests++;
40442 des_int(n_code, code, 0);
40443 xmlResetLastError();
40444 if (mem_base != xmlMemBlocks()) {
40445 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
40446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040448 printf(" %d", n_code);
40449 printf("\n");
40450 }
40451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040453#endif
40454
Daniel Veillard42595322004-11-08 10:52:06 +000040455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040456}
40457
40458
40459static int
40460test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040461 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040462
William M. Brack21e4ef22005-01-02 09:53:13 +000040463#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040464 int mem_base;
40465 int ret_val;
40466 int code; /* UCS code point */
40467 int n_code;
40468
40469 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40470 mem_base = xmlMemBlocks();
40471 code = gen_int(n_code, 0);
40472
40473 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
40474 desret_int(ret_val);
40475 call_tests++;
40476 des_int(n_code, code, 0);
40477 xmlResetLastError();
40478 if (mem_base != xmlMemBlocks()) {
40479 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
40480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040481 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040482 printf(" %d", n_code);
40483 printf("\n");
40484 }
40485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040486 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040487#endif
40488
Daniel Veillard42595322004-11-08 10:52:06 +000040489 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040490}
40491
40492
40493static int
40494test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040495 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040496
William M. Brack21e4ef22005-01-02 09:53:13 +000040497#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040498 int mem_base;
40499 int ret_val;
40500 int code; /* UCS code point */
40501 int n_code;
40502
40503 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40504 mem_base = xmlMemBlocks();
40505 code = gen_int(n_code, 0);
40506
40507 ret_val = xmlUCSIsTamil(code);
40508 desret_int(ret_val);
40509 call_tests++;
40510 des_int(n_code, code, 0);
40511 xmlResetLastError();
40512 if (mem_base != xmlMemBlocks()) {
40513 printf("Leak of %d blocks found in xmlUCSIsTamil",
40514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040515 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040516 printf(" %d", n_code);
40517 printf("\n");
40518 }
40519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040520 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040521#endif
40522
Daniel Veillard42595322004-11-08 10:52:06 +000040523 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040524}
40525
40526
40527static int
40528test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040529 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040530
William M. Brack21e4ef22005-01-02 09:53:13 +000040531#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040532 int mem_base;
40533 int ret_val;
40534 int code; /* UCS code point */
40535 int n_code;
40536
40537 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40538 mem_base = xmlMemBlocks();
40539 code = gen_int(n_code, 0);
40540
40541 ret_val = xmlUCSIsTelugu(code);
40542 desret_int(ret_val);
40543 call_tests++;
40544 des_int(n_code, code, 0);
40545 xmlResetLastError();
40546 if (mem_base != xmlMemBlocks()) {
40547 printf("Leak of %d blocks found in xmlUCSIsTelugu",
40548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040549 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040550 printf(" %d", n_code);
40551 printf("\n");
40552 }
40553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040554 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040555#endif
40556
Daniel Veillard42595322004-11-08 10:52:06 +000040557 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040558}
40559
40560
40561static int
40562test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040563 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040564
William M. Brack21e4ef22005-01-02 09:53:13 +000040565#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040566 int mem_base;
40567 int ret_val;
40568 int code; /* UCS code point */
40569 int n_code;
40570
40571 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40572 mem_base = xmlMemBlocks();
40573 code = gen_int(n_code, 0);
40574
40575 ret_val = xmlUCSIsThaana(code);
40576 desret_int(ret_val);
40577 call_tests++;
40578 des_int(n_code, code, 0);
40579 xmlResetLastError();
40580 if (mem_base != xmlMemBlocks()) {
40581 printf("Leak of %d blocks found in xmlUCSIsThaana",
40582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040583 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040584 printf(" %d", n_code);
40585 printf("\n");
40586 }
40587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040588 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040589#endif
40590
Daniel Veillard42595322004-11-08 10:52:06 +000040591 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040592}
40593
40594
40595static int
40596test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040597 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040598
William M. Brack21e4ef22005-01-02 09:53:13 +000040599#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040600 int mem_base;
40601 int ret_val;
40602 int code; /* UCS code point */
40603 int n_code;
40604
40605 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40606 mem_base = xmlMemBlocks();
40607 code = gen_int(n_code, 0);
40608
40609 ret_val = xmlUCSIsThai(code);
40610 desret_int(ret_val);
40611 call_tests++;
40612 des_int(n_code, code, 0);
40613 xmlResetLastError();
40614 if (mem_base != xmlMemBlocks()) {
40615 printf("Leak of %d blocks found in xmlUCSIsThai",
40616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040617 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040618 printf(" %d", n_code);
40619 printf("\n");
40620 }
40621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040622 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040623#endif
40624
Daniel Veillard42595322004-11-08 10:52:06 +000040625 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040626}
40627
40628
40629static int
40630test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040631 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040632
William M. Brack21e4ef22005-01-02 09:53:13 +000040633#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040634 int mem_base;
40635 int ret_val;
40636 int code; /* UCS code point */
40637 int n_code;
40638
40639 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40640 mem_base = xmlMemBlocks();
40641 code = gen_int(n_code, 0);
40642
40643 ret_val = xmlUCSIsTibetan(code);
40644 desret_int(ret_val);
40645 call_tests++;
40646 des_int(n_code, code, 0);
40647 xmlResetLastError();
40648 if (mem_base != xmlMemBlocks()) {
40649 printf("Leak of %d blocks found in xmlUCSIsTibetan",
40650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040651 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040652 printf(" %d", n_code);
40653 printf("\n");
40654 }
40655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040656 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040657#endif
40658
Daniel Veillard42595322004-11-08 10:52:06 +000040659 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040660}
40661
40662
40663static int
40664test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040665 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040666
William M. Brack21e4ef22005-01-02 09:53:13 +000040667#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040668 int mem_base;
40669 int ret_val;
40670 int code; /* UCS code point */
40671 int n_code;
40672
40673 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40674 mem_base = xmlMemBlocks();
40675 code = gen_int(n_code, 0);
40676
40677 ret_val = xmlUCSIsUgaritic(code);
40678 desret_int(ret_val);
40679 call_tests++;
40680 des_int(n_code, code, 0);
40681 xmlResetLastError();
40682 if (mem_base != xmlMemBlocks()) {
40683 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
40684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040685 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040686 printf(" %d", n_code);
40687 printf("\n");
40688 }
40689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040690 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040691#endif
40692
Daniel Veillard42595322004-11-08 10:52:06 +000040693 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040694}
40695
40696
40697static int
40698test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040699 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040700
William M. Brack21e4ef22005-01-02 09:53:13 +000040701#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040702 int mem_base;
40703 int ret_val;
40704 int code; /* UCS code point */
40705 int n_code;
40706
40707 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40708 mem_base = xmlMemBlocks();
40709 code = gen_int(n_code, 0);
40710
40711 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
40712 desret_int(ret_val);
40713 call_tests++;
40714 des_int(n_code, code, 0);
40715 xmlResetLastError();
40716 if (mem_base != xmlMemBlocks()) {
40717 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
40718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040719 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040720 printf(" %d", n_code);
40721 printf("\n");
40722 }
40723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040724 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040725#endif
40726
Daniel Veillard42595322004-11-08 10:52:06 +000040727 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040728}
40729
40730
40731static int
40732test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040733 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040734
William M. Brack21e4ef22005-01-02 09:53:13 +000040735#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040736 int mem_base;
40737 int ret_val;
40738 int code; /* UCS code point */
40739 int n_code;
40740
40741 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40742 mem_base = xmlMemBlocks();
40743 code = gen_int(n_code, 0);
40744
40745 ret_val = xmlUCSIsVariationSelectors(code);
40746 desret_int(ret_val);
40747 call_tests++;
40748 des_int(n_code, code, 0);
40749 xmlResetLastError();
40750 if (mem_base != xmlMemBlocks()) {
40751 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
40752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040753 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040754 printf(" %d", n_code);
40755 printf("\n");
40756 }
40757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040758 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040759#endif
40760
Daniel Veillard42595322004-11-08 10:52:06 +000040761 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040762}
40763
40764
40765static int
40766test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040767 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040768
William M. Brack21e4ef22005-01-02 09:53:13 +000040769#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040770 int mem_base;
40771 int ret_val;
40772 int code; /* UCS code point */
40773 int n_code;
40774
40775 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40776 mem_base = xmlMemBlocks();
40777 code = gen_int(n_code, 0);
40778
40779 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
40780 desret_int(ret_val);
40781 call_tests++;
40782 des_int(n_code, code, 0);
40783 xmlResetLastError();
40784 if (mem_base != xmlMemBlocks()) {
40785 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
40786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040787 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040788 printf(" %d", n_code);
40789 printf("\n");
40790 }
40791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040792 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040793#endif
40794
Daniel Veillard42595322004-11-08 10:52:06 +000040795 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040796}
40797
40798
40799static int
40800test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040801 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040802
William M. Brack21e4ef22005-01-02 09:53:13 +000040803#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040804 int mem_base;
40805 int ret_val;
40806 int code; /* UCS code point */
40807 int n_code;
40808
40809 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40810 mem_base = xmlMemBlocks();
40811 code = gen_int(n_code, 0);
40812
40813 ret_val = xmlUCSIsYiRadicals(code);
40814 desret_int(ret_val);
40815 call_tests++;
40816 des_int(n_code, code, 0);
40817 xmlResetLastError();
40818 if (mem_base != xmlMemBlocks()) {
40819 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040821 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040822 printf(" %d", n_code);
40823 printf("\n");
40824 }
40825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040826 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040827#endif
40828
Daniel Veillard42595322004-11-08 10:52:06 +000040829 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040830}
40831
40832
40833static int
40834test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040835 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040836
William M. Brack21e4ef22005-01-02 09:53:13 +000040837#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040838 int mem_base;
40839 int ret_val;
40840 int code; /* UCS code point */
40841 int n_code;
40842
40843 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40844 mem_base = xmlMemBlocks();
40845 code = gen_int(n_code, 0);
40846
40847 ret_val = xmlUCSIsYiSyllables(code);
40848 desret_int(ret_val);
40849 call_tests++;
40850 des_int(n_code, code, 0);
40851 xmlResetLastError();
40852 if (mem_base != xmlMemBlocks()) {
40853 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040855 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040856 printf(" %d", n_code);
40857 printf("\n");
40858 }
40859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040860 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040861#endif
40862
Daniel Veillard42595322004-11-08 10:52:06 +000040863 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040864}
40865
40866
40867static int
40868test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040869 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040870
William M. Brack21e4ef22005-01-02 09:53:13 +000040871#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040872 int mem_base;
40873 int ret_val;
40874 int code; /* UCS code point */
40875 int n_code;
40876
40877 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40878 mem_base = xmlMemBlocks();
40879 code = gen_int(n_code, 0);
40880
40881 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40882 desret_int(ret_val);
40883 call_tests++;
40884 des_int(n_code, code, 0);
40885 xmlResetLastError();
40886 if (mem_base != xmlMemBlocks()) {
40887 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040889 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040890 printf(" %d", n_code);
40891 printf("\n");
40892 }
40893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040894 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040895#endif
40896
Daniel Veillard42595322004-11-08 10:52:06 +000040897 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040898}
40899
40900static int
40901test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040902 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040903
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040904 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040905 test_ret += test_xmlUCSIsAegeanNumbers();
40906 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40907 test_ret += test_xmlUCSIsArabic();
40908 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40909 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40910 test_ret += test_xmlUCSIsArmenian();
40911 test_ret += test_xmlUCSIsArrows();
40912 test_ret += test_xmlUCSIsBasicLatin();
40913 test_ret += test_xmlUCSIsBengali();
40914 test_ret += test_xmlUCSIsBlock();
40915 test_ret += test_xmlUCSIsBlockElements();
40916 test_ret += test_xmlUCSIsBopomofo();
40917 test_ret += test_xmlUCSIsBopomofoExtended();
40918 test_ret += test_xmlUCSIsBoxDrawing();
40919 test_ret += test_xmlUCSIsBraillePatterns();
40920 test_ret += test_xmlUCSIsBuhid();
40921 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40922 test_ret += test_xmlUCSIsCJKCompatibility();
40923 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40924 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40925 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40926 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40927 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40928 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40929 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40930 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40931 test_ret += test_xmlUCSIsCat();
40932 test_ret += test_xmlUCSIsCatC();
40933 test_ret += test_xmlUCSIsCatCc();
40934 test_ret += test_xmlUCSIsCatCf();
40935 test_ret += test_xmlUCSIsCatCo();
40936 test_ret += test_xmlUCSIsCatCs();
40937 test_ret += test_xmlUCSIsCatL();
40938 test_ret += test_xmlUCSIsCatLl();
40939 test_ret += test_xmlUCSIsCatLm();
40940 test_ret += test_xmlUCSIsCatLo();
40941 test_ret += test_xmlUCSIsCatLt();
40942 test_ret += test_xmlUCSIsCatLu();
40943 test_ret += test_xmlUCSIsCatM();
40944 test_ret += test_xmlUCSIsCatMc();
40945 test_ret += test_xmlUCSIsCatMe();
40946 test_ret += test_xmlUCSIsCatMn();
40947 test_ret += test_xmlUCSIsCatN();
40948 test_ret += test_xmlUCSIsCatNd();
40949 test_ret += test_xmlUCSIsCatNl();
40950 test_ret += test_xmlUCSIsCatNo();
40951 test_ret += test_xmlUCSIsCatP();
40952 test_ret += test_xmlUCSIsCatPc();
40953 test_ret += test_xmlUCSIsCatPd();
40954 test_ret += test_xmlUCSIsCatPe();
40955 test_ret += test_xmlUCSIsCatPf();
40956 test_ret += test_xmlUCSIsCatPi();
40957 test_ret += test_xmlUCSIsCatPo();
40958 test_ret += test_xmlUCSIsCatPs();
40959 test_ret += test_xmlUCSIsCatS();
40960 test_ret += test_xmlUCSIsCatSc();
40961 test_ret += test_xmlUCSIsCatSk();
40962 test_ret += test_xmlUCSIsCatSm();
40963 test_ret += test_xmlUCSIsCatSo();
40964 test_ret += test_xmlUCSIsCatZ();
40965 test_ret += test_xmlUCSIsCatZl();
40966 test_ret += test_xmlUCSIsCatZp();
40967 test_ret += test_xmlUCSIsCatZs();
40968 test_ret += test_xmlUCSIsCherokee();
40969 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40970 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40971 test_ret += test_xmlUCSIsCombiningHalfMarks();
40972 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40973 test_ret += test_xmlUCSIsControlPictures();
40974 test_ret += test_xmlUCSIsCurrencySymbols();
40975 test_ret += test_xmlUCSIsCypriotSyllabary();
40976 test_ret += test_xmlUCSIsCyrillic();
40977 test_ret += test_xmlUCSIsCyrillicSupplement();
40978 test_ret += test_xmlUCSIsDeseret();
40979 test_ret += test_xmlUCSIsDevanagari();
40980 test_ret += test_xmlUCSIsDingbats();
40981 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40982 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40983 test_ret += test_xmlUCSIsEthiopic();
40984 test_ret += test_xmlUCSIsGeneralPunctuation();
40985 test_ret += test_xmlUCSIsGeometricShapes();
40986 test_ret += test_xmlUCSIsGeorgian();
40987 test_ret += test_xmlUCSIsGothic();
40988 test_ret += test_xmlUCSIsGreek();
40989 test_ret += test_xmlUCSIsGreekExtended();
40990 test_ret += test_xmlUCSIsGreekandCoptic();
40991 test_ret += test_xmlUCSIsGujarati();
40992 test_ret += test_xmlUCSIsGurmukhi();
40993 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40994 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40995 test_ret += test_xmlUCSIsHangulJamo();
40996 test_ret += test_xmlUCSIsHangulSyllables();
40997 test_ret += test_xmlUCSIsHanunoo();
40998 test_ret += test_xmlUCSIsHebrew();
40999 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
41000 test_ret += test_xmlUCSIsHighSurrogates();
41001 test_ret += test_xmlUCSIsHiragana();
41002 test_ret += test_xmlUCSIsIPAExtensions();
41003 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
41004 test_ret += test_xmlUCSIsKanbun();
41005 test_ret += test_xmlUCSIsKangxiRadicals();
41006 test_ret += test_xmlUCSIsKannada();
41007 test_ret += test_xmlUCSIsKatakana();
41008 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
41009 test_ret += test_xmlUCSIsKhmer();
41010 test_ret += test_xmlUCSIsKhmerSymbols();
41011 test_ret += test_xmlUCSIsLao();
41012 test_ret += test_xmlUCSIsLatin1Supplement();
41013 test_ret += test_xmlUCSIsLatinExtendedA();
41014 test_ret += test_xmlUCSIsLatinExtendedAdditional();
41015 test_ret += test_xmlUCSIsLatinExtendedB();
41016 test_ret += test_xmlUCSIsLetterlikeSymbols();
41017 test_ret += test_xmlUCSIsLimbu();
41018 test_ret += test_xmlUCSIsLinearBIdeograms();
41019 test_ret += test_xmlUCSIsLinearBSyllabary();
41020 test_ret += test_xmlUCSIsLowSurrogates();
41021 test_ret += test_xmlUCSIsMalayalam();
41022 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
41023 test_ret += test_xmlUCSIsMathematicalOperators();
41024 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
41025 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
41026 test_ret += test_xmlUCSIsMiscellaneousSymbols();
41027 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
41028 test_ret += test_xmlUCSIsMiscellaneousTechnical();
41029 test_ret += test_xmlUCSIsMongolian();
41030 test_ret += test_xmlUCSIsMusicalSymbols();
41031 test_ret += test_xmlUCSIsMyanmar();
41032 test_ret += test_xmlUCSIsNumberForms();
41033 test_ret += test_xmlUCSIsOgham();
41034 test_ret += test_xmlUCSIsOldItalic();
41035 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
41036 test_ret += test_xmlUCSIsOriya();
41037 test_ret += test_xmlUCSIsOsmanya();
41038 test_ret += test_xmlUCSIsPhoneticExtensions();
41039 test_ret += test_xmlUCSIsPrivateUse();
41040 test_ret += test_xmlUCSIsPrivateUseArea();
41041 test_ret += test_xmlUCSIsRunic();
41042 test_ret += test_xmlUCSIsShavian();
41043 test_ret += test_xmlUCSIsSinhala();
41044 test_ret += test_xmlUCSIsSmallFormVariants();
41045 test_ret += test_xmlUCSIsSpacingModifierLetters();
41046 test_ret += test_xmlUCSIsSpecials();
41047 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
41048 test_ret += test_xmlUCSIsSupplementalArrowsA();
41049 test_ret += test_xmlUCSIsSupplementalArrowsB();
41050 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
41051 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
41052 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
41053 test_ret += test_xmlUCSIsSyriac();
41054 test_ret += test_xmlUCSIsTagalog();
41055 test_ret += test_xmlUCSIsTagbanwa();
41056 test_ret += test_xmlUCSIsTags();
41057 test_ret += test_xmlUCSIsTaiLe();
41058 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
41059 test_ret += test_xmlUCSIsTamil();
41060 test_ret += test_xmlUCSIsTelugu();
41061 test_ret += test_xmlUCSIsThaana();
41062 test_ret += test_xmlUCSIsThai();
41063 test_ret += test_xmlUCSIsTibetan();
41064 test_ret += test_xmlUCSIsUgaritic();
41065 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
41066 test_ret += test_xmlUCSIsVariationSelectors();
41067 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
41068 test_ret += test_xmlUCSIsYiRadicals();
41069 test_ret += test_xmlUCSIsYiSyllables();
41070 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000041071
Daniel Veillard42595322004-11-08 10:52:06 +000041072 if (test_ret != 0)
41073 printf("Module xmlunicode: %d errors\n", test_ret);
41074 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000041075}
41076
41077static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000041078test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041080
William M. Brack21e4ef22005-01-02 09:53:13 +000041081#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041082 int mem_base;
41083 xmlTextWriterPtr ret_val;
41084 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
41085 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041086
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041087 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
41088 mem_base = xmlMemBlocks();
41089 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041090
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041091 ret_val = xmlNewTextWriter(out);
41092 if (ret_val != NULL) out = NULL;
41093 desret_xmlTextWriterPtr(ret_val);
41094 call_tests++;
41095 des_xmlOutputBufferPtr(n_out, out, 0);
41096 xmlResetLastError();
41097 if (mem_base != xmlMemBlocks()) {
41098 printf("Leak of %d blocks found in xmlNewTextWriter",
41099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041100 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041101 printf(" %d", n_out);
41102 printf("\n");
41103 }
41104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041105 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041106#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000041107
Daniel Veillard42595322004-11-08 10:52:06 +000041108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041109}
41110
41111
41112static int
41113test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041115
William M. Brack21e4ef22005-01-02 09:53:13 +000041116#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041117 int mem_base;
41118 xmlTextWriterPtr ret_val;
41119 const char * uri; /* the URI of the resource for the output */
41120 int n_uri;
41121 int compression; /* compress the output? */
41122 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041123
Daniel Veillard42595322004-11-08 10:52:06 +000041124 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041125 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41126 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000041127 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041128 compression = gen_int(n_compression, 1);
41129
41130 ret_val = xmlNewTextWriterFilename(uri, compression);
41131 desret_xmlTextWriterPtr(ret_val);
41132 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041133 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041134 des_int(n_compression, compression, 1);
41135 xmlResetLastError();
41136 if (mem_base != xmlMemBlocks()) {
41137 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
41138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041139 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041140 printf(" %d", n_uri);
41141 printf(" %d", n_compression);
41142 printf("\n");
41143 }
41144 }
41145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041146 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041147#endif
41148
Daniel Veillard42595322004-11-08 10:52:06 +000041149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041150}
41151
41152
41153static int
41154test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041156
William M. Brack21e4ef22005-01-02 09:53:13 +000041157#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041158 int mem_base;
41159 xmlTextWriterPtr ret_val;
41160 xmlBufferPtr buf; /* xmlBufferPtr */
41161 int n_buf;
41162 int compression; /* compress the output? */
41163 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041164
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041165 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
41166 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41167 mem_base = xmlMemBlocks();
41168 buf = gen_xmlBufferPtr(n_buf, 0);
41169 compression = gen_int(n_compression, 1);
41170
41171 ret_val = xmlNewTextWriterMemory(buf, compression);
41172 desret_xmlTextWriterPtr(ret_val);
41173 call_tests++;
41174 des_xmlBufferPtr(n_buf, buf, 0);
41175 des_int(n_compression, compression, 1);
41176 xmlResetLastError();
41177 if (mem_base != xmlMemBlocks()) {
41178 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
41179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041180 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041181 printf(" %d", n_buf);
41182 printf(" %d", n_compression);
41183 printf("\n");
41184 }
41185 }
41186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041187 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041188#endif
41189
Daniel Veillard42595322004-11-08 10:52:06 +000041190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041191}
41192
41193
41194static int
41195test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041197
William M. Brack21e4ef22005-01-02 09:53:13 +000041198#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041199 int mem_base;
41200 xmlTextWriterPtr ret_val;
41201 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
41202 int n_ctxt;
41203 int compression; /* compress the output? */
41204 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041205
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041206 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
41207 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41208 mem_base = xmlMemBlocks();
41209 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
41210 compression = gen_int(n_compression, 1);
41211
41212 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000041213 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041214 desret_xmlTextWriterPtr(ret_val);
41215 call_tests++;
41216 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
41217 des_int(n_compression, compression, 1);
41218 xmlResetLastError();
41219 if (mem_base != xmlMemBlocks()) {
41220 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
41221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041222 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041223 printf(" %d", n_ctxt);
41224 printf(" %d", n_compression);
41225 printf("\n");
41226 }
41227 }
41228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041229 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041230#endif
41231
Daniel Veillard42595322004-11-08 10:52:06 +000041232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041233}
41234
41235
41236static int
41237test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041239
William M. Brack21e4ef22005-01-02 09:53:13 +000041240#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041241 int mem_base;
41242 xmlTextWriterPtr ret_val;
41243 xmlDocPtr doc; /* xmlDocPtr */
41244 int n_doc;
41245 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
41246 int n_node;
41247 int compression; /* compress the output? */
41248 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041249
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041250 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
41251 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
41252 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
41253 mem_base = xmlMemBlocks();
41254 doc = gen_xmlDocPtr(n_doc, 0);
41255 node = gen_xmlNodePtr(n_node, 1);
41256 compression = gen_int(n_compression, 2);
41257
41258 ret_val = xmlNewTextWriterTree(doc, node, compression);
41259 desret_xmlTextWriterPtr(ret_val);
41260 call_tests++;
41261 des_xmlDocPtr(n_doc, doc, 0);
41262 des_xmlNodePtr(n_node, node, 1);
41263 des_int(n_compression, compression, 2);
41264 xmlResetLastError();
41265 if (mem_base != xmlMemBlocks()) {
41266 printf("Leak of %d blocks found in xmlNewTextWriterTree",
41267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041268 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041269 printf(" %d", n_doc);
41270 printf(" %d", n_node);
41271 printf(" %d", n_compression);
41272 printf("\n");
41273 }
41274 }
41275 }
41276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041277 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041278#endif
41279
Daniel Veillard42595322004-11-08 10:52:06 +000041280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041281}
41282
41283
41284static int
41285test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041287
William M. Brack21e4ef22005-01-02 09:53:13 +000041288#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041289 int mem_base;
41290 int ret_val;
41291 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41292 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041293
Daniel Veillarde43cc572004-11-03 11:50:29 +000041294 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41295 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041296 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041297
41298 ret_val = xmlTextWriterEndAttribute(writer);
41299 desret_int(ret_val);
41300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041301 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041302 xmlResetLastError();
41303 if (mem_base != xmlMemBlocks()) {
41304 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
41305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041306 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041307 printf(" %d", n_writer);
41308 printf("\n");
41309 }
41310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041311 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041312#endif
41313
Daniel Veillard42595322004-11-08 10:52:06 +000041314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041315}
41316
41317
41318static int
41319test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041321
William M. Brack21e4ef22005-01-02 09:53:13 +000041322#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041323 int mem_base;
41324 int ret_val;
41325 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41326 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041327
Daniel Veillarde43cc572004-11-03 11:50:29 +000041328 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041330 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041331
41332 ret_val = xmlTextWriterEndCDATA(writer);
41333 desret_int(ret_val);
41334 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041335 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041336 xmlResetLastError();
41337 if (mem_base != xmlMemBlocks()) {
41338 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
41339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041340 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041341 printf(" %d", n_writer);
41342 printf("\n");
41343 }
41344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041345 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041346#endif
41347
Daniel Veillard42595322004-11-08 10:52:06 +000041348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041349}
41350
41351
41352static int
41353test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041355
William M. Brack21e4ef22005-01-02 09:53:13 +000041356#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041357 int mem_base;
41358 int ret_val;
41359 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41360 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041361
Daniel Veillarde43cc572004-11-03 11:50:29 +000041362 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041364 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041365
41366 ret_val = xmlTextWriterEndComment(writer);
41367 desret_int(ret_val);
41368 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041369 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041370 xmlResetLastError();
41371 if (mem_base != xmlMemBlocks()) {
41372 printf("Leak of %d blocks found in xmlTextWriterEndComment",
41373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041374 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041375 printf(" %d", n_writer);
41376 printf("\n");
41377 }
41378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041379 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041380#endif
41381
Daniel Veillard42595322004-11-08 10:52:06 +000041382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041383}
41384
41385
41386static int
41387test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041389
William M. Brack21e4ef22005-01-02 09:53:13 +000041390#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041391 int mem_base;
41392 int ret_val;
41393 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41394 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041395
Daniel Veillarde43cc572004-11-03 11:50:29 +000041396 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41397 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041398 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041399
41400 ret_val = xmlTextWriterEndDTD(writer);
41401 desret_int(ret_val);
41402 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041403 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041404 xmlResetLastError();
41405 if (mem_base != xmlMemBlocks()) {
41406 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
41407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041408 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041409 printf(" %d", n_writer);
41410 printf("\n");
41411 }
41412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041413 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041414#endif
41415
Daniel Veillard42595322004-11-08 10:52:06 +000041416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041417}
41418
41419
41420static int
41421test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041423
William M. Brack21e4ef22005-01-02 09:53:13 +000041424#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 int mem_base;
41426 int ret_val;
41427 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41428 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041429
Daniel Veillarde43cc572004-11-03 11:50:29 +000041430 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041432 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041433
41434 ret_val = xmlTextWriterEndDTDAttlist(writer);
41435 desret_int(ret_val);
41436 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041437 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438 xmlResetLastError();
41439 if (mem_base != xmlMemBlocks()) {
41440 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
41441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041442 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041443 printf(" %d", n_writer);
41444 printf("\n");
41445 }
41446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041447 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041448#endif
41449
Daniel Veillard42595322004-11-08 10:52:06 +000041450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041451}
41452
41453
41454static int
41455test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041457
William M. Brack21e4ef22005-01-02 09:53:13 +000041458#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041459 int mem_base;
41460 int ret_val;
41461 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41462 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041463
Daniel Veillarde43cc572004-11-03 11:50:29 +000041464 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041466 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041467
41468 ret_val = xmlTextWriterEndDTDElement(writer);
41469 desret_int(ret_val);
41470 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041471 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041472 xmlResetLastError();
41473 if (mem_base != xmlMemBlocks()) {
41474 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
41475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041476 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041477 printf(" %d", n_writer);
41478 printf("\n");
41479 }
41480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041481 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482#endif
41483
Daniel Veillard42595322004-11-08 10:52:06 +000041484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041485}
41486
41487
41488static int
41489test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041491
William M. Brack21e4ef22005-01-02 09:53:13 +000041492#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041493 int mem_base;
41494 int ret_val;
41495 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41496 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041497
Daniel Veillarde43cc572004-11-03 11:50:29 +000041498 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41499 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041500 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041501
41502 ret_val = xmlTextWriterEndDTDEntity(writer);
41503 desret_int(ret_val);
41504 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041505 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041506 xmlResetLastError();
41507 if (mem_base != xmlMemBlocks()) {
41508 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
41509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041510 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041511 printf(" %d", n_writer);
41512 printf("\n");
41513 }
41514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041515 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041516#endif
41517
Daniel Veillard42595322004-11-08 10:52:06 +000041518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041519}
41520
41521
41522static int
41523test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041525
William M. Brack21e4ef22005-01-02 09:53:13 +000041526#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041527 int mem_base;
41528 int ret_val;
41529 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41530 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041531
Daniel Veillarde43cc572004-11-03 11:50:29 +000041532 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41533 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041534 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041535
41536 ret_val = xmlTextWriterEndDocument(writer);
41537 desret_int(ret_val);
41538 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041539 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540 xmlResetLastError();
41541 if (mem_base != xmlMemBlocks()) {
41542 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
41543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041544 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041545 printf(" %d", n_writer);
41546 printf("\n");
41547 }
41548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041549 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041550#endif
41551
Daniel Veillard42595322004-11-08 10:52:06 +000041552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041553}
41554
41555
41556static int
41557test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041559
William M. Brack21e4ef22005-01-02 09:53:13 +000041560#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041561 int mem_base;
41562 int ret_val;
41563 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41564 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041565
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41567 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041568 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041569
41570 ret_val = xmlTextWriterEndElement(writer);
41571 desret_int(ret_val);
41572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041573 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041574 xmlResetLastError();
41575 if (mem_base != xmlMemBlocks()) {
41576 printf("Leak of %d blocks found in xmlTextWriterEndElement",
41577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041578 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041579 printf(" %d", n_writer);
41580 printf("\n");
41581 }
41582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041583 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041584#endif
41585
Daniel Veillard42595322004-11-08 10:52:06 +000041586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041587}
41588
41589
41590static int
41591test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041593
William M. Brack21e4ef22005-01-02 09:53:13 +000041594#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041595 int mem_base;
41596 int ret_val;
41597 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41598 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041599
Daniel Veillarde43cc572004-11-03 11:50:29 +000041600 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041602 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603
41604 ret_val = xmlTextWriterEndPI(writer);
41605 desret_int(ret_val);
41606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041607 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041608 xmlResetLastError();
41609 if (mem_base != xmlMemBlocks()) {
41610 printf("Leak of %d blocks found in xmlTextWriterEndPI",
41611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041612 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041613 printf(" %d", n_writer);
41614 printf("\n");
41615 }
41616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041617 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041618#endif
41619
Daniel Veillard42595322004-11-08 10:52:06 +000041620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041621}
41622
41623
41624static int
41625test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041627
William M. Brack21e4ef22005-01-02 09:53:13 +000041628#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041629 int mem_base;
41630 int ret_val;
41631 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41632 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041633
Daniel Veillarde43cc572004-11-03 11:50:29 +000041634 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041636 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637
41638 ret_val = xmlTextWriterFlush(writer);
41639 desret_int(ret_val);
41640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041641 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041642 xmlResetLastError();
41643 if (mem_base != xmlMemBlocks()) {
41644 printf("Leak of %d blocks found in xmlTextWriterFlush",
41645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041646 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041647 printf(" %d", n_writer);
41648 printf("\n");
41649 }
41650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041651 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041652#endif
41653
Daniel Veillard42595322004-11-08 10:52:06 +000041654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041655}
41656
41657
41658static int
41659test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041661
William M. Brack21e4ef22005-01-02 09:53:13 +000041662#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041663 int mem_base;
41664 int ret_val;
41665 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41666 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041667
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041670 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041671
41672 ret_val = xmlTextWriterFullEndElement(writer);
41673 desret_int(ret_val);
41674 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041675 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041676 xmlResetLastError();
41677 if (mem_base != xmlMemBlocks()) {
41678 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
41679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041680 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041681 printf(" %d", n_writer);
41682 printf("\n");
41683 }
41684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041685 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041686#endif
41687
Daniel Veillard42595322004-11-08 10:52:06 +000041688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041689}
41690
41691
41692static int
41693test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041695
William M. Brack21e4ef22005-01-02 09:53:13 +000041696#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041697 int mem_base;
41698 int ret_val;
41699 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41700 int n_writer;
41701 int indent; /* do indentation? */
41702 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041703
Daniel Veillarde43cc572004-11-03 11:50:29 +000041704 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41705 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
41706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041707 writer = gen_xmlTextWriterPtr(n_writer, 0);
41708 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041709
41710 ret_val = xmlTextWriterSetIndent(writer, indent);
41711 desret_int(ret_val);
41712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041713 des_xmlTextWriterPtr(n_writer, writer, 0);
41714 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041715 xmlResetLastError();
41716 if (mem_base != xmlMemBlocks()) {
41717 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
41718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041719 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041720 printf(" %d", n_writer);
41721 printf(" %d", n_indent);
41722 printf("\n");
41723 }
41724 }
41725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041726 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727#endif
41728
Daniel Veillard42595322004-11-08 10:52:06 +000041729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041730}
41731
41732
41733static int
41734test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041736
William M. Brack21e4ef22005-01-02 09:53:13 +000041737#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738 int mem_base;
41739 int ret_val;
41740 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41741 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041742 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041743 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041744
Daniel Veillarde43cc572004-11-03 11:50:29 +000041745 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41746 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41747 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041748 writer = gen_xmlTextWriterPtr(n_writer, 0);
41749 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041750
William M. Brackf13f77f2004-11-12 16:03:48 +000041751 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041752 desret_int(ret_val);
41753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041754 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041755 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041756 xmlResetLastError();
41757 if (mem_base != xmlMemBlocks()) {
41758 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
41759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041760 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041761 printf(" %d", n_writer);
41762 printf(" %d", n_str);
41763 printf("\n");
41764 }
41765 }
41766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041767 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041768#endif
41769
Daniel Veillard42595322004-11-08 10:52:06 +000041770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041771}
41772
41773
41774static int
41775test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041777
William M. Brack21e4ef22005-01-02 09:53:13 +000041778#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041779 int mem_base;
41780 int ret_val;
41781 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41782 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041783 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041784 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041785
Daniel Veillarde43cc572004-11-03 11:50:29 +000041786 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41787 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41788 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041789 writer = gen_xmlTextWriterPtr(n_writer, 0);
41790 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041791
William M. Brackf13f77f2004-11-12 16:03:48 +000041792 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041793 desret_int(ret_val);
41794 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041795 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041796 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041797 xmlResetLastError();
41798 if (mem_base != xmlMemBlocks()) {
41799 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
41800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041801 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041802 printf(" %d", n_writer);
41803 printf(" %d", n_name);
41804 printf("\n");
41805 }
41806 }
41807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041808 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041809#endif
41810
Daniel Veillard42595322004-11-08 10:52:06 +000041811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041812}
41813
41814
41815static int
41816test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041818
William M. Brack21e4ef22005-01-02 09:53:13 +000041819#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041820 int mem_base;
41821 int ret_val;
41822 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41823 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041824 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041825 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041826 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041827 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041828 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041829 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041830
Daniel Veillarde43cc572004-11-03 11:50:29 +000041831 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41832 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41834 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041836 writer = gen_xmlTextWriterPtr(n_writer, 0);
41837 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41838 name = gen_const_xmlChar_ptr(n_name, 2);
41839 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041840
William M. Brackf13f77f2004-11-12 16:03:48 +000041841 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041842 desret_int(ret_val);
41843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041844 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041845 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41846 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41847 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041848 xmlResetLastError();
41849 if (mem_base != xmlMemBlocks()) {
41850 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041852 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041853 printf(" %d", n_writer);
41854 printf(" %d", n_prefix);
41855 printf(" %d", n_name);
41856 printf(" %d", n_namespaceURI);
41857 printf("\n");
41858 }
41859 }
41860 }
41861 }
41862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041863 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041864#endif
41865
Daniel Veillard42595322004-11-08 10:52:06 +000041866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041867}
41868
41869
41870static int
41871test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041873
William M. Brack21e4ef22005-01-02 09:53:13 +000041874#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041875 int mem_base;
41876 int ret_val;
41877 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41878 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041879
Daniel Veillarde43cc572004-11-03 11:50:29 +000041880 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041882 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041883
41884 ret_val = xmlTextWriterStartCDATA(writer);
41885 desret_int(ret_val);
41886 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041887 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041888 xmlResetLastError();
41889 if (mem_base != xmlMemBlocks()) {
41890 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041892 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041893 printf(" %d", n_writer);
41894 printf("\n");
41895 }
41896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041897 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041898#endif
41899
Daniel Veillard42595322004-11-08 10:52:06 +000041900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041901}
41902
41903
41904static int
41905test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041907
William M. Brack21e4ef22005-01-02 09:53:13 +000041908#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041909 int mem_base;
41910 int ret_val;
41911 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41912 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041913
Daniel Veillarde43cc572004-11-03 11:50:29 +000041914 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041916 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041917
41918 ret_val = xmlTextWriterStartComment(writer);
41919 desret_int(ret_val);
41920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041921 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041922 xmlResetLastError();
41923 if (mem_base != xmlMemBlocks()) {
41924 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041926 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041927 printf(" %d", n_writer);
41928 printf("\n");
41929 }
41930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041931 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041932#endif
41933
Daniel Veillard42595322004-11-08 10:52:06 +000041934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041935}
41936
41937
41938static int
41939test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041941
William M. Brack21e4ef22005-01-02 09:53:13 +000041942#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041943 int mem_base;
41944 int ret_val;
41945 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41946 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041947 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041948 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041949 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041950 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041951 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041952 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041953
Daniel Veillarde43cc572004-11-03 11:50:29 +000041954 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41955 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41956 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41957 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041959 writer = gen_xmlTextWriterPtr(n_writer, 0);
41960 name = gen_const_xmlChar_ptr(n_name, 1);
41961 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41962 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041963
William M. Brackf13f77f2004-11-12 16:03:48 +000041964 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041965 desret_int(ret_val);
41966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041967 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041968 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41969 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41970 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041971 xmlResetLastError();
41972 if (mem_base != xmlMemBlocks()) {
41973 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041975 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 printf(" %d", n_writer);
41977 printf(" %d", n_name);
41978 printf(" %d", n_pubid);
41979 printf(" %d", n_sysid);
41980 printf("\n");
41981 }
41982 }
41983 }
41984 }
41985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041986 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041987#endif
41988
Daniel Veillard42595322004-11-08 10:52:06 +000041989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041990}
41991
41992
41993static int
41994test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041996
William M. Brack21e4ef22005-01-02 09:53:13 +000041997#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041998 int mem_base;
41999 int ret_val;
42000 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42001 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042002 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042003 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042004
Daniel Veillarde43cc572004-11-03 11:50:29 +000042005 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42006 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42007 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042008 writer = gen_xmlTextWriterPtr(n_writer, 0);
42009 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042010
William M. Brackf13f77f2004-11-12 16:03:48 +000042011 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042012 desret_int(ret_val);
42013 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042014 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042015 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042016 xmlResetLastError();
42017 if (mem_base != xmlMemBlocks()) {
42018 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
42019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042020 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042021 printf(" %d", n_writer);
42022 printf(" %d", n_name);
42023 printf("\n");
42024 }
42025 }
42026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042027 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042028#endif
42029
Daniel Veillard42595322004-11-08 10:52:06 +000042030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042031}
42032
42033
42034static int
42035test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042037
William M. Brack21e4ef22005-01-02 09:53:13 +000042038#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042039 int mem_base;
42040 int ret_val;
42041 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42042 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042043 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042044 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042045
Daniel Veillarde43cc572004-11-03 11:50:29 +000042046 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42047 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42048 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042049 writer = gen_xmlTextWriterPtr(n_writer, 0);
42050 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042051
William M. Brackf13f77f2004-11-12 16:03:48 +000042052 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042053 desret_int(ret_val);
42054 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042055 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042056 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042057 xmlResetLastError();
42058 if (mem_base != xmlMemBlocks()) {
42059 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
42060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042061 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042062 printf(" %d", n_writer);
42063 printf(" %d", n_name);
42064 printf("\n");
42065 }
42066 }
42067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042068 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042069#endif
42070
Daniel Veillard42595322004-11-08 10:52:06 +000042071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042072}
42073
42074
42075static int
42076test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042078
William M. Brack21e4ef22005-01-02 09:53:13 +000042079#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042080 int mem_base;
42081 int ret_val;
42082 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42083 int n_writer;
42084 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42085 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042086 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042087 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042088
Daniel Veillarde43cc572004-11-03 11:50:29 +000042089 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42090 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42091 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042093 writer = gen_xmlTextWriterPtr(n_writer, 0);
42094 pe = gen_int(n_pe, 1);
42095 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042096
William M. Brackf13f77f2004-11-12 16:03:48 +000042097 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042098 desret_int(ret_val);
42099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042100 des_xmlTextWriterPtr(n_writer, writer, 0);
42101 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042102 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042103 xmlResetLastError();
42104 if (mem_base != xmlMemBlocks()) {
42105 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
42106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042107 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042108 printf(" %d", n_writer);
42109 printf(" %d", n_pe);
42110 printf(" %d", n_name);
42111 printf("\n");
42112 }
42113 }
42114 }
42115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042116 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042117#endif
42118
Daniel Veillard42595322004-11-08 10:52:06 +000042119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042120}
42121
42122
42123static int
42124test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042126
William M. Brack21e4ef22005-01-02 09:53:13 +000042127#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042128 int mem_base;
42129 int ret_val;
42130 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42131 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042132 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042133 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042134 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042135 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042136 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042137 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042138
Daniel Veillarde43cc572004-11-03 11:50:29 +000042139 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42140 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
42141 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
42142 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
42143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042144 writer = gen_xmlTextWriterPtr(n_writer, 0);
42145 version = gen_const_char_ptr(n_version, 1);
42146 encoding = gen_const_char_ptr(n_encoding, 2);
42147 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042148
William M. Brackf13f77f2004-11-12 16:03:48 +000042149 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042150 desret_int(ret_val);
42151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042152 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042153 des_const_char_ptr(n_version, (const char *)version, 1);
42154 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
42155 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042156 xmlResetLastError();
42157 if (mem_base != xmlMemBlocks()) {
42158 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
42159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042160 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161 printf(" %d", n_writer);
42162 printf(" %d", n_version);
42163 printf(" %d", n_encoding);
42164 printf(" %d", n_standalone);
42165 printf("\n");
42166 }
42167 }
42168 }
42169 }
42170 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042171 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042172#endif
42173
Daniel Veillard42595322004-11-08 10:52:06 +000042174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042175}
42176
42177
42178static int
42179test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042181
William M. Brack21e4ef22005-01-02 09:53:13 +000042182#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042183 int mem_base;
42184 int ret_val;
42185 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42186 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042187 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042188 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042189
Daniel Veillarde43cc572004-11-03 11:50:29 +000042190 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42191 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42192 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042193 writer = gen_xmlTextWriterPtr(n_writer, 0);
42194 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042195
William M. Brackf13f77f2004-11-12 16:03:48 +000042196 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042197 desret_int(ret_val);
42198 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042199 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042200 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042201 xmlResetLastError();
42202 if (mem_base != xmlMemBlocks()) {
42203 printf("Leak of %d blocks found in xmlTextWriterStartElement",
42204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042205 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042206 printf(" %d", n_writer);
42207 printf(" %d", n_name);
42208 printf("\n");
42209 }
42210 }
42211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042212 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042213#endif
42214
Daniel Veillard42595322004-11-08 10:52:06 +000042215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042216}
42217
42218
42219static int
42220test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042222
William M. Brack21e4ef22005-01-02 09:53:13 +000042223#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042224 int mem_base;
42225 int ret_val;
42226 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42227 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042228 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042229 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042230 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042231 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042232 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042233 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042234
Daniel Veillarde43cc572004-11-03 11:50:29 +000042235 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42236 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42237 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42238 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42239 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042240 writer = gen_xmlTextWriterPtr(n_writer, 0);
42241 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42242 name = gen_const_xmlChar_ptr(n_name, 2);
42243 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042244
William M. Brackf13f77f2004-11-12 16:03:48 +000042245 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042246 desret_int(ret_val);
42247 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042248 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042249 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42250 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42251 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042252 xmlResetLastError();
42253 if (mem_base != xmlMemBlocks()) {
42254 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
42255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042256 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042257 printf(" %d", n_writer);
42258 printf(" %d", n_prefix);
42259 printf(" %d", n_name);
42260 printf(" %d", n_namespaceURI);
42261 printf("\n");
42262 }
42263 }
42264 }
42265 }
42266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042267 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042268#endif
42269
Daniel Veillard42595322004-11-08 10:52:06 +000042270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042271}
42272
42273
42274static int
42275test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042277
William M. Brack21e4ef22005-01-02 09:53:13 +000042278#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042279 int mem_base;
42280 int ret_val;
42281 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42282 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042283 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042284 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042285
Daniel Veillarde43cc572004-11-03 11:50:29 +000042286 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42287 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42288 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042289 writer = gen_xmlTextWriterPtr(n_writer, 0);
42290 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042291
William M. Brackf13f77f2004-11-12 16:03:48 +000042292 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042293 desret_int(ret_val);
42294 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042295 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042296 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042297 xmlResetLastError();
42298 if (mem_base != xmlMemBlocks()) {
42299 printf("Leak of %d blocks found in xmlTextWriterStartPI",
42300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042301 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042302 printf(" %d", n_writer);
42303 printf(" %d", n_target);
42304 printf("\n");
42305 }
42306 }
42307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042308 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042309#endif
42310
Daniel Veillard42595322004-11-08 10:52:06 +000042311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042312}
42313
42314
42315static int
42316test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042318
William M. Brack21e4ef22005-01-02 09:53:13 +000042319#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042320 int mem_base;
42321 int ret_val;
42322 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42323 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042324 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042325 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042326 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042327 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328
Daniel Veillarde43cc572004-11-03 11:50:29 +000042329 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42330 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42331 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042333 writer = gen_xmlTextWriterPtr(n_writer, 0);
42334 name = gen_const_xmlChar_ptr(n_name, 1);
42335 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042336
William M. Brackf13f77f2004-11-12 16:03:48 +000042337 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042338 desret_int(ret_val);
42339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042340 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042341 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42342 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042343 xmlResetLastError();
42344 if (mem_base != xmlMemBlocks()) {
42345 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
42346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042347 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042348 printf(" %d", n_writer);
42349 printf(" %d", n_name);
42350 printf(" %d", n_content);
42351 printf("\n");
42352 }
42353 }
42354 }
42355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042356 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042357#endif
42358
Daniel Veillard42595322004-11-08 10:52:06 +000042359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360}
42361
42362
42363static int
42364test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042366
William M. Brack21e4ef22005-01-02 09:53:13 +000042367#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042368 int mem_base;
42369 int ret_val;
42370 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42371 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042372 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042373 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042374 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042375 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042376 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042377 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042378 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042379 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042380
Daniel Veillarde43cc572004-11-03 11:50:29 +000042381 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42382 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42383 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42384 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42385 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042387 writer = gen_xmlTextWriterPtr(n_writer, 0);
42388 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42389 name = gen_const_xmlChar_ptr(n_name, 2);
42390 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42391 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042392
William M. Brackf13f77f2004-11-12 16:03:48 +000042393 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042394 desret_int(ret_val);
42395 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042396 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042397 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42398 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42399 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42400 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042401 xmlResetLastError();
42402 if (mem_base != xmlMemBlocks()) {
42403 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
42404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042405 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042406 printf(" %d", n_writer);
42407 printf(" %d", n_prefix);
42408 printf(" %d", n_name);
42409 printf(" %d", n_namespaceURI);
42410 printf(" %d", n_content);
42411 printf("\n");
42412 }
42413 }
42414 }
42415 }
42416 }
42417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042418 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042419#endif
42420
Daniel Veillard42595322004-11-08 10:52:06 +000042421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042422}
42423
42424
42425static int
42426test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042428
William M. Brack21e4ef22005-01-02 09:53:13 +000042429#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042430 int mem_base;
42431 int ret_val;
42432 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42433 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042434 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042435 int n_data;
42436 int start; /* the position within the data of the first byte to encode */
42437 int n_start;
42438 int len; /* the number of bytes to encode */
42439 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042440
Daniel Veillarde43cc572004-11-03 11:50:29 +000042441 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42442 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
42443 for (n_start = 0;n_start < gen_nb_int;n_start++) {
42444 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042446 writer = gen_xmlTextWriterPtr(n_writer, 0);
42447 data = gen_const_char_ptr(n_data, 1);
42448 start = gen_int(n_start, 2);
42449 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042450
William M. Brackf13f77f2004-11-12 16:03:48 +000042451 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042452 desret_int(ret_val);
42453 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042454 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042455 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042456 des_int(n_start, start, 2);
42457 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042458 xmlResetLastError();
42459 if (mem_base != xmlMemBlocks()) {
42460 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
42461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042462 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042463 printf(" %d", n_writer);
42464 printf(" %d", n_data);
42465 printf(" %d", n_start);
42466 printf(" %d", n_len);
42467 printf("\n");
42468 }
42469 }
42470 }
42471 }
42472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042473 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042474#endif
42475
Daniel Veillard42595322004-11-08 10:52:06 +000042476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042477}
42478
42479
42480static int
42481test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042483
William M. Brack21e4ef22005-01-02 09:53:13 +000042484#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042485 int mem_base;
42486 int ret_val;
42487 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42488 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042489 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042490 int n_data;
42491 int start; /* the position within the data of the first byte to encode */
42492 int n_start;
42493 int len; /* the number of bytes to encode */
42494 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042495
Daniel Veillarde43cc572004-11-03 11:50:29 +000042496 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42497 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
42498 for (n_start = 0;n_start < gen_nb_int;n_start++) {
42499 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042501 writer = gen_xmlTextWriterPtr(n_writer, 0);
42502 data = gen_const_char_ptr(n_data, 1);
42503 start = gen_int(n_start, 2);
42504 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042505
William M. Brackf13f77f2004-11-12 16:03:48 +000042506 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042507 desret_int(ret_val);
42508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042509 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042510 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042511 des_int(n_start, start, 2);
42512 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042513 xmlResetLastError();
42514 if (mem_base != xmlMemBlocks()) {
42515 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
42516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042517 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042518 printf(" %d", n_writer);
42519 printf(" %d", n_data);
42520 printf(" %d", n_start);
42521 printf(" %d", n_len);
42522 printf("\n");
42523 }
42524 }
42525 }
42526 }
42527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042528 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042529#endif
42530
Daniel Veillard42595322004-11-08 10:52:06 +000042531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042532}
42533
42534
42535static int
42536test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042538
William M. Brack21e4ef22005-01-02 09:53:13 +000042539#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042540 int mem_base;
42541 int ret_val;
42542 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42543 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042544 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042545 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042546
Daniel Veillarde43cc572004-11-03 11:50:29 +000042547 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42548 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42549 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042550 writer = gen_xmlTextWriterPtr(n_writer, 0);
42551 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042552
William M. Brackf13f77f2004-11-12 16:03:48 +000042553 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042554 desret_int(ret_val);
42555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042556 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042557 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042558 xmlResetLastError();
42559 if (mem_base != xmlMemBlocks()) {
42560 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
42561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042562 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042563 printf(" %d", n_writer);
42564 printf(" %d", n_content);
42565 printf("\n");
42566 }
42567 }
42568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042569 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042570#endif
42571
Daniel Veillard42595322004-11-08 10:52:06 +000042572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042573}
42574
42575
42576static int
42577test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042579
William M. Brack21e4ef22005-01-02 09:53:13 +000042580#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042581 int mem_base;
42582 int ret_val;
42583 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42584 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042585 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042586 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042587
Daniel Veillarde43cc572004-11-03 11:50:29 +000042588 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42589 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042591 writer = gen_xmlTextWriterPtr(n_writer, 0);
42592 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042593
William M. Brackf13f77f2004-11-12 16:03:48 +000042594 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042595 desret_int(ret_val);
42596 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042597 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042598 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042599 xmlResetLastError();
42600 if (mem_base != xmlMemBlocks()) {
42601 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
42602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042603 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042604 printf(" %d", n_writer);
42605 printf(" %d", n_content);
42606 printf("\n");
42607 }
42608 }
42609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042610 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042611#endif
42612
Daniel Veillard42595322004-11-08 10:52:06 +000042613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042614}
42615
42616
42617static int
42618test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042620
William M. Brack21e4ef22005-01-02 09:53:13 +000042621#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042622 int mem_base;
42623 int ret_val;
42624 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42625 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042626 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042627 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042628 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042629 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042630 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042631 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042632 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042633 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042634
Daniel Veillarde43cc572004-11-03 11:50:29 +000042635 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42636 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42637 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42638 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42639 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
42640 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042641 writer = gen_xmlTextWriterPtr(n_writer, 0);
42642 name = gen_const_xmlChar_ptr(n_name, 1);
42643 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42644 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
42645 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042646
William M. Brackf13f77f2004-11-12 16:03:48 +000042647 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042648 desret_int(ret_val);
42649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042650 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042651 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42652 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42653 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
42654 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042655 xmlResetLastError();
42656 if (mem_base != xmlMemBlocks()) {
42657 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
42658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042659 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042660 printf(" %d", n_writer);
42661 printf(" %d", n_name);
42662 printf(" %d", n_pubid);
42663 printf(" %d", n_sysid);
42664 printf(" %d", n_subset);
42665 printf("\n");
42666 }
42667 }
42668 }
42669 }
42670 }
42671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042672 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042673#endif
42674
Daniel Veillard42595322004-11-08 10:52:06 +000042675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042676}
42677
42678
42679static int
42680test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042682
William M. Brack21e4ef22005-01-02 09:53:13 +000042683#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042684 int mem_base;
42685 int ret_val;
42686 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42687 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042688 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042689 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042690 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042691 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042692
Daniel Veillarde43cc572004-11-03 11:50:29 +000042693 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42694 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42695 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042697 writer = gen_xmlTextWriterPtr(n_writer, 0);
42698 name = gen_const_xmlChar_ptr(n_name, 1);
42699 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042700
William M. Brackf13f77f2004-11-12 16:03:48 +000042701 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042702 desret_int(ret_val);
42703 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042704 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042705 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42706 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042707 xmlResetLastError();
42708 if (mem_base != xmlMemBlocks()) {
42709 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
42710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042711 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042712 printf(" %d", n_writer);
42713 printf(" %d", n_name);
42714 printf(" %d", n_content);
42715 printf("\n");
42716 }
42717 }
42718 }
42719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042720 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042721#endif
42722
Daniel Veillard42595322004-11-08 10:52:06 +000042723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042724}
42725
42726
42727static int
42728test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042730
William M. Brack21e4ef22005-01-02 09:53:13 +000042731#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042732 int mem_base;
42733 int ret_val;
42734 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42735 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042736 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042737 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042738 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042739 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042740
Daniel Veillarde43cc572004-11-03 11:50:29 +000042741 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42743 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042745 writer = gen_xmlTextWriterPtr(n_writer, 0);
42746 name = gen_const_xmlChar_ptr(n_name, 1);
42747 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042748
William M. Brackf13f77f2004-11-12 16:03:48 +000042749 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042750 desret_int(ret_val);
42751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042752 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042753 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42754 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042755 xmlResetLastError();
42756 if (mem_base != xmlMemBlocks()) {
42757 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
42758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042759 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042760 printf(" %d", n_writer);
42761 printf(" %d", n_name);
42762 printf(" %d", n_content);
42763 printf("\n");
42764 }
42765 }
42766 }
42767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042768 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042769#endif
42770
Daniel Veillard42595322004-11-08 10:52:06 +000042771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042772}
42773
42774
42775static int
42776test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042778
William M. Brack21e4ef22005-01-02 09:53:13 +000042779#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042780 int mem_base;
42781 int ret_val;
42782 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42783 int n_writer;
42784 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42785 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042786 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042787 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042788 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042789 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042790 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042791 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042792 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042793 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042794 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042795 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042796
Daniel Veillarde43cc572004-11-03 11:50:29 +000042797 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42798 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42799 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42800 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42801 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42802 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42803 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042805 writer = gen_xmlTextWriterPtr(n_writer, 0);
42806 pe = gen_int(n_pe, 1);
42807 name = gen_const_xmlChar_ptr(n_name, 2);
42808 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42809 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42810 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42811 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042812
William M. Brackf13f77f2004-11-12 16:03:48 +000042813 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042814 desret_int(ret_val);
42815 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042816 des_xmlTextWriterPtr(n_writer, writer, 0);
42817 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042818 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42819 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42820 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42821 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42822 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042823 xmlResetLastError();
42824 if (mem_base != xmlMemBlocks()) {
42825 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042827 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042828 printf(" %d", n_writer);
42829 printf(" %d", n_pe);
42830 printf(" %d", n_name);
42831 printf(" %d", n_pubid);
42832 printf(" %d", n_sysid);
42833 printf(" %d", n_ndataid);
42834 printf(" %d", n_content);
42835 printf("\n");
42836 }
42837 }
42838 }
42839 }
42840 }
42841 }
42842 }
42843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042844 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042845#endif
42846
Daniel Veillard42595322004-11-08 10:52:06 +000042847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042848}
42849
42850
42851static int
42852test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042854
William M. Brack21e4ef22005-01-02 09:53:13 +000042855#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042856 int mem_base;
42857 int ret_val;
42858 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42859 int n_writer;
42860 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42861 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042862 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042863 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042864 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042865 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042866 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042867 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042868 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042869 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042870
Daniel Veillarde43cc572004-11-03 11:50:29 +000042871 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42872 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42873 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42874 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42875 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42876 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042878 writer = gen_xmlTextWriterPtr(n_writer, 0);
42879 pe = gen_int(n_pe, 1);
42880 name = gen_const_xmlChar_ptr(n_name, 2);
42881 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42882 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42883 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042884
William M. Brackf13f77f2004-11-12 16:03:48 +000042885 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042886 desret_int(ret_val);
42887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042888 des_xmlTextWriterPtr(n_writer, writer, 0);
42889 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042890 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42891 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42892 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42893 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042894 xmlResetLastError();
42895 if (mem_base != xmlMemBlocks()) {
42896 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042899 printf(" %d", n_writer);
42900 printf(" %d", n_pe);
42901 printf(" %d", n_name);
42902 printf(" %d", n_pubid);
42903 printf(" %d", n_sysid);
42904 printf(" %d", n_ndataid);
42905 printf("\n");
42906 }
42907 }
42908 }
42909 }
42910 }
42911 }
42912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042913 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042914#endif
42915
Daniel Veillard42595322004-11-08 10:52:06 +000042916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042917}
42918
42919
42920static int
42921test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042923
William M. Brack21e4ef22005-01-02 09:53:13 +000042924#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042925 int mem_base;
42926 int ret_val;
42927 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42928 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042929 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042930 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042931 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042932 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042933 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042934 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042935
Daniel Veillarde43cc572004-11-03 11:50:29 +000042936 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42937 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42938 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42939 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42940 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042941 writer = gen_xmlTextWriterPtr(n_writer, 0);
42942 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42943 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42944 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042945
William M. Brackf13f77f2004-11-12 16:03:48 +000042946 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042947 desret_int(ret_val);
42948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042949 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042950 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42951 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42952 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042953 xmlResetLastError();
42954 if (mem_base != xmlMemBlocks()) {
42955 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042957 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042958 printf(" %d", n_writer);
42959 printf(" %d", n_pubid);
42960 printf(" %d", n_sysid);
42961 printf(" %d", n_ndataid);
42962 printf("\n");
42963 }
42964 }
42965 }
42966 }
42967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042968 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042969#endif
42970
Daniel Veillard42595322004-11-08 10:52:06 +000042971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042972}
42973
42974
42975static int
42976test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042978
William M. Brack21e4ef22005-01-02 09:53:13 +000042979#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042980 int mem_base;
42981 int ret_val;
42982 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42983 int n_writer;
42984 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42985 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042986 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042987 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042988 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042989 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042990
Daniel Veillarde43cc572004-11-03 11:50:29 +000042991 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42992 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42993 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42994 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042996 writer = gen_xmlTextWriterPtr(n_writer, 0);
42997 pe = gen_int(n_pe, 1);
42998 name = gen_const_xmlChar_ptr(n_name, 2);
42999 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043000
William M. Brackf13f77f2004-11-12 16:03:48 +000043001 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043002 desret_int(ret_val);
43003 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043004 des_xmlTextWriterPtr(n_writer, writer, 0);
43005 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000043006 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
43007 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043008 xmlResetLastError();
43009 if (mem_base != xmlMemBlocks()) {
43010 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
43011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043012 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043013 printf(" %d", n_writer);
43014 printf(" %d", n_pe);
43015 printf(" %d", n_name);
43016 printf(" %d", n_content);
43017 printf("\n");
43018 }
43019 }
43020 }
43021 }
43022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043023 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043024#endif
43025
Daniel Veillard42595322004-11-08 10:52:06 +000043026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043027}
43028
43029
43030static int
43031test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043033
William M. Brack21e4ef22005-01-02 09:53:13 +000043034#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043035 int mem_base;
43036 int ret_val;
43037 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43038 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043039 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043040 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043041 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043042 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043043 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043044 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043045
Daniel Veillarde43cc572004-11-03 11:50:29 +000043046 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43047 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
43048 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
43049 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
43050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043051 writer = gen_xmlTextWriterPtr(n_writer, 0);
43052 name = gen_const_xmlChar_ptr(n_name, 1);
43053 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
43054 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043055
William M. Brackf13f77f2004-11-12 16:03:48 +000043056 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043057 desret_int(ret_val);
43058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043059 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043060 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
43061 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
43062 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043063 xmlResetLastError();
43064 if (mem_base != xmlMemBlocks()) {
43065 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
43066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043067 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043068 printf(" %d", n_writer);
43069 printf(" %d", n_name);
43070 printf(" %d", n_pubid);
43071 printf(" %d", n_sysid);
43072 printf("\n");
43073 }
43074 }
43075 }
43076 }
43077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043078 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043079#endif
43080
Daniel Veillard42595322004-11-08 10:52:06 +000043081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043082}
43083
43084
43085static int
43086test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043088
William M. Brack21e4ef22005-01-02 09:53:13 +000043089#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043090 int mem_base;
43091 int ret_val;
43092 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43093 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043094 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043095 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043096 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043097 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043098
Daniel Veillarde43cc572004-11-03 11:50:29 +000043099 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43100 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
43101 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43102 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043103 writer = gen_xmlTextWriterPtr(n_writer, 0);
43104 name = gen_const_xmlChar_ptr(n_name, 1);
43105 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043106
William M. Brackf13f77f2004-11-12 16:03:48 +000043107 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043108 desret_int(ret_val);
43109 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043110 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043111 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
43112 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043113 xmlResetLastError();
43114 if (mem_base != xmlMemBlocks()) {
43115 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
43116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043117 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043118 printf(" %d", n_writer);
43119 printf(" %d", n_name);
43120 printf(" %d", n_content);
43121 printf("\n");
43122 }
43123 }
43124 }
43125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043126 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043127#endif
43128
Daniel Veillard42595322004-11-08 10:52:06 +000043129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043130}
43131
43132
43133static int
43134test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043136
William M. Brack21e4ef22005-01-02 09:53:13 +000043137#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043138 int mem_base;
43139 int ret_val;
43140 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43141 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043142 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043143 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043144 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043145 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043146 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043147 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043148 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043149 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043150
Daniel Veillarde43cc572004-11-03 11:50:29 +000043151 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43152 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
43153 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
43154 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
43155 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43156 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043157 writer = gen_xmlTextWriterPtr(n_writer, 0);
43158 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
43159 name = gen_const_xmlChar_ptr(n_name, 2);
43160 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
43161 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043162
William M. Brackf13f77f2004-11-12 16:03:48 +000043163 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043164 desret_int(ret_val);
43165 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043166 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043167 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
43168 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
43169 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
43170 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043171 xmlResetLastError();
43172 if (mem_base != xmlMemBlocks()) {
43173 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
43174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043175 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043176 printf(" %d", n_writer);
43177 printf(" %d", n_prefix);
43178 printf(" %d", n_name);
43179 printf(" %d", n_namespaceURI);
43180 printf(" %d", n_content);
43181 printf("\n");
43182 }
43183 }
43184 }
43185 }
43186 }
43187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043188 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043189#endif
43190
Daniel Veillard42595322004-11-08 10:52:06 +000043191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043192}
43193
43194
43195static int
43196test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043198
43199
43200 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043202}
43203
43204
43205static int
43206test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043208
43209
43210 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043212}
43213
43214
43215static int
43216test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043218
43219
43220 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043222}
43223
43224
43225static int
43226test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043228
43229
43230 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043232}
43233
43234
43235static int
43236test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043238
43239
43240 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043242}
43243
43244
43245static int
43246test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043248
43249
43250 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043252}
43253
43254
43255static int
43256test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043258
43259
43260 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043262}
43263
43264
43265static int
43266test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043268
43269
43270 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043272}
43273
43274
43275static int
43276test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043278
43279
43280 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043282}
43283
43284
43285static int
43286test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043288
43289
43290 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043292}
43293
43294
43295static int
43296test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043298
43299
43300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043302}
43303
43304
43305static int
43306test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043308
43309
43310 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043312}
43313
43314
43315static int
43316test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043318
43319
43320 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043322}
43323
43324
43325static int
43326test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043328
William M. Brack21e4ef22005-01-02 09:53:13 +000043329#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043330 int mem_base;
43331 int ret_val;
43332 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43333 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043334 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043335 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043336 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043337 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043338
Daniel Veillarde43cc572004-11-03 11:50:29 +000043339 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43340 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
43341 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043343 writer = gen_xmlTextWriterPtr(n_writer, 0);
43344 target = gen_const_xmlChar_ptr(n_target, 1);
43345 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043346
William M. Brackf13f77f2004-11-12 16:03:48 +000043347 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043348 desret_int(ret_val);
43349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043350 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043351 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
43352 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043353 xmlResetLastError();
43354 if (mem_base != xmlMemBlocks()) {
43355 printf("Leak of %d blocks found in xmlTextWriterWritePI",
43356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043357 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043358 printf(" %d", n_writer);
43359 printf(" %d", n_target);
43360 printf(" %d", n_content);
43361 printf("\n");
43362 }
43363 }
43364 }
43365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043366 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043367#endif
43368
Daniel Veillard42595322004-11-08 10:52:06 +000043369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043370}
43371
43372
43373static int
43374test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043376
William M. Brack21e4ef22005-01-02 09:53:13 +000043377#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043378 int mem_base;
43379 int ret_val;
43380 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43381 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043382 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043383 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043384
Daniel Veillarde43cc572004-11-03 11:50:29 +000043385 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43386 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043388 writer = gen_xmlTextWriterPtr(n_writer, 0);
43389 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043390
William M. Brackf13f77f2004-11-12 16:03:48 +000043391 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043392 desret_int(ret_val);
43393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043394 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043395 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043396 xmlResetLastError();
43397 if (mem_base != xmlMemBlocks()) {
43398 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
43399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043400 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043401 printf(" %d", n_writer);
43402 printf(" %d", n_content);
43403 printf("\n");
43404 }
43405 }
43406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043407 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043408#endif
43409
Daniel Veillard42595322004-11-08 10:52:06 +000043410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043411}
43412
43413
43414static int
43415test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043417
William M. Brack21e4ef22005-01-02 09:53:13 +000043418#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043419 int mem_base;
43420 int ret_val;
43421 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43422 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043423 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043424 int n_content;
43425 int len; /* length of the text string */
43426 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043427
Daniel Veillarde43cc572004-11-03 11:50:29 +000043428 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43429 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43430 for (n_len = 0;n_len < gen_nb_int;n_len++) {
43431 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043432 writer = gen_xmlTextWriterPtr(n_writer, 0);
43433 content = gen_const_xmlChar_ptr(n_content, 1);
43434 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043435
William M. Brackf13f77f2004-11-12 16:03:48 +000043436 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043437 desret_int(ret_val);
43438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043439 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043440 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000043441 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043442 xmlResetLastError();
43443 if (mem_base != xmlMemBlocks()) {
43444 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
43445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043446 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043447 printf(" %d", n_writer);
43448 printf(" %d", n_content);
43449 printf(" %d", n_len);
43450 printf("\n");
43451 }
43452 }
43453 }
43454 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043455 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043456#endif
43457
Daniel Veillard42595322004-11-08 10:52:06 +000043458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043459}
43460
43461
43462static int
43463test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043465
William M. Brack21e4ef22005-01-02 09:53:13 +000043466#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000043467 int mem_base;
43468 int ret_val;
43469 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
43470 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043471 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000043472 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043473
Daniel Veillarde43cc572004-11-03 11:50:29 +000043474 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
43475 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
43476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043477 writer = gen_xmlTextWriterPtr(n_writer, 0);
43478 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043479
William M. Brackf13f77f2004-11-12 16:03:48 +000043480 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043481 desret_int(ret_val);
43482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043483 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000043484 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000043485 xmlResetLastError();
43486 if (mem_base != xmlMemBlocks()) {
43487 printf("Leak of %d blocks found in xmlTextWriterWriteString",
43488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043489 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043490 printf(" %d", n_writer);
43491 printf(" %d", n_content);
43492 printf("\n");
43493 }
43494 }
43495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043496 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000043497#endif
43498
Daniel Veillard42595322004-11-08 10:52:06 +000043499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043500}
43501
43502
43503static int
43504test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043506
43507
43508 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043510}
43511
43512
43513static int
43514test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043516
43517
43518 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043520}
43521
43522
43523static int
43524test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043526
43527
43528 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043530}
43531
43532
43533static int
43534test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043536
43537
43538 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043540}
43541
43542
43543static int
43544test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043546
43547
43548 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043550}
43551
43552
43553static int
43554test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043556
43557
43558 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043560}
43561
43562
43563static int
43564test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043566
43567
43568 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043570}
43571
43572
43573static int
43574test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043576
43577
43578 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043580}
43581
43582
43583static int
43584test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043586
43587
43588 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043590}
43591
43592
43593static int
43594test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043596
43597
43598 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043600}
43601
43602
43603static int
43604test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043606
43607
43608 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043610}
43611
43612
43613static int
43614test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043616
43617
43618 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043620}
43621
43622
43623static int
43624test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043626
43627
43628 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043630}
43631
43632static int
43633test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043635
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043636 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043637 test_ret += test_xmlNewTextWriter();
43638 test_ret += test_xmlNewTextWriterFilename();
43639 test_ret += test_xmlNewTextWriterMemory();
43640 test_ret += test_xmlNewTextWriterPushParser();
43641 test_ret += test_xmlNewTextWriterTree();
43642 test_ret += test_xmlTextWriterEndAttribute();
43643 test_ret += test_xmlTextWriterEndCDATA();
43644 test_ret += test_xmlTextWriterEndComment();
43645 test_ret += test_xmlTextWriterEndDTD();
43646 test_ret += test_xmlTextWriterEndDTDAttlist();
43647 test_ret += test_xmlTextWriterEndDTDElement();
43648 test_ret += test_xmlTextWriterEndDTDEntity();
43649 test_ret += test_xmlTextWriterEndDocument();
43650 test_ret += test_xmlTextWriterEndElement();
43651 test_ret += test_xmlTextWriterEndPI();
43652 test_ret += test_xmlTextWriterFlush();
43653 test_ret += test_xmlTextWriterFullEndElement();
43654 test_ret += test_xmlTextWriterSetIndent();
43655 test_ret += test_xmlTextWriterSetIndentString();
43656 test_ret += test_xmlTextWriterStartAttribute();
43657 test_ret += test_xmlTextWriterStartAttributeNS();
43658 test_ret += test_xmlTextWriterStartCDATA();
43659 test_ret += test_xmlTextWriterStartComment();
43660 test_ret += test_xmlTextWriterStartDTD();
43661 test_ret += test_xmlTextWriterStartDTDAttlist();
43662 test_ret += test_xmlTextWriterStartDTDElement();
43663 test_ret += test_xmlTextWriterStartDTDEntity();
43664 test_ret += test_xmlTextWriterStartDocument();
43665 test_ret += test_xmlTextWriterStartElement();
43666 test_ret += test_xmlTextWriterStartElementNS();
43667 test_ret += test_xmlTextWriterStartPI();
43668 test_ret += test_xmlTextWriterWriteAttribute();
43669 test_ret += test_xmlTextWriterWriteAttributeNS();
43670 test_ret += test_xmlTextWriterWriteBase64();
43671 test_ret += test_xmlTextWriterWriteBinHex();
43672 test_ret += test_xmlTextWriterWriteCDATA();
43673 test_ret += test_xmlTextWriterWriteComment();
43674 test_ret += test_xmlTextWriterWriteDTD();
43675 test_ret += test_xmlTextWriterWriteDTDAttlist();
43676 test_ret += test_xmlTextWriterWriteDTDElement();
43677 test_ret += test_xmlTextWriterWriteDTDEntity();
43678 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
43679 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
43680 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
43681 test_ret += test_xmlTextWriterWriteDTDNotation();
43682 test_ret += test_xmlTextWriterWriteElement();
43683 test_ret += test_xmlTextWriterWriteElementNS();
43684 test_ret += test_xmlTextWriterWriteFormatAttribute();
43685 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
43686 test_ret += test_xmlTextWriterWriteFormatCDATA();
43687 test_ret += test_xmlTextWriterWriteFormatComment();
43688 test_ret += test_xmlTextWriterWriteFormatDTD();
43689 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
43690 test_ret += test_xmlTextWriterWriteFormatDTDElement();
43691 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
43692 test_ret += test_xmlTextWriterWriteFormatElement();
43693 test_ret += test_xmlTextWriterWriteFormatElementNS();
43694 test_ret += test_xmlTextWriterWriteFormatPI();
43695 test_ret += test_xmlTextWriterWriteFormatRaw();
43696 test_ret += test_xmlTextWriterWriteFormatString();
43697 test_ret += test_xmlTextWriterWritePI();
43698 test_ret += test_xmlTextWriterWriteRaw();
43699 test_ret += test_xmlTextWriterWriteRawLen();
43700 test_ret += test_xmlTextWriterWriteString();
43701 test_ret += test_xmlTextWriterWriteVFormatAttribute();
43702 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
43703 test_ret += test_xmlTextWriterWriteVFormatCDATA();
43704 test_ret += test_xmlTextWriterWriteVFormatComment();
43705 test_ret += test_xmlTextWriterWriteVFormatDTD();
43706 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
43707 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
43708 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
43709 test_ret += test_xmlTextWriterWriteVFormatElement();
43710 test_ret += test_xmlTextWriterWriteVFormatElementNS();
43711 test_ret += test_xmlTextWriterWriteVFormatPI();
43712 test_ret += test_xmlTextWriterWriteVFormatRaw();
43713 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043714
Daniel Veillard42595322004-11-08 10:52:06 +000043715 if (test_ret != 0)
43716 printf("Module xmlwriter: %d errors\n", test_ret);
43717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043718}
43719
43720static int
43721test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043723
William M. Brack21e4ef22005-01-02 09:53:13 +000043724#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043725 int mem_base;
43726 double ret_val;
43727 int val; /* a boolean */
43728 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043729
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043730 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43731 mem_base = xmlMemBlocks();
43732 val = gen_int(n_val, 0);
43733
43734 ret_val = xmlXPathCastBooleanToNumber(val);
43735 desret_double(ret_val);
43736 call_tests++;
43737 des_int(n_val, val, 0);
43738 xmlResetLastError();
43739 if (mem_base != xmlMemBlocks()) {
43740 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
43741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043742 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043743 printf(" %d", n_val);
43744 printf("\n");
43745 }
43746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043747 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043748#endif
43749
Daniel Veillard42595322004-11-08 10:52:06 +000043750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043751}
43752
43753
43754static int
43755test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043757
William M. Brack21e4ef22005-01-02 09:53:13 +000043758#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043759 int mem_base;
43760 xmlChar * ret_val;
43761 int val; /* a boolean */
43762 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043763
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043764 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043766 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043767
43768 ret_val = xmlXPathCastBooleanToString(val);
43769 desret_xmlChar_ptr(ret_val);
43770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043771 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043772 xmlResetLastError();
43773 if (mem_base != xmlMemBlocks()) {
43774 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
43775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043776 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043777 printf(" %d", n_val);
43778 printf("\n");
43779 }
43780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043781 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043782#endif
43783
Daniel Veillard42595322004-11-08 10:52:06 +000043784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043785}
43786
43787
43788static int
43789test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043791
William M. Brack21e4ef22005-01-02 09:53:13 +000043792#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043793 int mem_base;
43794 int ret_val;
43795 xmlNodeSetPtr ns; /* a node-set */
43796 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043797
Daniel Veillardce682bc2004-11-05 17:22:25 +000043798 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43799 mem_base = xmlMemBlocks();
43800 ns = gen_xmlNodeSetPtr(n_ns, 0);
43801
43802 ret_val = xmlXPathCastNodeSetToBoolean(ns);
43803 desret_int(ret_val);
43804 call_tests++;
43805 des_xmlNodeSetPtr(n_ns, ns, 0);
43806 xmlResetLastError();
43807 if (mem_base != xmlMemBlocks()) {
43808 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043810 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043811 printf(" %d", n_ns);
43812 printf("\n");
43813 }
43814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043815 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043816#endif
43817
Daniel Veillard42595322004-11-08 10:52:06 +000043818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043819}
43820
43821
43822static int
43823test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043825
William M. Brack21e4ef22005-01-02 09:53:13 +000043826#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043827 int mem_base;
43828 double ret_val;
43829 xmlNodeSetPtr ns; /* a node-set */
43830 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043831
Daniel Veillardce682bc2004-11-05 17:22:25 +000043832 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43833 mem_base = xmlMemBlocks();
43834 ns = gen_xmlNodeSetPtr(n_ns, 0);
43835
43836 ret_val = xmlXPathCastNodeSetToNumber(ns);
43837 desret_double(ret_val);
43838 call_tests++;
43839 des_xmlNodeSetPtr(n_ns, ns, 0);
43840 xmlResetLastError();
43841 if (mem_base != xmlMemBlocks()) {
43842 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043844 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043845 printf(" %d", n_ns);
43846 printf("\n");
43847 }
43848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043849 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043850#endif
43851
Daniel Veillard42595322004-11-08 10:52:06 +000043852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043853}
43854
43855
43856static int
43857test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043859
William M. Brack21e4ef22005-01-02 09:53:13 +000043860#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043861 int mem_base;
43862 xmlChar * ret_val;
43863 xmlNodeSetPtr ns; /* a node-set */
43864 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043865
Daniel Veillardce682bc2004-11-05 17:22:25 +000043866 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43867 mem_base = xmlMemBlocks();
43868 ns = gen_xmlNodeSetPtr(n_ns, 0);
43869
43870 ret_val = xmlXPathCastNodeSetToString(ns);
43871 desret_xmlChar_ptr(ret_val);
43872 call_tests++;
43873 des_xmlNodeSetPtr(n_ns, ns, 0);
43874 xmlResetLastError();
43875 if (mem_base != xmlMemBlocks()) {
43876 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043878 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043879 printf(" %d", n_ns);
43880 printf("\n");
43881 }
43882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043883 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043884#endif
43885
Daniel Veillard42595322004-11-08 10:52:06 +000043886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043887}
43888
43889
43890static int
43891test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043893
William M. Brack21e4ef22005-01-02 09:53:13 +000043894#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043895 int mem_base;
43896 double ret_val;
43897 xmlNodePtr node; /* a node */
43898 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043899
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043900 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43901 mem_base = xmlMemBlocks();
43902 node = gen_xmlNodePtr(n_node, 0);
43903
43904 ret_val = xmlXPathCastNodeToNumber(node);
43905 desret_double(ret_val);
43906 call_tests++;
43907 des_xmlNodePtr(n_node, node, 0);
43908 xmlResetLastError();
43909 if (mem_base != xmlMemBlocks()) {
43910 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043912 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043913 printf(" %d", n_node);
43914 printf("\n");
43915 }
43916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043917 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043918#endif
43919
Daniel Veillard42595322004-11-08 10:52:06 +000043920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043921}
43922
43923
43924static int
43925test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043927
William M. Brack21e4ef22005-01-02 09:53:13 +000043928#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043929 int mem_base;
43930 xmlChar * ret_val;
43931 xmlNodePtr node; /* a node */
43932 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043933
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043934 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43935 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043936 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043937
43938 ret_val = xmlXPathCastNodeToString(node);
43939 desret_xmlChar_ptr(ret_val);
43940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043941 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043942 xmlResetLastError();
43943 if (mem_base != xmlMemBlocks()) {
43944 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043946 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043947 printf(" %d", n_node);
43948 printf("\n");
43949 }
43950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043951 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043952#endif
43953
Daniel Veillard42595322004-11-08 10:52:06 +000043954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043955}
43956
43957
43958static int
43959test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043961
William M. Brack21e4ef22005-01-02 09:53:13 +000043962#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043963 int mem_base;
43964 int ret_val;
43965 double val; /* a number */
43966 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043967
Daniel Veillard3d95c732004-11-06 22:25:14 +000043968 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43969 mem_base = xmlMemBlocks();
43970 val = gen_double(n_val, 0);
43971
43972 ret_val = xmlXPathCastNumberToBoolean(val);
43973 desret_int(ret_val);
43974 call_tests++;
43975 des_double(n_val, val, 0);
43976 xmlResetLastError();
43977 if (mem_base != xmlMemBlocks()) {
43978 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043980 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043981 printf(" %d", n_val);
43982 printf("\n");
43983 }
43984 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043985 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043986#endif
43987
Daniel Veillard42595322004-11-08 10:52:06 +000043988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043989}
43990
43991
43992static int
43993test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043995
William M. Brack21e4ef22005-01-02 09:53:13 +000043996#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043997 int mem_base;
43998 xmlChar * ret_val;
43999 double val; /* a number */
44000 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044001
Daniel Veillard3d95c732004-11-06 22:25:14 +000044002 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44003 mem_base = xmlMemBlocks();
44004 val = gen_double(n_val, 0);
44005
44006 ret_val = xmlXPathCastNumberToString(val);
44007 desret_xmlChar_ptr(ret_val);
44008 call_tests++;
44009 des_double(n_val, val, 0);
44010 xmlResetLastError();
44011 if (mem_base != xmlMemBlocks()) {
44012 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
44013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044014 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044015 printf(" %d", n_val);
44016 printf("\n");
44017 }
44018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044019 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044020#endif
44021
Daniel Veillard42595322004-11-08 10:52:06 +000044022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044023}
44024
44025
44026static int
44027test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044029
William M. Brack21e4ef22005-01-02 09:53:13 +000044030#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000044031 int mem_base;
44032 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044033 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000044034 int n_val;
44035
44036 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44037 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000044038 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044039
William M. Brackf13f77f2004-11-12 16:03:48 +000044040 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044041 desret_int(ret_val);
44042 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044043 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044044 xmlResetLastError();
44045 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000044046 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000044047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044048 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000044049 printf(" %d", n_val);
44050 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000044051 }
44052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044053 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044054#endif
44055
Daniel Veillard42595322004-11-08 10:52:06 +000044056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044057}
44058
44059
44060static int
44061test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044063
William M. Brack21e4ef22005-01-02 09:53:13 +000044064#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044065 int mem_base;
44066 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044067 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044068 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044069
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044070 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44071 mem_base = xmlMemBlocks();
44072 val = gen_const_xmlChar_ptr(n_val, 0);
44073
William M. Brackf13f77f2004-11-12 16:03:48 +000044074 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044075 desret_double(ret_val);
44076 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044077 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044078 xmlResetLastError();
44079 if (mem_base != xmlMemBlocks()) {
44080 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
44081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044082 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044083 printf(" %d", n_val);
44084 printf("\n");
44085 }
44086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044087 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044088#endif
44089
Daniel Veillard42595322004-11-08 10:52:06 +000044090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044091}
44092
44093
44094static int
44095test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044097
William M. Brack21e4ef22005-01-02 09:53:13 +000044098#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044099 int mem_base;
44100 int ret_val;
44101 xmlXPathObjectPtr val; /* an XPath object */
44102 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044103
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044104 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000044106 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044107
44108 ret_val = xmlXPathCastToBoolean(val);
44109 desret_int(ret_val);
44110 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044111 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044112 xmlResetLastError();
44113 if (mem_base != xmlMemBlocks()) {
44114 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
44115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044116 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044117 printf(" %d", n_val);
44118 printf("\n");
44119 }
44120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044121 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044122#endif
44123
Daniel Veillard42595322004-11-08 10:52:06 +000044124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044125}
44126
44127
44128static int
44129test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044131
William M. Brack21e4ef22005-01-02 09:53:13 +000044132#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044133 int mem_base;
44134 double ret_val;
44135 xmlXPathObjectPtr val; /* an XPath object */
44136 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044137
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044138 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44139 mem_base = xmlMemBlocks();
44140 val = gen_xmlXPathObjectPtr(n_val, 0);
44141
44142 ret_val = xmlXPathCastToNumber(val);
44143 desret_double(ret_val);
44144 call_tests++;
44145 des_xmlXPathObjectPtr(n_val, val, 0);
44146 xmlResetLastError();
44147 if (mem_base != xmlMemBlocks()) {
44148 printf("Leak of %d blocks found in xmlXPathCastToNumber",
44149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044150 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044151 printf(" %d", n_val);
44152 printf("\n");
44153 }
44154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044155 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044156#endif
44157
Daniel Veillard42595322004-11-08 10:52:06 +000044158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044159}
44160
44161
44162static int
44163test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044165
William M. Brack21e4ef22005-01-02 09:53:13 +000044166#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044167 int mem_base;
44168 xmlChar * ret_val;
44169 xmlXPathObjectPtr val; /* an XPath object */
44170 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044171
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044172 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000044174 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044175
44176 ret_val = xmlXPathCastToString(val);
44177 desret_xmlChar_ptr(ret_val);
44178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044179 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044180 xmlResetLastError();
44181 if (mem_base != xmlMemBlocks()) {
44182 printf("Leak of %d blocks found in xmlXPathCastToString",
44183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044184 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044185 printf(" %d", n_val);
44186 printf("\n");
44187 }
44188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044189 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000044190#endif
44191
Daniel Veillard42595322004-11-08 10:52:06 +000044192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044193}
44194
44195
44196static int
44197test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044199
William M. Brack21e4ef22005-01-02 09:53:13 +000044200#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000044201 int mem_base;
44202 int ret_val;
44203 xmlNodePtr node1; /* the first node */
44204 int n_node1;
44205 xmlNodePtr node2; /* the second node */
44206 int n_node2;
44207
44208 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
44209 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
44210 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000044211 node1 = gen_xmlNodePtr(n_node1, 0);
44212 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044213
44214 ret_val = xmlXPathCmpNodes(node1, node2);
44215 desret_int(ret_val);
44216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044217 des_xmlNodePtr(n_node1, node1, 0);
44218 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044219 xmlResetLastError();
44220 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000044221 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000044222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044223 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000044224 printf(" %d", n_node1);
44225 printf(" %d", n_node2);
44226 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000044227 }
44228 }
44229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044230 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044231#endif
44232
Daniel Veillard42595322004-11-08 10:52:06 +000044233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044234}
44235
44236
44237static int
44238test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044240
44241
44242 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044244}
44245
Daniel Veillarda521d282004-11-09 14:59:59 +000044246#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044247
Daniel Veillardce682bc2004-11-05 17:22:25 +000044248#define gen_nb_xmlXPathCompExprPtr 1
44249static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44250 return(NULL);
44251}
44252static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44253}
Daniel Veillarda521d282004-11-09 14:59:59 +000044254#endif
44255
44256#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000044257
44258#define gen_nb_xmlXPathContextPtr 1
44259static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44260 return(NULL);
44261}
44262static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44263}
Daniel Veillarda521d282004-11-09 14:59:59 +000044264#endif
44265
Daniel Veillardce682bc2004-11-05 17:22:25 +000044266
Daniel Veillardd93f6252004-11-02 15:53:51 +000044267static int
44268test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044270
William M. Brack21e4ef22005-01-02 09:53:13 +000044271#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044272 int mem_base;
44273 xmlXPathObjectPtr ret_val;
44274 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
44275 int n_comp;
44276 xmlXPathContextPtr ctx; /* the XPath context */
44277 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044278
Daniel Veillardce682bc2004-11-05 17:22:25 +000044279 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44280 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
44281 mem_base = xmlMemBlocks();
44282 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
44283 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
44284
44285 ret_val = xmlXPathCompiledEval(comp, ctx);
44286 desret_xmlXPathObjectPtr(ret_val);
44287 call_tests++;
44288 des_xmlXPathCompExprPtr(n_comp, comp, 0);
44289 des_xmlXPathContextPtr(n_ctx, ctx, 1);
44290 xmlResetLastError();
44291 if (mem_base != xmlMemBlocks()) {
44292 printf("Leak of %d blocks found in xmlXPathCompiledEval",
44293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044294 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044295 printf(" %d", n_comp);
44296 printf(" %d", n_ctx);
44297 printf("\n");
44298 }
44299 }
44300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044301 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044302#endif
44303
Daniel Veillard42595322004-11-08 10:52:06 +000044304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044305}
44306
44307
44308static int
44309test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044311
William M. Brack21e4ef22005-01-02 09:53:13 +000044312#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044313 int mem_base;
44314 xmlXPathObjectPtr ret_val;
44315 xmlXPathObjectPtr val; /* an XPath object */
44316 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044317
Daniel Veillard3d97e662004-11-04 10:49:00 +000044318 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44319 mem_base = xmlMemBlocks();
44320 val = gen_xmlXPathObjectPtr(n_val, 0);
44321
44322 ret_val = xmlXPathConvertBoolean(val);
44323 val = NULL;
44324 desret_xmlXPathObjectPtr(ret_val);
44325 call_tests++;
44326 des_xmlXPathObjectPtr(n_val, val, 0);
44327 xmlResetLastError();
44328 if (mem_base != xmlMemBlocks()) {
44329 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
44330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044331 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044332 printf(" %d", n_val);
44333 printf("\n");
44334 }
44335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044336 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044337#endif
44338
Daniel Veillard42595322004-11-08 10:52:06 +000044339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044340}
44341
44342
44343static int
44344test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044346
William M. Brack21e4ef22005-01-02 09:53:13 +000044347#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044348 int mem_base;
44349 xmlXPathObjectPtr ret_val;
44350 xmlXPathObjectPtr val; /* an XPath object */
44351 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044352
Daniel Veillard3d97e662004-11-04 10:49:00 +000044353 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44354 mem_base = xmlMemBlocks();
44355 val = gen_xmlXPathObjectPtr(n_val, 0);
44356
44357 ret_val = xmlXPathConvertNumber(val);
44358 val = NULL;
44359 desret_xmlXPathObjectPtr(ret_val);
44360 call_tests++;
44361 des_xmlXPathObjectPtr(n_val, val, 0);
44362 xmlResetLastError();
44363 if (mem_base != xmlMemBlocks()) {
44364 printf("Leak of %d blocks found in xmlXPathConvertNumber",
44365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044366 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044367 printf(" %d", n_val);
44368 printf("\n");
44369 }
44370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044371 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044372#endif
44373
Daniel Veillard42595322004-11-08 10:52:06 +000044374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044375}
44376
44377
44378static int
44379test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044381
William M. Brack21e4ef22005-01-02 09:53:13 +000044382#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044383 int mem_base;
44384 xmlXPathObjectPtr ret_val;
44385 xmlXPathObjectPtr val; /* an XPath object */
44386 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044387
Daniel Veillard3d97e662004-11-04 10:49:00 +000044388 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44389 mem_base = xmlMemBlocks();
44390 val = gen_xmlXPathObjectPtr(n_val, 0);
44391
44392 ret_val = xmlXPathConvertString(val);
44393 val = NULL;
44394 desret_xmlXPathObjectPtr(ret_val);
44395 call_tests++;
44396 des_xmlXPathObjectPtr(n_val, val, 0);
44397 xmlResetLastError();
44398 if (mem_base != xmlMemBlocks()) {
44399 printf("Leak of %d blocks found in xmlXPathConvertString",
44400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044401 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044402 printf(" %d", n_val);
44403 printf("\n");
44404 }
44405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044406 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044407#endif
44408
Daniel Veillard42595322004-11-08 10:52:06 +000044409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044410}
44411
44412
44413static int
44414test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044416
44417
44418 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044420}
44421
44422
44423static int
44424test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044426
William M. Brack21e4ef22005-01-02 09:53:13 +000044427#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044428 int mem_base;
44429 xmlXPathObjectPtr ret_val;
44430 xmlChar * str; /* the XPath expression */
44431 int n_str;
44432 xmlXPathContextPtr ctx; /* the XPath context */
44433 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044434
Daniel Veillardce682bc2004-11-05 17:22:25 +000044435 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
44436 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
44437 mem_base = xmlMemBlocks();
44438 str = gen_const_xmlChar_ptr(n_str, 0);
44439 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
44440
William M. Brackf13f77f2004-11-12 16:03:48 +000044441 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044442 desret_xmlXPathObjectPtr(ret_val);
44443 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044444 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044445 des_xmlXPathContextPtr(n_ctx, ctx, 1);
44446 xmlResetLastError();
44447 if (mem_base != xmlMemBlocks()) {
44448 printf("Leak of %d blocks found in xmlXPathEval",
44449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044450 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044451 printf(" %d", n_str);
44452 printf(" %d", n_ctx);
44453 printf("\n");
44454 }
44455 }
44456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044457 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044458#endif
44459
Daniel Veillard42595322004-11-08 10:52:06 +000044460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044461}
44462
44463
44464static int
44465test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044467
William M. Brack21e4ef22005-01-02 09:53:13 +000044468#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044469 int mem_base;
44470 xmlXPathObjectPtr ret_val;
44471 xmlChar * str; /* the XPath expression */
44472 int n_str;
44473 xmlXPathContextPtr ctxt; /* the XPath context */
44474 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044475
Daniel Veillardce682bc2004-11-05 17:22:25 +000044476 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
44477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44478 mem_base = xmlMemBlocks();
44479 str = gen_const_xmlChar_ptr(n_str, 0);
44480 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
44481
William M. Brackf13f77f2004-11-12 16:03:48 +000044482 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044483 desret_xmlXPathObjectPtr(ret_val);
44484 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044485 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000044486 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
44487 xmlResetLastError();
44488 if (mem_base != xmlMemBlocks()) {
44489 printf("Leak of %d blocks found in xmlXPathEvalExpression",
44490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044491 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044492 printf(" %d", n_str);
44493 printf(" %d", n_ctxt);
44494 printf("\n");
44495 }
44496 }
44497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044498 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044499#endif
44500
Daniel Veillard42595322004-11-08 10:52:06 +000044501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044502}
44503
44504
44505static int
44506test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044508
William M. Brack21e4ef22005-01-02 09:53:13 +000044509#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000044510 int mem_base;
44511 int ret_val;
44512 xmlXPathContextPtr ctxt; /* the XPath context */
44513 int n_ctxt;
44514 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44515 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044516
Daniel Veillardce682bc2004-11-05 17:22:25 +000044517 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44518 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44519 mem_base = xmlMemBlocks();
44520 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44521 res = gen_xmlXPathObjectPtr(n_res, 1);
44522
44523 ret_val = xmlXPathEvalPredicate(ctxt, res);
44524 desret_int(ret_val);
44525 call_tests++;
44526 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44527 des_xmlXPathObjectPtr(n_res, res, 1);
44528 xmlResetLastError();
44529 if (mem_base != xmlMemBlocks()) {
44530 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
44531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044532 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044533 printf(" %d", n_ctxt);
44534 printf(" %d", n_res);
44535 printf("\n");
44536 }
44537 }
44538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044539 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000044540#endif
44541
Daniel Veillard42595322004-11-08 10:52:06 +000044542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044543}
44544
44545
44546static int
44547test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044549
William M. Brack21e4ef22005-01-02 09:53:13 +000044550#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000044551 int mem_base;
44552
44553 mem_base = xmlMemBlocks();
44554
44555 xmlXPathInit();
44556 call_tests++;
44557 xmlResetLastError();
44558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000044559 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000044560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000044562 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000044563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044564 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044565#endif
44566
Daniel Veillard42595322004-11-08 10:52:06 +000044567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044568}
44569
44570
44571static int
44572test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044574
William M. Brack21e4ef22005-01-02 09:53:13 +000044575#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000044576 int mem_base;
44577 int ret_val;
44578 double val; /* a double value */
44579 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044580
Daniel Veillard3d95c732004-11-06 22:25:14 +000044581 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44582 mem_base = xmlMemBlocks();
44583 val = gen_double(n_val, 0);
44584
44585 ret_val = xmlXPathIsInf(val);
44586 desret_int(ret_val);
44587 call_tests++;
44588 des_double(n_val, val, 0);
44589 xmlResetLastError();
44590 if (mem_base != xmlMemBlocks()) {
44591 printf("Leak of %d blocks found in xmlXPathIsInf",
44592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044593 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044594 printf(" %d", n_val);
44595 printf("\n");
44596 }
44597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044598 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044599#endif
44600
Daniel Veillard42595322004-11-08 10:52:06 +000044601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044602}
44603
44604
44605static int
44606test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044608
William M. Brack21e4ef22005-01-02 09:53:13 +000044609#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000044610 int mem_base;
44611 int ret_val;
44612 double val; /* a double value */
44613 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044614
Daniel Veillard3d95c732004-11-06 22:25:14 +000044615 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44616 mem_base = xmlMemBlocks();
44617 val = gen_double(n_val, 0);
44618
44619 ret_val = xmlXPathIsNaN(val);
44620 desret_int(ret_val);
44621 call_tests++;
44622 des_double(n_val, val, 0);
44623 xmlResetLastError();
44624 if (mem_base != xmlMemBlocks()) {
44625 printf("Leak of %d blocks found in xmlXPathIsNaN",
44626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044627 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044628 printf(" %d", n_val);
44629 printf("\n");
44630 }
44631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044632 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044633#endif
44634
Daniel Veillard42595322004-11-08 10:52:06 +000044635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044636}
44637
44638
44639static int
44640test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044642
44643
44644 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044646}
44647
44648
44649static int
44650test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044652
William M. Brack21e4ef22005-01-02 09:53:13 +000044653#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044654 int mem_base;
44655 xmlNodeSetPtr ret_val;
44656 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
44657 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044658
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044659 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44660 mem_base = xmlMemBlocks();
44661 val = gen_xmlNodePtr(n_val, 0);
44662
44663 ret_val = xmlXPathNodeSetCreate(val);
44664 desret_xmlNodeSetPtr(ret_val);
44665 call_tests++;
44666 des_xmlNodePtr(n_val, val, 0);
44667 xmlResetLastError();
44668 if (mem_base != xmlMemBlocks()) {
44669 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
44670 xmlMemBlocks() - mem_base);
44671 test_ret++;
44672 printf(" %d", n_val);
44673 printf("\n");
44674 }
44675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044676 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044677#endif
44678
Daniel Veillard42595322004-11-08 10:52:06 +000044679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044680}
44681
44682
44683static int
44684test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044686
William M. Brack21e4ef22005-01-02 09:53:13 +000044687#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044688 int mem_base;
44689 xmlXPathObjectPtr ret_val;
44690 xmlXPathObjectPtr val; /* the original object */
44691 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044692
Daniel Veillard3d97e662004-11-04 10:49:00 +000044693 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44694 mem_base = xmlMemBlocks();
44695 val = gen_xmlXPathObjectPtr(n_val, 0);
44696
44697 ret_val = xmlXPathObjectCopy(val);
44698 desret_xmlXPathObjectPtr(ret_val);
44699 call_tests++;
44700 des_xmlXPathObjectPtr(n_val, val, 0);
44701 xmlResetLastError();
44702 if (mem_base != xmlMemBlocks()) {
44703 printf("Leak of %d blocks found in xmlXPathObjectCopy",
44704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044705 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044706 printf(" %d", n_val);
44707 printf("\n");
44708 }
44709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044710 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044711#endif
44712
Daniel Veillard42595322004-11-08 10:52:06 +000044713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044714}
44715
44716
44717static int
44718test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044720
William M. Brack21e4ef22005-01-02 09:53:13 +000044721#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044722 int mem_base;
44723 long ret_val;
44724 xmlDocPtr doc; /* an input document */
44725 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044726
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044727 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
44728 mem_base = xmlMemBlocks();
44729 doc = gen_xmlDocPtr(n_doc, 0);
44730
44731 ret_val = xmlXPathOrderDocElems(doc);
44732 desret_long(ret_val);
44733 call_tests++;
44734 des_xmlDocPtr(n_doc, doc, 0);
44735 xmlResetLastError();
44736 if (mem_base != xmlMemBlocks()) {
44737 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
44738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044739 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044740 printf(" %d", n_doc);
44741 printf("\n");
44742 }
44743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044744 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044745#endif
44746
Daniel Veillard42595322004-11-08 10:52:06 +000044747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044748}
44749
44750static int
44751test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044753
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044754 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000044755 test_ret += test_xmlXPathCastBooleanToNumber();
44756 test_ret += test_xmlXPathCastBooleanToString();
44757 test_ret += test_xmlXPathCastNodeSetToBoolean();
44758 test_ret += test_xmlXPathCastNodeSetToNumber();
44759 test_ret += test_xmlXPathCastNodeSetToString();
44760 test_ret += test_xmlXPathCastNodeToNumber();
44761 test_ret += test_xmlXPathCastNodeToString();
44762 test_ret += test_xmlXPathCastNumberToBoolean();
44763 test_ret += test_xmlXPathCastNumberToString();
44764 test_ret += test_xmlXPathCastStringToBoolean();
44765 test_ret += test_xmlXPathCastStringToNumber();
44766 test_ret += test_xmlXPathCastToBoolean();
44767 test_ret += test_xmlXPathCastToNumber();
44768 test_ret += test_xmlXPathCastToString();
44769 test_ret += test_xmlXPathCmpNodes();
44770 test_ret += test_xmlXPathCompile();
44771 test_ret += test_xmlXPathCompiledEval();
44772 test_ret += test_xmlXPathConvertBoolean();
44773 test_ret += test_xmlXPathConvertNumber();
44774 test_ret += test_xmlXPathConvertString();
44775 test_ret += test_xmlXPathCtxtCompile();
44776 test_ret += test_xmlXPathEval();
44777 test_ret += test_xmlXPathEvalExpression();
44778 test_ret += test_xmlXPathEvalPredicate();
44779 test_ret += test_xmlXPathInit();
44780 test_ret += test_xmlXPathIsInf();
44781 test_ret += test_xmlXPathIsNaN();
44782 test_ret += test_xmlXPathNewContext();
44783 test_ret += test_xmlXPathNodeSetCreate();
44784 test_ret += test_xmlXPathObjectCopy();
44785 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000044786
Daniel Veillard42595322004-11-08 10:52:06 +000044787 if (test_ret != 0)
44788 printf("Module xpath: %d errors\n", test_ret);
44789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044790}
Daniel Veillarda521d282004-11-09 14:59:59 +000044791#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044792
Daniel Veillarda82b1822004-11-08 16:24:57 +000044793#define gen_nb_xmlXPathParserContextPtr 1
44794static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44795 return(NULL);
44796}
44797static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44798}
Daniel Veillarda521d282004-11-09 14:59:59 +000044799#endif
44800
Daniel Veillarda82b1822004-11-08 16:24:57 +000044801
44802static int
44803test_valuePop(void) {
44804 int test_ret = 0;
44805
William M. Brack21e4ef22005-01-02 09:53:13 +000044806#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044807 int mem_base;
44808 xmlXPathObjectPtr ret_val;
44809 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44810 int n_ctxt;
44811
44812 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44813 mem_base = xmlMemBlocks();
44814 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44815
44816 ret_val = valuePop(ctxt);
44817 desret_xmlXPathObjectPtr(ret_val);
44818 call_tests++;
44819 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44820 xmlResetLastError();
44821 if (mem_base != xmlMemBlocks()) {
44822 printf("Leak of %d blocks found in valuePop",
44823 xmlMemBlocks() - mem_base);
44824 test_ret++;
44825 printf(" %d", n_ctxt);
44826 printf("\n");
44827 }
44828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044829 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044830#endif
44831
Daniel Veillarda82b1822004-11-08 16:24:57 +000044832 return(test_ret);
44833}
44834
44835
44836static int
44837test_valuePush(void) {
44838 int test_ret = 0;
44839
William M. Brack21e4ef22005-01-02 09:53:13 +000044840#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044841 int mem_base;
44842 int ret_val;
44843 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44844 int n_ctxt;
44845 xmlXPathObjectPtr value; /* the XPath object */
44846 int n_value;
44847
44848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44849 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44850 mem_base = xmlMemBlocks();
44851 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44852 value = gen_xmlXPathObjectPtr(n_value, 1);
44853
44854 ret_val = valuePush(ctxt, value);
44855 desret_int(ret_val);
44856 call_tests++;
44857 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44858 des_xmlXPathObjectPtr(n_value, value, 1);
44859 xmlResetLastError();
44860 if (mem_base != xmlMemBlocks()) {
44861 printf("Leak of %d blocks found in valuePush",
44862 xmlMemBlocks() - mem_base);
44863 test_ret++;
44864 printf(" %d", n_ctxt);
44865 printf(" %d", n_value);
44866 printf("\n");
44867 }
44868 }
44869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044870 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044871#endif
44872
Daniel Veillarda82b1822004-11-08 16:24:57 +000044873 return(test_ret);
44874}
44875
44876
44877static int
44878test_xmlXPathAddValues(void) {
44879 int test_ret = 0;
44880
William M. Brack21e4ef22005-01-02 09:53:13 +000044881#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044882 int mem_base;
44883 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44884 int n_ctxt;
44885
44886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44887 mem_base = xmlMemBlocks();
44888 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44889
44890 xmlXPathAddValues(ctxt);
44891 call_tests++;
44892 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44893 xmlResetLastError();
44894 if (mem_base != xmlMemBlocks()) {
44895 printf("Leak of %d blocks found in xmlXPathAddValues",
44896 xmlMemBlocks() - mem_base);
44897 test_ret++;
44898 printf(" %d", n_ctxt);
44899 printf("\n");
44900 }
44901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044902 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044903#endif
44904
Daniel Veillarda82b1822004-11-08 16:24:57 +000044905 return(test_ret);
44906}
44907
44908
44909static int
44910test_xmlXPathBooleanFunction(void) {
44911 int test_ret = 0;
44912
William M. Brack21e4ef22005-01-02 09:53:13 +000044913#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044914 int mem_base;
44915 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44916 int n_ctxt;
44917 int nargs; /* the number of arguments */
44918 int n_nargs;
44919
44920 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44921 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44922 mem_base = xmlMemBlocks();
44923 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44924 nargs = gen_int(n_nargs, 1);
44925
44926 xmlXPathBooleanFunction(ctxt, nargs);
44927 call_tests++;
44928 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44929 des_int(n_nargs, nargs, 1);
44930 xmlResetLastError();
44931 if (mem_base != xmlMemBlocks()) {
44932 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44933 xmlMemBlocks() - mem_base);
44934 test_ret++;
44935 printf(" %d", n_ctxt);
44936 printf(" %d", n_nargs);
44937 printf("\n");
44938 }
44939 }
44940 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044941 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044942#endif
44943
Daniel Veillarda82b1822004-11-08 16:24:57 +000044944 return(test_ret);
44945}
44946
44947
44948static int
44949test_xmlXPathCeilingFunction(void) {
44950 int test_ret = 0;
44951
William M. Brack21e4ef22005-01-02 09:53:13 +000044952#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044953 int mem_base;
44954 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44955 int n_ctxt;
44956 int nargs; /* the number of arguments */
44957 int n_nargs;
44958
44959 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44960 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44961 mem_base = xmlMemBlocks();
44962 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44963 nargs = gen_int(n_nargs, 1);
44964
44965 xmlXPathCeilingFunction(ctxt, nargs);
44966 call_tests++;
44967 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44968 des_int(n_nargs, nargs, 1);
44969 xmlResetLastError();
44970 if (mem_base != xmlMemBlocks()) {
44971 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44972 xmlMemBlocks() - mem_base);
44973 test_ret++;
44974 printf(" %d", n_ctxt);
44975 printf(" %d", n_nargs);
44976 printf("\n");
44977 }
44978 }
44979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044980 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044981#endif
44982
Daniel Veillarda82b1822004-11-08 16:24:57 +000044983 return(test_ret);
44984}
44985
44986
44987static int
44988test_xmlXPathCompareValues(void) {
44989 int test_ret = 0;
44990
William M. Brack21e4ef22005-01-02 09:53:13 +000044991#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044992 int mem_base;
44993 int ret_val;
44994 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44995 int n_ctxt;
44996 int inf; /* less than (1) or greater than (0) */
44997 int n_inf;
44998 int strict; /* is the comparison strict */
44999 int n_strict;
45000
45001 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45002 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
45003 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
45004 mem_base = xmlMemBlocks();
45005 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45006 inf = gen_int(n_inf, 1);
45007 strict = gen_int(n_strict, 2);
45008
45009 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
45010 desret_int(ret_val);
45011 call_tests++;
45012 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45013 des_int(n_inf, inf, 1);
45014 des_int(n_strict, strict, 2);
45015 xmlResetLastError();
45016 if (mem_base != xmlMemBlocks()) {
45017 printf("Leak of %d blocks found in xmlXPathCompareValues",
45018 xmlMemBlocks() - mem_base);
45019 test_ret++;
45020 printf(" %d", n_ctxt);
45021 printf(" %d", n_inf);
45022 printf(" %d", n_strict);
45023 printf("\n");
45024 }
45025 }
45026 }
45027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045028 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045029#endif
45030
Daniel Veillarda82b1822004-11-08 16:24:57 +000045031 return(test_ret);
45032}
45033
45034
45035static int
45036test_xmlXPathConcatFunction(void) {
45037 int test_ret = 0;
45038
William M. Brack21e4ef22005-01-02 09:53:13 +000045039#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045040 int mem_base;
45041 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45042 int n_ctxt;
45043 int nargs; /* the number of arguments */
45044 int n_nargs;
45045
45046 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45047 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45048 mem_base = xmlMemBlocks();
45049 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45050 nargs = gen_int(n_nargs, 1);
45051
45052 xmlXPathConcatFunction(ctxt, nargs);
45053 call_tests++;
45054 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45055 des_int(n_nargs, nargs, 1);
45056 xmlResetLastError();
45057 if (mem_base != xmlMemBlocks()) {
45058 printf("Leak of %d blocks found in xmlXPathConcatFunction",
45059 xmlMemBlocks() - mem_base);
45060 test_ret++;
45061 printf(" %d", n_ctxt);
45062 printf(" %d", n_nargs);
45063 printf("\n");
45064 }
45065 }
45066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045067 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045068#endif
45069
Daniel Veillarda82b1822004-11-08 16:24:57 +000045070 return(test_ret);
45071}
45072
45073
45074static int
45075test_xmlXPathContainsFunction(void) {
45076 int test_ret = 0;
45077
William M. Brack21e4ef22005-01-02 09:53:13 +000045078#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045079 int mem_base;
45080 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45081 int n_ctxt;
45082 int nargs; /* the number of arguments */
45083 int n_nargs;
45084
45085 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45086 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45087 mem_base = xmlMemBlocks();
45088 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45089 nargs = gen_int(n_nargs, 1);
45090
45091 xmlXPathContainsFunction(ctxt, nargs);
45092 call_tests++;
45093 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45094 des_int(n_nargs, nargs, 1);
45095 xmlResetLastError();
45096 if (mem_base != xmlMemBlocks()) {
45097 printf("Leak of %d blocks found in xmlXPathContainsFunction",
45098 xmlMemBlocks() - mem_base);
45099 test_ret++;
45100 printf(" %d", n_ctxt);
45101 printf(" %d", n_nargs);
45102 printf("\n");
45103 }
45104 }
45105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045106 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045107#endif
45108
Daniel Veillarda82b1822004-11-08 16:24:57 +000045109 return(test_ret);
45110}
45111
45112
45113static int
45114test_xmlXPathCountFunction(void) {
45115 int test_ret = 0;
45116
William M. Brack21e4ef22005-01-02 09:53:13 +000045117#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045118 int mem_base;
45119 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45120 int n_ctxt;
45121 int nargs; /* the number of arguments */
45122 int n_nargs;
45123
45124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45125 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45126 mem_base = xmlMemBlocks();
45127 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45128 nargs = gen_int(n_nargs, 1);
45129
45130 xmlXPathCountFunction(ctxt, nargs);
45131 call_tests++;
45132 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45133 des_int(n_nargs, nargs, 1);
45134 xmlResetLastError();
45135 if (mem_base != xmlMemBlocks()) {
45136 printf("Leak of %d blocks found in xmlXPathCountFunction",
45137 xmlMemBlocks() - mem_base);
45138 test_ret++;
45139 printf(" %d", n_ctxt);
45140 printf(" %d", n_nargs);
45141 printf("\n");
45142 }
45143 }
45144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045145 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045146#endif
45147
Daniel Veillarda82b1822004-11-08 16:24:57 +000045148 return(test_ret);
45149}
45150
45151
45152static int
45153test_xmlXPathDebugDumpCompExpr(void) {
45154 int test_ret = 0;
45155
William M. Brack21e4ef22005-01-02 09:53:13 +000045156#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045157 int mem_base;
45158 FILE * output; /* the FILE * for the output */
45159 int n_output;
45160 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
45161 int n_comp;
45162 int depth; /* the indentation level. */
45163 int n_depth;
45164
45165 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
45166 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
45167 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
45168 mem_base = xmlMemBlocks();
45169 output = gen_FILE_ptr(n_output, 0);
45170 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
45171 depth = gen_int(n_depth, 2);
45172
45173 xmlXPathDebugDumpCompExpr(output, comp, depth);
45174 call_tests++;
45175 des_FILE_ptr(n_output, output, 0);
45176 des_xmlXPathCompExprPtr(n_comp, comp, 1);
45177 des_int(n_depth, depth, 2);
45178 xmlResetLastError();
45179 if (mem_base != xmlMemBlocks()) {
45180 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
45181 xmlMemBlocks() - mem_base);
45182 test_ret++;
45183 printf(" %d", n_output);
45184 printf(" %d", n_comp);
45185 printf(" %d", n_depth);
45186 printf("\n");
45187 }
45188 }
45189 }
45190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045191 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045192#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000045193
Daniel Veillarda82b1822004-11-08 16:24:57 +000045194 return(test_ret);
45195}
45196
45197
45198static int
45199test_xmlXPathDebugDumpObject(void) {
45200 int test_ret = 0;
45201
William M. Brack21e4ef22005-01-02 09:53:13 +000045202#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045203 int mem_base;
45204 FILE * output; /* the FILE * to dump the output */
45205 int n_output;
45206 xmlXPathObjectPtr cur; /* the object to inspect */
45207 int n_cur;
45208 int depth; /* indentation level */
45209 int n_depth;
45210
45211 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
45212 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
45213 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
45214 mem_base = xmlMemBlocks();
45215 output = gen_FILE_ptr(n_output, 0);
45216 cur = gen_xmlXPathObjectPtr(n_cur, 1);
45217 depth = gen_int(n_depth, 2);
45218
45219 xmlXPathDebugDumpObject(output, cur, depth);
45220 call_tests++;
45221 des_FILE_ptr(n_output, output, 0);
45222 des_xmlXPathObjectPtr(n_cur, cur, 1);
45223 des_int(n_depth, depth, 2);
45224 xmlResetLastError();
45225 if (mem_base != xmlMemBlocks()) {
45226 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
45227 xmlMemBlocks() - mem_base);
45228 test_ret++;
45229 printf(" %d", n_output);
45230 printf(" %d", n_cur);
45231 printf(" %d", n_depth);
45232 printf("\n");
45233 }
45234 }
45235 }
45236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045237 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045238#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000045239
Daniel Veillarda82b1822004-11-08 16:24:57 +000045240 return(test_ret);
45241}
45242
45243
45244static int
45245test_xmlXPathDifference(void) {
45246 int test_ret = 0;
45247
William M. Brack21e4ef22005-01-02 09:53:13 +000045248#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045249 int mem_base;
45250 xmlNodeSetPtr ret_val;
45251 xmlNodeSetPtr nodes1; /* a node-set */
45252 int n_nodes1;
45253 xmlNodeSetPtr nodes2; /* a node-set */
45254 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045255
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045256 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45257 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45258 mem_base = xmlMemBlocks();
45259 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45260 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45261
45262 ret_val = xmlXPathDifference(nodes1, nodes2);
45263 desret_xmlNodeSetPtr(ret_val);
45264 call_tests++;
45265 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45266 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45267 xmlResetLastError();
45268 if (mem_base != xmlMemBlocks()) {
45269 printf("Leak of %d blocks found in xmlXPathDifference",
45270 xmlMemBlocks() - mem_base);
45271 test_ret++;
45272 printf(" %d", n_nodes1);
45273 printf(" %d", n_nodes2);
45274 printf("\n");
45275 }
45276 }
45277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045278 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045279#endif
45280
Daniel Veillarda82b1822004-11-08 16:24:57 +000045281 return(test_ret);
45282}
45283
45284
45285static int
45286test_xmlXPathDistinct(void) {
45287 int test_ret = 0;
45288
William M. Brack21e4ef22005-01-02 09:53:13 +000045289#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045290 int mem_base;
45291 xmlNodeSetPtr ret_val;
45292 xmlNodeSetPtr nodes; /* a node-set */
45293 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045294
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045295 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45296 mem_base = xmlMemBlocks();
45297 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45298
45299 ret_val = xmlXPathDistinct(nodes);
45300 desret_xmlNodeSetPtr(ret_val);
45301 call_tests++;
45302 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45303 xmlResetLastError();
45304 if (mem_base != xmlMemBlocks()) {
45305 printf("Leak of %d blocks found in xmlXPathDistinct",
45306 xmlMemBlocks() - mem_base);
45307 test_ret++;
45308 printf(" %d", n_nodes);
45309 printf("\n");
45310 }
45311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045312 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045313#endif
45314
Daniel Veillarda82b1822004-11-08 16:24:57 +000045315 return(test_ret);
45316}
45317
45318
45319static int
45320test_xmlXPathDistinctSorted(void) {
45321 int test_ret = 0;
45322
William M. Brack21e4ef22005-01-02 09:53:13 +000045323#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045324 int mem_base;
45325 xmlNodeSetPtr ret_val;
45326 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45327 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045328
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045329 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45330 mem_base = xmlMemBlocks();
45331 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45332
45333 ret_val = xmlXPathDistinctSorted(nodes);
45334 desret_xmlNodeSetPtr(ret_val);
45335 call_tests++;
45336 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45337 xmlResetLastError();
45338 if (mem_base != xmlMemBlocks()) {
45339 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
45340 xmlMemBlocks() - mem_base);
45341 test_ret++;
45342 printf(" %d", n_nodes);
45343 printf("\n");
45344 }
45345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045346 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045347#endif
45348
Daniel Veillarda82b1822004-11-08 16:24:57 +000045349 return(test_ret);
45350}
45351
45352
45353static int
45354test_xmlXPathDivValues(void) {
45355 int test_ret = 0;
45356
William M. Brack21e4ef22005-01-02 09:53:13 +000045357#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045358 int mem_base;
45359 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45360 int n_ctxt;
45361
45362 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45363 mem_base = xmlMemBlocks();
45364 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45365
45366 xmlXPathDivValues(ctxt);
45367 call_tests++;
45368 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45369 xmlResetLastError();
45370 if (mem_base != xmlMemBlocks()) {
45371 printf("Leak of %d blocks found in xmlXPathDivValues",
45372 xmlMemBlocks() - mem_base);
45373 test_ret++;
45374 printf(" %d", n_ctxt);
45375 printf("\n");
45376 }
45377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045378 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045379#endif
45380
Daniel Veillarda82b1822004-11-08 16:24:57 +000045381 return(test_ret);
45382}
45383
45384
45385static int
45386test_xmlXPathEqualValues(void) {
45387 int test_ret = 0;
45388
William M. Brack21e4ef22005-01-02 09:53:13 +000045389#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045390 int mem_base;
45391 int ret_val;
45392 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45393 int n_ctxt;
45394
45395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45396 mem_base = xmlMemBlocks();
45397 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45398
45399 ret_val = xmlXPathEqualValues(ctxt);
45400 desret_int(ret_val);
45401 call_tests++;
45402 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45403 xmlResetLastError();
45404 if (mem_base != xmlMemBlocks()) {
45405 printf("Leak of %d blocks found in xmlXPathEqualValues",
45406 xmlMemBlocks() - mem_base);
45407 test_ret++;
45408 printf(" %d", n_ctxt);
45409 printf("\n");
45410 }
45411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045412 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045413#endif
45414
Daniel Veillarda82b1822004-11-08 16:24:57 +000045415 return(test_ret);
45416}
45417
45418
45419static int
45420test_xmlXPathErr(void) {
45421 int test_ret = 0;
45422
William M. Brack21e4ef22005-01-02 09:53:13 +000045423#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045424 int mem_base;
45425 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
45426 int n_ctxt;
45427 int error; /* the error code */
45428 int n_error;
45429
45430 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45431 for (n_error = 0;n_error < gen_nb_int;n_error++) {
45432 mem_base = xmlMemBlocks();
45433 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45434 error = gen_int(n_error, 1);
45435
45436 xmlXPathErr(ctxt, error);
45437 call_tests++;
45438 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45439 des_int(n_error, error, 1);
45440 xmlResetLastError();
45441 if (mem_base != xmlMemBlocks()) {
45442 printf("Leak of %d blocks found in xmlXPathErr",
45443 xmlMemBlocks() - mem_base);
45444 test_ret++;
45445 printf(" %d", n_ctxt);
45446 printf(" %d", n_error);
45447 printf("\n");
45448 }
45449 }
45450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045451 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045452#endif
45453
Daniel Veillarda82b1822004-11-08 16:24:57 +000045454 return(test_ret);
45455}
45456
45457
45458static int
45459test_xmlXPathEvalExpr(void) {
45460 int test_ret = 0;
45461
William M. Brack21e4ef22005-01-02 09:53:13 +000045462#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045463 int mem_base;
45464 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45465 int n_ctxt;
45466
45467 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45468 mem_base = xmlMemBlocks();
45469 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45470
45471 xmlXPathEvalExpr(ctxt);
45472 call_tests++;
45473 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45474 xmlResetLastError();
45475 if (mem_base != xmlMemBlocks()) {
45476 printf("Leak of %d blocks found in xmlXPathEvalExpr",
45477 xmlMemBlocks() - mem_base);
45478 test_ret++;
45479 printf(" %d", n_ctxt);
45480 printf("\n");
45481 }
45482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045483 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045484#endif
45485
Daniel Veillarda82b1822004-11-08 16:24:57 +000045486 return(test_ret);
45487}
45488
45489
45490static int
45491test_xmlXPathEvaluatePredicateResult(void) {
45492 int test_ret = 0;
45493
William M. Brack21e4ef22005-01-02 09:53:13 +000045494#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045495 int mem_base;
45496 int ret_val;
45497 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45498 int n_ctxt;
45499 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
45500 int n_res;
45501
45502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45503 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
45504 mem_base = xmlMemBlocks();
45505 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45506 res = gen_xmlXPathObjectPtr(n_res, 1);
45507
45508 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
45509 desret_int(ret_val);
45510 call_tests++;
45511 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45512 des_xmlXPathObjectPtr(n_res, res, 1);
45513 xmlResetLastError();
45514 if (mem_base != xmlMemBlocks()) {
45515 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
45516 xmlMemBlocks() - mem_base);
45517 test_ret++;
45518 printf(" %d", n_ctxt);
45519 printf(" %d", n_res);
45520 printf("\n");
45521 }
45522 }
45523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045524 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045525#endif
45526
Daniel Veillarda82b1822004-11-08 16:24:57 +000045527 return(test_ret);
45528}
45529
45530
45531static int
45532test_xmlXPathFalseFunction(void) {
45533 int test_ret = 0;
45534
William M. Brack21e4ef22005-01-02 09:53:13 +000045535#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045536 int mem_base;
45537 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45538 int n_ctxt;
45539 int nargs; /* the number of arguments */
45540 int n_nargs;
45541
45542 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45543 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45544 mem_base = xmlMemBlocks();
45545 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45546 nargs = gen_int(n_nargs, 1);
45547
45548 xmlXPathFalseFunction(ctxt, nargs);
45549 call_tests++;
45550 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45551 des_int(n_nargs, nargs, 1);
45552 xmlResetLastError();
45553 if (mem_base != xmlMemBlocks()) {
45554 printf("Leak of %d blocks found in xmlXPathFalseFunction",
45555 xmlMemBlocks() - mem_base);
45556 test_ret++;
45557 printf(" %d", n_ctxt);
45558 printf(" %d", n_nargs);
45559 printf("\n");
45560 }
45561 }
45562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045563 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045564#endif
45565
Daniel Veillarda82b1822004-11-08 16:24:57 +000045566 return(test_ret);
45567}
45568
45569
45570static int
45571test_xmlXPathFloorFunction(void) {
45572 int test_ret = 0;
45573
William M. Brack21e4ef22005-01-02 09:53:13 +000045574#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045575 int mem_base;
45576 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45577 int n_ctxt;
45578 int nargs; /* the number of arguments */
45579 int n_nargs;
45580
45581 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45582 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45583 mem_base = xmlMemBlocks();
45584 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45585 nargs = gen_int(n_nargs, 1);
45586
45587 xmlXPathFloorFunction(ctxt, nargs);
45588 call_tests++;
45589 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45590 des_int(n_nargs, nargs, 1);
45591 xmlResetLastError();
45592 if (mem_base != xmlMemBlocks()) {
45593 printf("Leak of %d blocks found in xmlXPathFloorFunction",
45594 xmlMemBlocks() - mem_base);
45595 test_ret++;
45596 printf(" %d", n_ctxt);
45597 printf(" %d", n_nargs);
45598 printf("\n");
45599 }
45600 }
45601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045602 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045603#endif
45604
Daniel Veillarda82b1822004-11-08 16:24:57 +000045605 return(test_ret);
45606}
45607
45608
45609static int
45610test_xmlXPathFunctionLookup(void) {
45611 int test_ret = 0;
45612
45613
45614 /* missing type support */
45615 return(test_ret);
45616}
45617
45618
45619static int
45620test_xmlXPathFunctionLookupNS(void) {
45621 int test_ret = 0;
45622
45623
45624 /* missing type support */
45625 return(test_ret);
45626}
45627
45628
45629static int
45630test_xmlXPathHasSameNodes(void) {
45631 int test_ret = 0;
45632
William M. Brack21e4ef22005-01-02 09:53:13 +000045633#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045634 int mem_base;
45635 int ret_val;
45636 xmlNodeSetPtr nodes1; /* a node-set */
45637 int n_nodes1;
45638 xmlNodeSetPtr nodes2; /* a node-set */
45639 int n_nodes2;
45640
45641 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45642 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45643 mem_base = xmlMemBlocks();
45644 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45645 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45646
45647 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
45648 desret_int(ret_val);
45649 call_tests++;
45650 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45651 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45652 xmlResetLastError();
45653 if (mem_base != xmlMemBlocks()) {
45654 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
45655 xmlMemBlocks() - mem_base);
45656 test_ret++;
45657 printf(" %d", n_nodes1);
45658 printf(" %d", n_nodes2);
45659 printf("\n");
45660 }
45661 }
45662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045663 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045664#endif
45665
Daniel Veillarda82b1822004-11-08 16:24:57 +000045666 return(test_ret);
45667}
45668
45669
45670static int
45671test_xmlXPathIdFunction(void) {
45672 int test_ret = 0;
45673
William M. Brack21e4ef22005-01-02 09:53:13 +000045674#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045675 int mem_base;
45676 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45677 int n_ctxt;
45678 int nargs; /* the number of arguments */
45679 int n_nargs;
45680
45681 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45682 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45683 mem_base = xmlMemBlocks();
45684 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45685 nargs = gen_int(n_nargs, 1);
45686
45687 xmlXPathIdFunction(ctxt, nargs);
45688 call_tests++;
45689 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45690 des_int(n_nargs, nargs, 1);
45691 xmlResetLastError();
45692 if (mem_base != xmlMemBlocks()) {
45693 printf("Leak of %d blocks found in xmlXPathIdFunction",
45694 xmlMemBlocks() - mem_base);
45695 test_ret++;
45696 printf(" %d", n_ctxt);
45697 printf(" %d", n_nargs);
45698 printf("\n");
45699 }
45700 }
45701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045702 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045703#endif
45704
Daniel Veillarda82b1822004-11-08 16:24:57 +000045705 return(test_ret);
45706}
45707
45708
45709static int
45710test_xmlXPathIntersection(void) {
45711 int test_ret = 0;
45712
William M. Brack21e4ef22005-01-02 09:53:13 +000045713#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045714 int mem_base;
45715 xmlNodeSetPtr ret_val;
45716 xmlNodeSetPtr nodes1; /* a node-set */
45717 int n_nodes1;
45718 xmlNodeSetPtr nodes2; /* a node-set */
45719 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045720
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045721 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45722 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45723 mem_base = xmlMemBlocks();
45724 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45725 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45726
45727 ret_val = xmlXPathIntersection(nodes1, nodes2);
45728 desret_xmlNodeSetPtr(ret_val);
45729 call_tests++;
45730 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45731 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45732 xmlResetLastError();
45733 if (mem_base != xmlMemBlocks()) {
45734 printf("Leak of %d blocks found in xmlXPathIntersection",
45735 xmlMemBlocks() - mem_base);
45736 test_ret++;
45737 printf(" %d", n_nodes1);
45738 printf(" %d", n_nodes2);
45739 printf("\n");
45740 }
45741 }
45742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045743 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045744#endif
45745
Daniel Veillarda82b1822004-11-08 16:24:57 +000045746 return(test_ret);
45747}
45748
45749
45750static int
45751test_xmlXPathIsNodeType(void) {
45752 int test_ret = 0;
45753
William M. Brack21e4ef22005-01-02 09:53:13 +000045754#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045755 int mem_base;
45756 int ret_val;
45757 xmlChar * name; /* a name string */
45758 int n_name;
45759
45760 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45761 mem_base = xmlMemBlocks();
45762 name = gen_const_xmlChar_ptr(n_name, 0);
45763
William M. Brackf13f77f2004-11-12 16:03:48 +000045764 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045765 desret_int(ret_val);
45766 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045767 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045768 xmlResetLastError();
45769 if (mem_base != xmlMemBlocks()) {
45770 printf("Leak of %d blocks found in xmlXPathIsNodeType",
45771 xmlMemBlocks() - mem_base);
45772 test_ret++;
45773 printf(" %d", n_name);
45774 printf("\n");
45775 }
45776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045777 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045778#endif
45779
Daniel Veillarda82b1822004-11-08 16:24:57 +000045780 return(test_ret);
45781}
45782
45783
45784static int
45785test_xmlXPathLangFunction(void) {
45786 int test_ret = 0;
45787
William M. Brack21e4ef22005-01-02 09:53:13 +000045788#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045789 int mem_base;
45790 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45791 int n_ctxt;
45792 int nargs; /* the number of arguments */
45793 int n_nargs;
45794
45795 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45796 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45797 mem_base = xmlMemBlocks();
45798 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45799 nargs = gen_int(n_nargs, 1);
45800
45801 xmlXPathLangFunction(ctxt, nargs);
45802 call_tests++;
45803 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45804 des_int(n_nargs, nargs, 1);
45805 xmlResetLastError();
45806 if (mem_base != xmlMemBlocks()) {
45807 printf("Leak of %d blocks found in xmlXPathLangFunction",
45808 xmlMemBlocks() - mem_base);
45809 test_ret++;
45810 printf(" %d", n_ctxt);
45811 printf(" %d", n_nargs);
45812 printf("\n");
45813 }
45814 }
45815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045816 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045817#endif
45818
Daniel Veillarda82b1822004-11-08 16:24:57 +000045819 return(test_ret);
45820}
45821
45822
45823static int
45824test_xmlXPathLastFunction(void) {
45825 int test_ret = 0;
45826
William M. Brack21e4ef22005-01-02 09:53:13 +000045827#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045828 int mem_base;
45829 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45830 int n_ctxt;
45831 int nargs; /* the number of arguments */
45832 int n_nargs;
45833
45834 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45835 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45836 mem_base = xmlMemBlocks();
45837 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45838 nargs = gen_int(n_nargs, 1);
45839
45840 xmlXPathLastFunction(ctxt, nargs);
45841 call_tests++;
45842 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45843 des_int(n_nargs, nargs, 1);
45844 xmlResetLastError();
45845 if (mem_base != xmlMemBlocks()) {
45846 printf("Leak of %d blocks found in xmlXPathLastFunction",
45847 xmlMemBlocks() - mem_base);
45848 test_ret++;
45849 printf(" %d", n_ctxt);
45850 printf(" %d", n_nargs);
45851 printf("\n");
45852 }
45853 }
45854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045855 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045856#endif
45857
Daniel Veillarda82b1822004-11-08 16:24:57 +000045858 return(test_ret);
45859}
45860
45861
45862static int
45863test_xmlXPathLeading(void) {
45864 int test_ret = 0;
45865
William M. Brack21e4ef22005-01-02 09:53:13 +000045866#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045867 int mem_base;
45868 xmlNodeSetPtr ret_val;
45869 xmlNodeSetPtr nodes1; /* a node-set */
45870 int n_nodes1;
45871 xmlNodeSetPtr nodes2; /* a node-set */
45872 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045873
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045874 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45875 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45876 mem_base = xmlMemBlocks();
45877 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45878 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45879
45880 ret_val = xmlXPathLeading(nodes1, nodes2);
45881 desret_xmlNodeSetPtr(ret_val);
45882 call_tests++;
45883 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45884 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45885 xmlResetLastError();
45886 if (mem_base != xmlMemBlocks()) {
45887 printf("Leak of %d blocks found in xmlXPathLeading",
45888 xmlMemBlocks() - mem_base);
45889 test_ret++;
45890 printf(" %d", n_nodes1);
45891 printf(" %d", n_nodes2);
45892 printf("\n");
45893 }
45894 }
45895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045896 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045897#endif
45898
Daniel Veillarda82b1822004-11-08 16:24:57 +000045899 return(test_ret);
45900}
45901
45902
45903static int
45904test_xmlXPathLeadingSorted(void) {
45905 int test_ret = 0;
45906
William M. Brack21e4ef22005-01-02 09:53:13 +000045907#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045908 int mem_base;
45909 xmlNodeSetPtr ret_val;
45910 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45911 int n_nodes1;
45912 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45913 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045914
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045915 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45916 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45917 mem_base = xmlMemBlocks();
45918 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45919 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45920
45921 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45922 desret_xmlNodeSetPtr(ret_val);
45923 call_tests++;
45924 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45925 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45926 xmlResetLastError();
45927 if (mem_base != xmlMemBlocks()) {
45928 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45929 xmlMemBlocks() - mem_base);
45930 test_ret++;
45931 printf(" %d", n_nodes1);
45932 printf(" %d", n_nodes2);
45933 printf("\n");
45934 }
45935 }
45936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045937 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045938#endif
45939
Daniel Veillarda82b1822004-11-08 16:24:57 +000045940 return(test_ret);
45941}
45942
45943
45944static int
45945test_xmlXPathLocalNameFunction(void) {
45946 int test_ret = 0;
45947
William M. Brack21e4ef22005-01-02 09:53:13 +000045948#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045949 int mem_base;
45950 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45951 int n_ctxt;
45952 int nargs; /* the number of arguments */
45953 int n_nargs;
45954
45955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45956 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45957 mem_base = xmlMemBlocks();
45958 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45959 nargs = gen_int(n_nargs, 1);
45960
45961 xmlXPathLocalNameFunction(ctxt, nargs);
45962 call_tests++;
45963 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45964 des_int(n_nargs, nargs, 1);
45965 xmlResetLastError();
45966 if (mem_base != xmlMemBlocks()) {
45967 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45968 xmlMemBlocks() - mem_base);
45969 test_ret++;
45970 printf(" %d", n_ctxt);
45971 printf(" %d", n_nargs);
45972 printf("\n");
45973 }
45974 }
45975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045976 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045977#endif
45978
Daniel Veillarda82b1822004-11-08 16:24:57 +000045979 return(test_ret);
45980}
45981
45982
45983static int
45984test_xmlXPathModValues(void) {
45985 int test_ret = 0;
45986
William M. Brack21e4ef22005-01-02 09:53:13 +000045987#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045988 int mem_base;
45989 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45990 int n_ctxt;
45991
45992 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45993 mem_base = xmlMemBlocks();
45994 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45995
45996 xmlXPathModValues(ctxt);
45997 call_tests++;
45998 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45999 xmlResetLastError();
46000 if (mem_base != xmlMemBlocks()) {
46001 printf("Leak of %d blocks found in xmlXPathModValues",
46002 xmlMemBlocks() - mem_base);
46003 test_ret++;
46004 printf(" %d", n_ctxt);
46005 printf("\n");
46006 }
46007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046008 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046009#endif
46010
Daniel Veillarda82b1822004-11-08 16:24:57 +000046011 return(test_ret);
46012}
46013
46014
46015static int
46016test_xmlXPathMultValues(void) {
46017 int test_ret = 0;
46018
William M. Brack21e4ef22005-01-02 09:53:13 +000046019#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046020 int mem_base;
46021 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46022 int n_ctxt;
46023
46024 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46025 mem_base = xmlMemBlocks();
46026 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46027
46028 xmlXPathMultValues(ctxt);
46029 call_tests++;
46030 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46031 xmlResetLastError();
46032 if (mem_base != xmlMemBlocks()) {
46033 printf("Leak of %d blocks found in xmlXPathMultValues",
46034 xmlMemBlocks() - mem_base);
46035 test_ret++;
46036 printf(" %d", n_ctxt);
46037 printf("\n");
46038 }
46039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046040 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046041#endif
46042
Daniel Veillarda82b1822004-11-08 16:24:57 +000046043 return(test_ret);
46044}
46045
46046
46047static int
46048test_xmlXPathNamespaceURIFunction(void) {
46049 int test_ret = 0;
46050
William M. Brack21e4ef22005-01-02 09:53:13 +000046051#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046052 int mem_base;
46053 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46054 int n_ctxt;
46055 int nargs; /* the number of arguments */
46056 int n_nargs;
46057
46058 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46059 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46060 mem_base = xmlMemBlocks();
46061 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46062 nargs = gen_int(n_nargs, 1);
46063
46064 xmlXPathNamespaceURIFunction(ctxt, nargs);
46065 call_tests++;
46066 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46067 des_int(n_nargs, nargs, 1);
46068 xmlResetLastError();
46069 if (mem_base != xmlMemBlocks()) {
46070 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
46071 xmlMemBlocks() - mem_base);
46072 test_ret++;
46073 printf(" %d", n_ctxt);
46074 printf(" %d", n_nargs);
46075 printf("\n");
46076 }
46077 }
46078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046079 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046080#endif
46081
Daniel Veillarda82b1822004-11-08 16:24:57 +000046082 return(test_ret);
46083}
46084
46085
46086static int
46087test_xmlXPathNewBoolean(void) {
46088 int test_ret = 0;
46089
William M. Brack21e4ef22005-01-02 09:53:13 +000046090#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046091 int mem_base;
46092 xmlXPathObjectPtr ret_val;
46093 int val; /* the boolean value */
46094 int n_val;
46095
46096 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46097 mem_base = xmlMemBlocks();
46098 val = gen_int(n_val, 0);
46099
46100 ret_val = xmlXPathNewBoolean(val);
46101 desret_xmlXPathObjectPtr(ret_val);
46102 call_tests++;
46103 des_int(n_val, val, 0);
46104 xmlResetLastError();
46105 if (mem_base != xmlMemBlocks()) {
46106 printf("Leak of %d blocks found in xmlXPathNewBoolean",
46107 xmlMemBlocks() - mem_base);
46108 test_ret++;
46109 printf(" %d", n_val);
46110 printf("\n");
46111 }
46112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046113 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046114#endif
46115
Daniel Veillarda82b1822004-11-08 16:24:57 +000046116 return(test_ret);
46117}
46118
46119
46120static int
46121test_xmlXPathNewCString(void) {
46122 int test_ret = 0;
46123
William M. Brack21e4ef22005-01-02 09:53:13 +000046124#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046125 int mem_base;
46126 xmlXPathObjectPtr ret_val;
46127 char * val; /* the char * value */
46128 int n_val;
46129
46130 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
46131 mem_base = xmlMemBlocks();
46132 val = gen_const_char_ptr(n_val, 0);
46133
William M. Brackf13f77f2004-11-12 16:03:48 +000046134 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046135 desret_xmlXPathObjectPtr(ret_val);
46136 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046137 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046138 xmlResetLastError();
46139 if (mem_base != xmlMemBlocks()) {
46140 printf("Leak of %d blocks found in xmlXPathNewCString",
46141 xmlMemBlocks() - mem_base);
46142 test_ret++;
46143 printf(" %d", n_val);
46144 printf("\n");
46145 }
46146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046147 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046148#endif
46149
Daniel Veillarda82b1822004-11-08 16:24:57 +000046150 return(test_ret);
46151}
46152
46153
46154static int
46155test_xmlXPathNewFloat(void) {
46156 int test_ret = 0;
46157
William M. Brack21e4ef22005-01-02 09:53:13 +000046158#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046159 int mem_base;
46160 xmlXPathObjectPtr ret_val;
46161 double val; /* the double value */
46162 int n_val;
46163
46164 for (n_val = 0;n_val < gen_nb_double;n_val++) {
46165 mem_base = xmlMemBlocks();
46166 val = gen_double(n_val, 0);
46167
46168 ret_val = xmlXPathNewFloat(val);
46169 desret_xmlXPathObjectPtr(ret_val);
46170 call_tests++;
46171 des_double(n_val, val, 0);
46172 xmlResetLastError();
46173 if (mem_base != xmlMemBlocks()) {
46174 printf("Leak of %d blocks found in xmlXPathNewFloat",
46175 xmlMemBlocks() - mem_base);
46176 test_ret++;
46177 printf(" %d", n_val);
46178 printf("\n");
46179 }
46180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046181 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046182#endif
46183
Daniel Veillarda82b1822004-11-08 16:24:57 +000046184 return(test_ret);
46185}
46186
46187
46188static int
46189test_xmlXPathNewNodeSet(void) {
46190 int test_ret = 0;
46191
William M. Brack21e4ef22005-01-02 09:53:13 +000046192#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046193 int mem_base;
46194 xmlXPathObjectPtr ret_val;
46195 xmlNodePtr val; /* the NodePtr value */
46196 int n_val;
46197
46198 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46199 mem_base = xmlMemBlocks();
46200 val = gen_xmlNodePtr(n_val, 0);
46201
46202 ret_val = xmlXPathNewNodeSet(val);
46203 desret_xmlXPathObjectPtr(ret_val);
46204 call_tests++;
46205 des_xmlNodePtr(n_val, val, 0);
46206 xmlResetLastError();
46207 if (mem_base != xmlMemBlocks()) {
46208 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
46209 xmlMemBlocks() - mem_base);
46210 test_ret++;
46211 printf(" %d", n_val);
46212 printf("\n");
46213 }
46214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046215 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046216#endif
46217
Daniel Veillarda82b1822004-11-08 16:24:57 +000046218 return(test_ret);
46219}
46220
46221
46222static int
46223test_xmlXPathNewNodeSetList(void) {
46224 int test_ret = 0;
46225
William M. Brack21e4ef22005-01-02 09:53:13 +000046226#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046227 int mem_base;
46228 xmlXPathObjectPtr ret_val;
46229 xmlNodeSetPtr val; /* an existing NodeSet */
46230 int n_val;
46231
46232 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
46233 mem_base = xmlMemBlocks();
46234 val = gen_xmlNodeSetPtr(n_val, 0);
46235
46236 ret_val = xmlXPathNewNodeSetList(val);
46237 desret_xmlXPathObjectPtr(ret_val);
46238 call_tests++;
46239 des_xmlNodeSetPtr(n_val, val, 0);
46240 xmlResetLastError();
46241 if (mem_base != xmlMemBlocks()) {
46242 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
46243 xmlMemBlocks() - mem_base);
46244 test_ret++;
46245 printf(" %d", n_val);
46246 printf("\n");
46247 }
46248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046249 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046250#endif
46251
Daniel Veillarda82b1822004-11-08 16:24:57 +000046252 return(test_ret);
46253}
46254
46255
46256static int
46257test_xmlXPathNewParserContext(void) {
46258 int test_ret = 0;
46259
46260
46261 /* missing type support */
46262 return(test_ret);
46263}
46264
46265
46266static int
46267test_xmlXPathNewString(void) {
46268 int test_ret = 0;
46269
William M. Brack21e4ef22005-01-02 09:53:13 +000046270#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046271 int mem_base;
46272 xmlXPathObjectPtr ret_val;
46273 xmlChar * val; /* the xmlChar * value */
46274 int n_val;
46275
46276 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
46277 mem_base = xmlMemBlocks();
46278 val = gen_const_xmlChar_ptr(n_val, 0);
46279
William M. Brackf13f77f2004-11-12 16:03:48 +000046280 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046281 desret_xmlXPathObjectPtr(ret_val);
46282 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046283 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046284 xmlResetLastError();
46285 if (mem_base != xmlMemBlocks()) {
46286 printf("Leak of %d blocks found in xmlXPathNewString",
46287 xmlMemBlocks() - mem_base);
46288 test_ret++;
46289 printf(" %d", n_val);
46290 printf("\n");
46291 }
46292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046293 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046294#endif
46295
Daniel Veillarda82b1822004-11-08 16:24:57 +000046296 return(test_ret);
46297}
46298
46299
46300static int
46301test_xmlXPathNextAncestor(void) {
46302 int test_ret = 0;
46303
William M. Brack21e4ef22005-01-02 09:53:13 +000046304#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046305 int mem_base;
46306 xmlNodePtr ret_val;
46307 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46308 int n_ctxt;
46309 xmlNodePtr cur; /* the current node in the traversal */
46310 int n_cur;
46311
46312 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46313 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46314 mem_base = xmlMemBlocks();
46315 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46316 cur = gen_xmlNodePtr(n_cur, 1);
46317
46318 ret_val = xmlXPathNextAncestor(ctxt, cur);
46319 desret_xmlNodePtr(ret_val);
46320 call_tests++;
46321 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46322 des_xmlNodePtr(n_cur, cur, 1);
46323 xmlResetLastError();
46324 if (mem_base != xmlMemBlocks()) {
46325 printf("Leak of %d blocks found in xmlXPathNextAncestor",
46326 xmlMemBlocks() - mem_base);
46327 test_ret++;
46328 printf(" %d", n_ctxt);
46329 printf(" %d", n_cur);
46330 printf("\n");
46331 }
46332 }
46333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046335#endif
46336
Daniel Veillarda82b1822004-11-08 16:24:57 +000046337 return(test_ret);
46338}
46339
46340
46341static int
46342test_xmlXPathNextAncestorOrSelf(void) {
46343 int test_ret = 0;
46344
William M. Brack21e4ef22005-01-02 09:53:13 +000046345#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046346 int mem_base;
46347 xmlNodePtr ret_val;
46348 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46349 int n_ctxt;
46350 xmlNodePtr cur; /* the current node in the traversal */
46351 int n_cur;
46352
46353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46354 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46355 mem_base = xmlMemBlocks();
46356 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46357 cur = gen_xmlNodePtr(n_cur, 1);
46358
46359 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
46360 desret_xmlNodePtr(ret_val);
46361 call_tests++;
46362 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46363 des_xmlNodePtr(n_cur, cur, 1);
46364 xmlResetLastError();
46365 if (mem_base != xmlMemBlocks()) {
46366 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
46367 xmlMemBlocks() - mem_base);
46368 test_ret++;
46369 printf(" %d", n_ctxt);
46370 printf(" %d", n_cur);
46371 printf("\n");
46372 }
46373 }
46374 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046375 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046376#endif
46377
Daniel Veillarda82b1822004-11-08 16:24:57 +000046378 return(test_ret);
46379}
46380
46381
46382static int
46383test_xmlXPathNextAttribute(void) {
46384 int test_ret = 0;
46385
William M. Brack21e4ef22005-01-02 09:53:13 +000046386#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046387 int mem_base;
46388 xmlNodePtr ret_val;
46389 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46390 int n_ctxt;
46391 xmlNodePtr cur; /* the current attribute in the traversal */
46392 int n_cur;
46393
46394 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46395 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46396 mem_base = xmlMemBlocks();
46397 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46398 cur = gen_xmlNodePtr(n_cur, 1);
46399
46400 ret_val = xmlXPathNextAttribute(ctxt, cur);
46401 desret_xmlNodePtr(ret_val);
46402 call_tests++;
46403 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46404 des_xmlNodePtr(n_cur, cur, 1);
46405 xmlResetLastError();
46406 if (mem_base != xmlMemBlocks()) {
46407 printf("Leak of %d blocks found in xmlXPathNextAttribute",
46408 xmlMemBlocks() - mem_base);
46409 test_ret++;
46410 printf(" %d", n_ctxt);
46411 printf(" %d", n_cur);
46412 printf("\n");
46413 }
46414 }
46415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046416 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046417#endif
46418
Daniel Veillarda82b1822004-11-08 16:24:57 +000046419 return(test_ret);
46420}
46421
46422
46423static int
46424test_xmlXPathNextChild(void) {
46425 int test_ret = 0;
46426
William M. Brack21e4ef22005-01-02 09:53:13 +000046427#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046428 int mem_base;
46429 xmlNodePtr ret_val;
46430 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46431 int n_ctxt;
46432 xmlNodePtr cur; /* the current node in the traversal */
46433 int n_cur;
46434
46435 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46436 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46437 mem_base = xmlMemBlocks();
46438 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46439 cur = gen_xmlNodePtr(n_cur, 1);
46440
46441 ret_val = xmlXPathNextChild(ctxt, cur);
46442 desret_xmlNodePtr(ret_val);
46443 call_tests++;
46444 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46445 des_xmlNodePtr(n_cur, cur, 1);
46446 xmlResetLastError();
46447 if (mem_base != xmlMemBlocks()) {
46448 printf("Leak of %d blocks found in xmlXPathNextChild",
46449 xmlMemBlocks() - mem_base);
46450 test_ret++;
46451 printf(" %d", n_ctxt);
46452 printf(" %d", n_cur);
46453 printf("\n");
46454 }
46455 }
46456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046457 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046458#endif
46459
Daniel Veillarda82b1822004-11-08 16:24:57 +000046460 return(test_ret);
46461}
46462
46463
46464static int
46465test_xmlXPathNextDescendant(void) {
46466 int test_ret = 0;
46467
William M. Brack21e4ef22005-01-02 09:53:13 +000046468#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046469 int mem_base;
46470 xmlNodePtr ret_val;
46471 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46472 int n_ctxt;
46473 xmlNodePtr cur; /* the current node in the traversal */
46474 int n_cur;
46475
46476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46477 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46478 mem_base = xmlMemBlocks();
46479 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46480 cur = gen_xmlNodePtr(n_cur, 1);
46481
46482 ret_val = xmlXPathNextDescendant(ctxt, cur);
46483 desret_xmlNodePtr(ret_val);
46484 call_tests++;
46485 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46486 des_xmlNodePtr(n_cur, cur, 1);
46487 xmlResetLastError();
46488 if (mem_base != xmlMemBlocks()) {
46489 printf("Leak of %d blocks found in xmlXPathNextDescendant",
46490 xmlMemBlocks() - mem_base);
46491 test_ret++;
46492 printf(" %d", n_ctxt);
46493 printf(" %d", n_cur);
46494 printf("\n");
46495 }
46496 }
46497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046498 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046499#endif
46500
Daniel Veillarda82b1822004-11-08 16:24:57 +000046501 return(test_ret);
46502}
46503
46504
46505static int
46506test_xmlXPathNextDescendantOrSelf(void) {
46507 int test_ret = 0;
46508
William M. Brack21e4ef22005-01-02 09:53:13 +000046509#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046510 int mem_base;
46511 xmlNodePtr ret_val;
46512 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46513 int n_ctxt;
46514 xmlNodePtr cur; /* the current node in the traversal */
46515 int n_cur;
46516
46517 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46518 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46519 mem_base = xmlMemBlocks();
46520 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46521 cur = gen_xmlNodePtr(n_cur, 1);
46522
46523 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
46524 desret_xmlNodePtr(ret_val);
46525 call_tests++;
46526 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46527 des_xmlNodePtr(n_cur, cur, 1);
46528 xmlResetLastError();
46529 if (mem_base != xmlMemBlocks()) {
46530 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
46531 xmlMemBlocks() - mem_base);
46532 test_ret++;
46533 printf(" %d", n_ctxt);
46534 printf(" %d", n_cur);
46535 printf("\n");
46536 }
46537 }
46538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046539 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046540#endif
46541
Daniel Veillarda82b1822004-11-08 16:24:57 +000046542 return(test_ret);
46543}
46544
46545
46546static int
46547test_xmlXPathNextFollowing(void) {
46548 int test_ret = 0;
46549
William M. Brack21e4ef22005-01-02 09:53:13 +000046550#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046551 int mem_base;
46552 xmlNodePtr ret_val;
46553 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46554 int n_ctxt;
46555 xmlNodePtr cur; /* the current node in the traversal */
46556 int n_cur;
46557
46558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46559 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46560 mem_base = xmlMemBlocks();
46561 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46562 cur = gen_xmlNodePtr(n_cur, 1);
46563
46564 ret_val = xmlXPathNextFollowing(ctxt, cur);
46565 desret_xmlNodePtr(ret_val);
46566 call_tests++;
46567 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46568 des_xmlNodePtr(n_cur, cur, 1);
46569 xmlResetLastError();
46570 if (mem_base != xmlMemBlocks()) {
46571 printf("Leak of %d blocks found in xmlXPathNextFollowing",
46572 xmlMemBlocks() - mem_base);
46573 test_ret++;
46574 printf(" %d", n_ctxt);
46575 printf(" %d", n_cur);
46576 printf("\n");
46577 }
46578 }
46579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046580 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046581#endif
46582
Daniel Veillarda82b1822004-11-08 16:24:57 +000046583 return(test_ret);
46584}
46585
46586
46587static int
46588test_xmlXPathNextFollowingSibling(void) {
46589 int test_ret = 0;
46590
William M. Brack21e4ef22005-01-02 09:53:13 +000046591#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046592 int mem_base;
46593 xmlNodePtr ret_val;
46594 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46595 int n_ctxt;
46596 xmlNodePtr cur; /* the current node in the traversal */
46597 int n_cur;
46598
46599 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46600 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46601 mem_base = xmlMemBlocks();
46602 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46603 cur = gen_xmlNodePtr(n_cur, 1);
46604
46605 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
46606 desret_xmlNodePtr(ret_val);
46607 call_tests++;
46608 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46609 des_xmlNodePtr(n_cur, cur, 1);
46610 xmlResetLastError();
46611 if (mem_base != xmlMemBlocks()) {
46612 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
46613 xmlMemBlocks() - mem_base);
46614 test_ret++;
46615 printf(" %d", n_ctxt);
46616 printf(" %d", n_cur);
46617 printf("\n");
46618 }
46619 }
46620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046621 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046622#endif
46623
Daniel Veillarda82b1822004-11-08 16:24:57 +000046624 return(test_ret);
46625}
46626
46627
46628static int
46629test_xmlXPathNextNamespace(void) {
46630 int test_ret = 0;
46631
William M. Brack21e4ef22005-01-02 09:53:13 +000046632#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046633 int mem_base;
46634 xmlNodePtr ret_val;
46635 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46636 int n_ctxt;
46637 xmlNodePtr cur; /* the current attribute in the traversal */
46638 int n_cur;
46639
46640 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46641 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46642 mem_base = xmlMemBlocks();
46643 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46644 cur = gen_xmlNodePtr(n_cur, 1);
46645
46646 ret_val = xmlXPathNextNamespace(ctxt, cur);
46647 desret_xmlNodePtr(ret_val);
46648 call_tests++;
46649 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46650 des_xmlNodePtr(n_cur, cur, 1);
46651 xmlResetLastError();
46652 if (mem_base != xmlMemBlocks()) {
46653 printf("Leak of %d blocks found in xmlXPathNextNamespace",
46654 xmlMemBlocks() - mem_base);
46655 test_ret++;
46656 printf(" %d", n_ctxt);
46657 printf(" %d", n_cur);
46658 printf("\n");
46659 }
46660 }
46661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046662 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046663#endif
46664
Daniel Veillarda82b1822004-11-08 16:24:57 +000046665 return(test_ret);
46666}
46667
46668
46669static int
46670test_xmlXPathNextParent(void) {
46671 int test_ret = 0;
46672
William M. Brack21e4ef22005-01-02 09:53:13 +000046673#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046674 int mem_base;
46675 xmlNodePtr ret_val;
46676 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46677 int n_ctxt;
46678 xmlNodePtr cur; /* the current node in the traversal */
46679 int n_cur;
46680
46681 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46682 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46683 mem_base = xmlMemBlocks();
46684 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46685 cur = gen_xmlNodePtr(n_cur, 1);
46686
46687 ret_val = xmlXPathNextParent(ctxt, cur);
46688 desret_xmlNodePtr(ret_val);
46689 call_tests++;
46690 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46691 des_xmlNodePtr(n_cur, cur, 1);
46692 xmlResetLastError();
46693 if (mem_base != xmlMemBlocks()) {
46694 printf("Leak of %d blocks found in xmlXPathNextParent",
46695 xmlMemBlocks() - mem_base);
46696 test_ret++;
46697 printf(" %d", n_ctxt);
46698 printf(" %d", n_cur);
46699 printf("\n");
46700 }
46701 }
46702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046703 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046704#endif
46705
Daniel Veillarda82b1822004-11-08 16:24:57 +000046706 return(test_ret);
46707}
46708
46709
46710static int
46711test_xmlXPathNextPreceding(void) {
46712 int test_ret = 0;
46713
William M. Brack21e4ef22005-01-02 09:53:13 +000046714#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046715 int mem_base;
46716 xmlNodePtr ret_val;
46717 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46718 int n_ctxt;
46719 xmlNodePtr cur; /* the current node in the traversal */
46720 int n_cur;
46721
46722 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46723 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46724 mem_base = xmlMemBlocks();
46725 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46726 cur = gen_xmlNodePtr(n_cur, 1);
46727
46728 ret_val = xmlXPathNextPreceding(ctxt, cur);
46729 desret_xmlNodePtr(ret_val);
46730 call_tests++;
46731 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46732 des_xmlNodePtr(n_cur, cur, 1);
46733 xmlResetLastError();
46734 if (mem_base != xmlMemBlocks()) {
46735 printf("Leak of %d blocks found in xmlXPathNextPreceding",
46736 xmlMemBlocks() - mem_base);
46737 test_ret++;
46738 printf(" %d", n_ctxt);
46739 printf(" %d", n_cur);
46740 printf("\n");
46741 }
46742 }
46743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046744 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046745#endif
46746
Daniel Veillarda82b1822004-11-08 16:24:57 +000046747 return(test_ret);
46748}
46749
46750
46751static int
46752test_xmlXPathNextPrecedingSibling(void) {
46753 int test_ret = 0;
46754
William M. Brack21e4ef22005-01-02 09:53:13 +000046755#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046756 int mem_base;
46757 xmlNodePtr ret_val;
46758 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46759 int n_ctxt;
46760 xmlNodePtr cur; /* the current node in the traversal */
46761 int n_cur;
46762
46763 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46764 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46765 mem_base = xmlMemBlocks();
46766 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46767 cur = gen_xmlNodePtr(n_cur, 1);
46768
46769 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
46770 desret_xmlNodePtr(ret_val);
46771 call_tests++;
46772 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46773 des_xmlNodePtr(n_cur, cur, 1);
46774 xmlResetLastError();
46775 if (mem_base != xmlMemBlocks()) {
46776 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
46777 xmlMemBlocks() - mem_base);
46778 test_ret++;
46779 printf(" %d", n_ctxt);
46780 printf(" %d", n_cur);
46781 printf("\n");
46782 }
46783 }
46784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046785 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046786#endif
46787
Daniel Veillarda82b1822004-11-08 16:24:57 +000046788 return(test_ret);
46789}
46790
46791
46792static int
46793test_xmlXPathNextSelf(void) {
46794 int test_ret = 0;
46795
William M. Brack21e4ef22005-01-02 09:53:13 +000046796#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046797 int mem_base;
46798 xmlNodePtr ret_val;
46799 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46800 int n_ctxt;
46801 xmlNodePtr cur; /* the current node in the traversal */
46802 int n_cur;
46803
46804 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46805 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46806 mem_base = xmlMemBlocks();
46807 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46808 cur = gen_xmlNodePtr(n_cur, 1);
46809
46810 ret_val = xmlXPathNextSelf(ctxt, cur);
46811 desret_xmlNodePtr(ret_val);
46812 call_tests++;
46813 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46814 des_xmlNodePtr(n_cur, cur, 1);
46815 xmlResetLastError();
46816 if (mem_base != xmlMemBlocks()) {
46817 printf("Leak of %d blocks found in xmlXPathNextSelf",
46818 xmlMemBlocks() - mem_base);
46819 test_ret++;
46820 printf(" %d", n_ctxt);
46821 printf(" %d", n_cur);
46822 printf("\n");
46823 }
46824 }
46825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046826 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046827#endif
46828
Daniel Veillarda82b1822004-11-08 16:24:57 +000046829 return(test_ret);
46830}
46831
46832
46833static int
46834test_xmlXPathNodeLeading(void) {
46835 int test_ret = 0;
46836
William M. Brack21e4ef22005-01-02 09:53:13 +000046837#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046838 int mem_base;
46839 xmlNodeSetPtr ret_val;
46840 xmlNodeSetPtr nodes; /* a node-set */
46841 int n_nodes;
46842 xmlNodePtr node; /* a node */
46843 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046844
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046845 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46846 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46847 mem_base = xmlMemBlocks();
46848 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46849 node = gen_xmlNodePtr(n_node, 1);
46850
46851 ret_val = xmlXPathNodeLeading(nodes, node);
46852 desret_xmlNodeSetPtr(ret_val);
46853 call_tests++;
46854 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46855 des_xmlNodePtr(n_node, node, 1);
46856 xmlResetLastError();
46857 if (mem_base != xmlMemBlocks()) {
46858 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46859 xmlMemBlocks() - mem_base);
46860 test_ret++;
46861 printf(" %d", n_nodes);
46862 printf(" %d", n_node);
46863 printf("\n");
46864 }
46865 }
46866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046867 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046868#endif
46869
Daniel Veillarda82b1822004-11-08 16:24:57 +000046870 return(test_ret);
46871}
46872
46873
46874static int
46875test_xmlXPathNodeLeadingSorted(void) {
46876 int test_ret = 0;
46877
William M. Brack21e4ef22005-01-02 09:53:13 +000046878#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046879 int mem_base;
46880 xmlNodeSetPtr ret_val;
46881 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46882 int n_nodes;
46883 xmlNodePtr node; /* a node */
46884 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046885
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046886 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46887 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46888 mem_base = xmlMemBlocks();
46889 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46890 node = gen_xmlNodePtr(n_node, 1);
46891
46892 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46893 desret_xmlNodeSetPtr(ret_val);
46894 call_tests++;
46895 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46896 des_xmlNodePtr(n_node, node, 1);
46897 xmlResetLastError();
46898 if (mem_base != xmlMemBlocks()) {
46899 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46900 xmlMemBlocks() - mem_base);
46901 test_ret++;
46902 printf(" %d", n_nodes);
46903 printf(" %d", n_node);
46904 printf("\n");
46905 }
46906 }
46907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046908 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046909#endif
46910
Daniel Veillarda82b1822004-11-08 16:24:57 +000046911 return(test_ret);
46912}
46913
46914
46915static int
46916test_xmlXPathNodeSetAdd(void) {
46917 int test_ret = 0;
46918
William M. Brack21e4ef22005-01-02 09:53:13 +000046919#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046920 int mem_base;
46921 xmlNodeSetPtr cur; /* the initial node set */
46922 int n_cur;
46923 xmlNodePtr val; /* a new xmlNodePtr */
46924 int n_val;
46925
46926 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46927 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46928 mem_base = xmlMemBlocks();
46929 cur = gen_xmlNodeSetPtr(n_cur, 0);
46930 val = gen_xmlNodePtr(n_val, 1);
46931
46932 xmlXPathNodeSetAdd(cur, val);
46933 call_tests++;
46934 des_xmlNodeSetPtr(n_cur, cur, 0);
46935 des_xmlNodePtr(n_val, val, 1);
46936 xmlResetLastError();
46937 if (mem_base != xmlMemBlocks()) {
46938 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46939 xmlMemBlocks() - mem_base);
46940 test_ret++;
46941 printf(" %d", n_cur);
46942 printf(" %d", n_val);
46943 printf("\n");
46944 }
46945 }
46946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046947 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046948#endif
46949
Daniel Veillarda82b1822004-11-08 16:24:57 +000046950 return(test_ret);
46951}
46952
46953
46954static int
46955test_xmlXPathNodeSetAddNs(void) {
46956 int test_ret = 0;
46957
William M. Brack21e4ef22005-01-02 09:53:13 +000046958#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046959 int mem_base;
46960 xmlNodeSetPtr cur; /* the initial node set */
46961 int n_cur;
46962 xmlNodePtr node; /* the hosting node */
46963 int n_node;
46964 xmlNsPtr ns; /* a the namespace node */
46965 int n_ns;
46966
46967 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46968 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46969 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46970 mem_base = xmlMemBlocks();
46971 cur = gen_xmlNodeSetPtr(n_cur, 0);
46972 node = gen_xmlNodePtr(n_node, 1);
46973 ns = gen_xmlNsPtr(n_ns, 2);
46974
46975 xmlXPathNodeSetAddNs(cur, node, ns);
46976 call_tests++;
46977 des_xmlNodeSetPtr(n_cur, cur, 0);
46978 des_xmlNodePtr(n_node, node, 1);
46979 des_xmlNsPtr(n_ns, ns, 2);
46980 xmlResetLastError();
46981 if (mem_base != xmlMemBlocks()) {
46982 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46983 xmlMemBlocks() - mem_base);
46984 test_ret++;
46985 printf(" %d", n_cur);
46986 printf(" %d", n_node);
46987 printf(" %d", n_ns);
46988 printf("\n");
46989 }
46990 }
46991 }
46992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046993 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046994#endif
46995
Daniel Veillarda82b1822004-11-08 16:24:57 +000046996 return(test_ret);
46997}
46998
46999
47000static int
47001test_xmlXPathNodeSetAddUnique(void) {
47002 int test_ret = 0;
47003
William M. Brack21e4ef22005-01-02 09:53:13 +000047004#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047005 int mem_base;
47006 xmlNodeSetPtr cur; /* the initial node set */
47007 int n_cur;
47008 xmlNodePtr val; /* a new xmlNodePtr */
47009 int n_val;
47010
47011 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
47012 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
47013 mem_base = xmlMemBlocks();
47014 cur = gen_xmlNodeSetPtr(n_cur, 0);
47015 val = gen_xmlNodePtr(n_val, 1);
47016
47017 xmlXPathNodeSetAddUnique(cur, val);
47018 call_tests++;
47019 des_xmlNodeSetPtr(n_cur, cur, 0);
47020 des_xmlNodePtr(n_val, val, 1);
47021 xmlResetLastError();
47022 if (mem_base != xmlMemBlocks()) {
47023 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
47024 xmlMemBlocks() - mem_base);
47025 test_ret++;
47026 printf(" %d", n_cur);
47027 printf(" %d", n_val);
47028 printf("\n");
47029 }
47030 }
47031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047032 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047033#endif
47034
Daniel Veillarda82b1822004-11-08 16:24:57 +000047035 return(test_ret);
47036}
47037
47038
47039static int
47040test_xmlXPathNodeSetContains(void) {
47041 int test_ret = 0;
47042
William M. Brack21e4ef22005-01-02 09:53:13 +000047043#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047044 int mem_base;
47045 int ret_val;
47046 xmlNodeSetPtr cur; /* the node-set */
47047 int n_cur;
47048 xmlNodePtr val; /* the node */
47049 int n_val;
47050
47051 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
47052 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
47053 mem_base = xmlMemBlocks();
47054 cur = gen_xmlNodeSetPtr(n_cur, 0);
47055 val = gen_xmlNodePtr(n_val, 1);
47056
47057 ret_val = xmlXPathNodeSetContains(cur, val);
47058 desret_int(ret_val);
47059 call_tests++;
47060 des_xmlNodeSetPtr(n_cur, cur, 0);
47061 des_xmlNodePtr(n_val, val, 1);
47062 xmlResetLastError();
47063 if (mem_base != xmlMemBlocks()) {
47064 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
47065 xmlMemBlocks() - mem_base);
47066 test_ret++;
47067 printf(" %d", n_cur);
47068 printf(" %d", n_val);
47069 printf("\n");
47070 }
47071 }
47072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047073 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047074#endif
47075
Daniel Veillarda82b1822004-11-08 16:24:57 +000047076 return(test_ret);
47077}
47078
47079
47080static int
47081test_xmlXPathNodeSetDel(void) {
47082 int test_ret = 0;
47083
William M. Brack21e4ef22005-01-02 09:53:13 +000047084#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047085 int mem_base;
47086 xmlNodeSetPtr cur; /* the initial node set */
47087 int n_cur;
47088 xmlNodePtr val; /* an xmlNodePtr */
47089 int n_val;
47090
47091 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
47092 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
47093 mem_base = xmlMemBlocks();
47094 cur = gen_xmlNodeSetPtr(n_cur, 0);
47095 val = gen_xmlNodePtr(n_val, 1);
47096
47097 xmlXPathNodeSetDel(cur, val);
47098 call_tests++;
47099 des_xmlNodeSetPtr(n_cur, cur, 0);
47100 des_xmlNodePtr(n_val, val, 1);
47101 xmlResetLastError();
47102 if (mem_base != xmlMemBlocks()) {
47103 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
47104 xmlMemBlocks() - mem_base);
47105 test_ret++;
47106 printf(" %d", n_cur);
47107 printf(" %d", n_val);
47108 printf("\n");
47109 }
47110 }
47111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047112 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047113#endif
47114
Daniel Veillarda82b1822004-11-08 16:24:57 +000047115 return(test_ret);
47116}
47117
47118
47119static int
47120test_xmlXPathNodeSetMerge(void) {
47121 int test_ret = 0;
47122
William M. Brack21e4ef22005-01-02 09:53:13 +000047123#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047124 int mem_base;
47125 xmlNodeSetPtr ret_val;
47126 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
47127 int n_val1;
47128 xmlNodeSetPtr val2; /* the second NodeSet */
47129 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047130
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047131 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
47132 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
47133 mem_base = xmlMemBlocks();
47134 val1 = gen_xmlNodeSetPtr(n_val1, 0);
47135 val2 = gen_xmlNodeSetPtr(n_val2, 1);
47136
47137 ret_val = xmlXPathNodeSetMerge(val1, val2);
47138 desret_xmlNodeSetPtr(ret_val);
47139 call_tests++;
47140 des_xmlNodeSetPtr(n_val1, val1, 0);
47141 des_xmlNodeSetPtr(n_val2, val2, 1);
47142 xmlResetLastError();
47143 if (mem_base != xmlMemBlocks()) {
47144 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
47145 xmlMemBlocks() - mem_base);
47146 test_ret++;
47147 printf(" %d", n_val1);
47148 printf(" %d", n_val2);
47149 printf("\n");
47150 }
47151 }
47152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047153 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047154#endif
47155
Daniel Veillarda82b1822004-11-08 16:24:57 +000047156 return(test_ret);
47157}
47158
47159
47160static int
47161test_xmlXPathNodeSetRemove(void) {
47162 int test_ret = 0;
47163
William M. Brack21e4ef22005-01-02 09:53:13 +000047164#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047165 int mem_base;
47166 xmlNodeSetPtr cur; /* the initial node set */
47167 int n_cur;
47168 int val; /* the index to remove */
47169 int n_val;
47170
47171 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
47172 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47173 mem_base = xmlMemBlocks();
47174 cur = gen_xmlNodeSetPtr(n_cur, 0);
47175 val = gen_int(n_val, 1);
47176
47177 xmlXPathNodeSetRemove(cur, val);
47178 call_tests++;
47179 des_xmlNodeSetPtr(n_cur, cur, 0);
47180 des_int(n_val, val, 1);
47181 xmlResetLastError();
47182 if (mem_base != xmlMemBlocks()) {
47183 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
47184 xmlMemBlocks() - mem_base);
47185 test_ret++;
47186 printf(" %d", n_cur);
47187 printf(" %d", n_val);
47188 printf("\n");
47189 }
47190 }
47191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047192 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047193#endif
47194
Daniel Veillarda82b1822004-11-08 16:24:57 +000047195 return(test_ret);
47196}
47197
47198
47199static int
47200test_xmlXPathNodeSetSort(void) {
47201 int test_ret = 0;
47202
William M. Brack21e4ef22005-01-02 09:53:13 +000047203#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047204 int mem_base;
47205 xmlNodeSetPtr set; /* the node set */
47206 int n_set;
47207
47208 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
47209 mem_base = xmlMemBlocks();
47210 set = gen_xmlNodeSetPtr(n_set, 0);
47211
47212 xmlXPathNodeSetSort(set);
47213 call_tests++;
47214 des_xmlNodeSetPtr(n_set, set, 0);
47215 xmlResetLastError();
47216 if (mem_base != xmlMemBlocks()) {
47217 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
47218 xmlMemBlocks() - mem_base);
47219 test_ret++;
47220 printf(" %d", n_set);
47221 printf("\n");
47222 }
47223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047224 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047225#endif
47226
Daniel Veillarda82b1822004-11-08 16:24:57 +000047227 return(test_ret);
47228}
47229
47230
47231static int
47232test_xmlXPathNodeTrailing(void) {
47233 int test_ret = 0;
47234
William M. Brack21e4ef22005-01-02 09:53:13 +000047235#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047236 int mem_base;
47237 xmlNodeSetPtr ret_val;
47238 xmlNodeSetPtr nodes; /* a node-set */
47239 int n_nodes;
47240 xmlNodePtr node; /* a node */
47241 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047242
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047243 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
47244 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
47245 mem_base = xmlMemBlocks();
47246 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
47247 node = gen_xmlNodePtr(n_node, 1);
47248
47249 ret_val = xmlXPathNodeTrailing(nodes, node);
47250 desret_xmlNodeSetPtr(ret_val);
47251 call_tests++;
47252 des_xmlNodeSetPtr(n_nodes, nodes, 0);
47253 des_xmlNodePtr(n_node, node, 1);
47254 xmlResetLastError();
47255 if (mem_base != xmlMemBlocks()) {
47256 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
47257 xmlMemBlocks() - mem_base);
47258 test_ret++;
47259 printf(" %d", n_nodes);
47260 printf(" %d", n_node);
47261 printf("\n");
47262 }
47263 }
47264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047265 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047266#endif
47267
Daniel Veillarda82b1822004-11-08 16:24:57 +000047268 return(test_ret);
47269}
47270
47271
47272static int
47273test_xmlXPathNodeTrailingSorted(void) {
47274 int test_ret = 0;
47275
William M. Brack21e4ef22005-01-02 09:53:13 +000047276#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047277 int mem_base;
47278 xmlNodeSetPtr ret_val;
47279 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
47280 int n_nodes;
47281 xmlNodePtr node; /* a node */
47282 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047283
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047284 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
47285 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
47286 mem_base = xmlMemBlocks();
47287 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
47288 node = gen_xmlNodePtr(n_node, 1);
47289
47290 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
47291 desret_xmlNodeSetPtr(ret_val);
47292 call_tests++;
47293 des_xmlNodeSetPtr(n_nodes, nodes, 0);
47294 des_xmlNodePtr(n_node, node, 1);
47295 xmlResetLastError();
47296 if (mem_base != xmlMemBlocks()) {
47297 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
47298 xmlMemBlocks() - mem_base);
47299 test_ret++;
47300 printf(" %d", n_nodes);
47301 printf(" %d", n_node);
47302 printf("\n");
47303 }
47304 }
47305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047306 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047307#endif
47308
Daniel Veillarda82b1822004-11-08 16:24:57 +000047309 return(test_ret);
47310}
47311
47312
47313static int
47314test_xmlXPathNormalizeFunction(void) {
47315 int test_ret = 0;
47316
William M. Brack21e4ef22005-01-02 09:53:13 +000047317#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047318 int mem_base;
47319 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47320 int n_ctxt;
47321 int nargs; /* the number of arguments */
47322 int n_nargs;
47323
47324 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47325 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47326 mem_base = xmlMemBlocks();
47327 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47328 nargs = gen_int(n_nargs, 1);
47329
47330 xmlXPathNormalizeFunction(ctxt, nargs);
47331 call_tests++;
47332 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47333 des_int(n_nargs, nargs, 1);
47334 xmlResetLastError();
47335 if (mem_base != xmlMemBlocks()) {
47336 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
47337 xmlMemBlocks() - mem_base);
47338 test_ret++;
47339 printf(" %d", n_ctxt);
47340 printf(" %d", n_nargs);
47341 printf("\n");
47342 }
47343 }
47344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047345 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047346#endif
47347
Daniel Veillarda82b1822004-11-08 16:24:57 +000047348 return(test_ret);
47349}
47350
47351
47352static int
47353test_xmlXPathNotEqualValues(void) {
47354 int test_ret = 0;
47355
William M. Brack21e4ef22005-01-02 09:53:13 +000047356#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047357 int mem_base;
47358 int ret_val;
47359 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47360 int n_ctxt;
47361
47362 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47363 mem_base = xmlMemBlocks();
47364 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47365
47366 ret_val = xmlXPathNotEqualValues(ctxt);
47367 desret_int(ret_val);
47368 call_tests++;
47369 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47370 xmlResetLastError();
47371 if (mem_base != xmlMemBlocks()) {
47372 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
47373 xmlMemBlocks() - mem_base);
47374 test_ret++;
47375 printf(" %d", n_ctxt);
47376 printf("\n");
47377 }
47378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047379 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047380#endif
47381
Daniel Veillarda82b1822004-11-08 16:24:57 +000047382 return(test_ret);
47383}
47384
47385
47386static int
47387test_xmlXPathNotFunction(void) {
47388 int test_ret = 0;
47389
William M. Brack21e4ef22005-01-02 09:53:13 +000047390#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047391 int mem_base;
47392 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47393 int n_ctxt;
47394 int nargs; /* the number of arguments */
47395 int n_nargs;
47396
47397 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47398 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47399 mem_base = xmlMemBlocks();
47400 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47401 nargs = gen_int(n_nargs, 1);
47402
47403 xmlXPathNotFunction(ctxt, nargs);
47404 call_tests++;
47405 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47406 des_int(n_nargs, nargs, 1);
47407 xmlResetLastError();
47408 if (mem_base != xmlMemBlocks()) {
47409 printf("Leak of %d blocks found in xmlXPathNotFunction",
47410 xmlMemBlocks() - mem_base);
47411 test_ret++;
47412 printf(" %d", n_ctxt);
47413 printf(" %d", n_nargs);
47414 printf("\n");
47415 }
47416 }
47417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047418 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047419#endif
47420
Daniel Veillarda82b1822004-11-08 16:24:57 +000047421 return(test_ret);
47422}
47423
47424
47425static int
47426test_xmlXPathNsLookup(void) {
47427 int test_ret = 0;
47428
William M. Brack21e4ef22005-01-02 09:53:13 +000047429#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047430 int mem_base;
47431 const xmlChar * ret_val;
47432 xmlXPathContextPtr ctxt; /* the XPath context */
47433 int n_ctxt;
47434 xmlChar * prefix; /* the namespace prefix value */
47435 int n_prefix;
47436
47437 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47438 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47439 mem_base = xmlMemBlocks();
47440 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47441 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47442
William M. Brackf13f77f2004-11-12 16:03:48 +000047443 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047444 desret_const_xmlChar_ptr(ret_val);
47445 call_tests++;
47446 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047447 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047448 xmlResetLastError();
47449 if (mem_base != xmlMemBlocks()) {
47450 printf("Leak of %d blocks found in xmlXPathNsLookup",
47451 xmlMemBlocks() - mem_base);
47452 test_ret++;
47453 printf(" %d", n_ctxt);
47454 printf(" %d", n_prefix);
47455 printf("\n");
47456 }
47457 }
47458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047459 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047460#endif
47461
Daniel Veillarda82b1822004-11-08 16:24:57 +000047462 return(test_ret);
47463}
47464
47465
47466static int
47467test_xmlXPathNumberFunction(void) {
47468 int test_ret = 0;
47469
William M. Brack21e4ef22005-01-02 09:53:13 +000047470#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047471 int mem_base;
47472 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47473 int n_ctxt;
47474 int nargs; /* the number of arguments */
47475 int n_nargs;
47476
47477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47478 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47479 mem_base = xmlMemBlocks();
47480 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47481 nargs = gen_int(n_nargs, 1);
47482
47483 xmlXPathNumberFunction(ctxt, nargs);
47484 call_tests++;
47485 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47486 des_int(n_nargs, nargs, 1);
47487 xmlResetLastError();
47488 if (mem_base != xmlMemBlocks()) {
47489 printf("Leak of %d blocks found in xmlXPathNumberFunction",
47490 xmlMemBlocks() - mem_base);
47491 test_ret++;
47492 printf(" %d", n_ctxt);
47493 printf(" %d", n_nargs);
47494 printf("\n");
47495 }
47496 }
47497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047498 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047499#endif
47500
Daniel Veillarda82b1822004-11-08 16:24:57 +000047501 return(test_ret);
47502}
47503
47504
47505static int
47506test_xmlXPathParseNCName(void) {
47507 int test_ret = 0;
47508
William M. Brack21e4ef22005-01-02 09:53:13 +000047509#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047510 int mem_base;
47511 xmlChar * ret_val;
47512 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47513 int n_ctxt;
47514
47515 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47516 mem_base = xmlMemBlocks();
47517 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47518
47519 ret_val = xmlXPathParseNCName(ctxt);
47520 desret_xmlChar_ptr(ret_val);
47521 call_tests++;
47522 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47523 xmlResetLastError();
47524 if (mem_base != xmlMemBlocks()) {
47525 printf("Leak of %d blocks found in xmlXPathParseNCName",
47526 xmlMemBlocks() - mem_base);
47527 test_ret++;
47528 printf(" %d", n_ctxt);
47529 printf("\n");
47530 }
47531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047532 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047533#endif
47534
Daniel Veillarda82b1822004-11-08 16:24:57 +000047535 return(test_ret);
47536}
47537
47538
47539static int
47540test_xmlXPathParseName(void) {
47541 int test_ret = 0;
47542
William M. Brack21e4ef22005-01-02 09:53:13 +000047543#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047544 int mem_base;
47545 xmlChar * ret_val;
47546 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47547 int n_ctxt;
47548
47549 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47550 mem_base = xmlMemBlocks();
47551 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47552
47553 ret_val = xmlXPathParseName(ctxt);
47554 desret_xmlChar_ptr(ret_val);
47555 call_tests++;
47556 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47557 xmlResetLastError();
47558 if (mem_base != xmlMemBlocks()) {
47559 printf("Leak of %d blocks found in xmlXPathParseName",
47560 xmlMemBlocks() - mem_base);
47561 test_ret++;
47562 printf(" %d", n_ctxt);
47563 printf("\n");
47564 }
47565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047566 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047567#endif
47568
Daniel Veillarda82b1822004-11-08 16:24:57 +000047569 return(test_ret);
47570}
47571
47572
47573static int
47574test_xmlXPathPopBoolean(void) {
47575 int test_ret = 0;
47576
William M. Brack21e4ef22005-01-02 09:53:13 +000047577#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047578 int mem_base;
47579 int ret_val;
47580 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47581 int n_ctxt;
47582
47583 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47584 mem_base = xmlMemBlocks();
47585 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47586
47587 ret_val = xmlXPathPopBoolean(ctxt);
47588 desret_int(ret_val);
47589 call_tests++;
47590 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47591 xmlResetLastError();
47592 if (mem_base != xmlMemBlocks()) {
47593 printf("Leak of %d blocks found in xmlXPathPopBoolean",
47594 xmlMemBlocks() - mem_base);
47595 test_ret++;
47596 printf(" %d", n_ctxt);
47597 printf("\n");
47598 }
47599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047600 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047601#endif
47602
Daniel Veillarda82b1822004-11-08 16:24:57 +000047603 return(test_ret);
47604}
47605
47606
47607static int
47608test_xmlXPathPopExternal(void) {
47609 int test_ret = 0;
47610
William M. Brack21e4ef22005-01-02 09:53:13 +000047611#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047612 int mem_base;
47613 void * ret_val;
47614 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47615 int n_ctxt;
47616
47617 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47618 mem_base = xmlMemBlocks();
47619 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47620
47621 ret_val = xmlXPathPopExternal(ctxt);
47622 desret_void_ptr(ret_val);
47623 call_tests++;
47624 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47625 xmlResetLastError();
47626 if (mem_base != xmlMemBlocks()) {
47627 printf("Leak of %d blocks found in xmlXPathPopExternal",
47628 xmlMemBlocks() - mem_base);
47629 test_ret++;
47630 printf(" %d", n_ctxt);
47631 printf("\n");
47632 }
47633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047634 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047635#endif
47636
Daniel Veillarda82b1822004-11-08 16:24:57 +000047637 return(test_ret);
47638}
47639
47640
47641static int
47642test_xmlXPathPopNodeSet(void) {
47643 int test_ret = 0;
47644
William M. Brack21e4ef22005-01-02 09:53:13 +000047645#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047646 int mem_base;
47647 xmlNodeSetPtr ret_val;
47648 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47649 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047650
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047651 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47652 mem_base = xmlMemBlocks();
47653 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47654
47655 ret_val = xmlXPathPopNodeSet(ctxt);
47656 desret_xmlNodeSetPtr(ret_val);
47657 call_tests++;
47658 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47659 xmlResetLastError();
47660 if (mem_base != xmlMemBlocks()) {
47661 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
47662 xmlMemBlocks() - mem_base);
47663 test_ret++;
47664 printf(" %d", n_ctxt);
47665 printf("\n");
47666 }
47667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047668 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047669#endif
47670
Daniel Veillarda82b1822004-11-08 16:24:57 +000047671 return(test_ret);
47672}
47673
47674
47675static int
47676test_xmlXPathPopNumber(void) {
47677 int test_ret = 0;
47678
William M. Brack21e4ef22005-01-02 09:53:13 +000047679#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047680 int mem_base;
47681 double ret_val;
47682 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47683 int n_ctxt;
47684
47685 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47686 mem_base = xmlMemBlocks();
47687 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47688
47689 ret_val = xmlXPathPopNumber(ctxt);
47690 desret_double(ret_val);
47691 call_tests++;
47692 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47693 xmlResetLastError();
47694 if (mem_base != xmlMemBlocks()) {
47695 printf("Leak of %d blocks found in xmlXPathPopNumber",
47696 xmlMemBlocks() - mem_base);
47697 test_ret++;
47698 printf(" %d", n_ctxt);
47699 printf("\n");
47700 }
47701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047702 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047703#endif
47704
Daniel Veillarda82b1822004-11-08 16:24:57 +000047705 return(test_ret);
47706}
47707
47708
47709static int
47710test_xmlXPathPopString(void) {
47711 int test_ret = 0;
47712
William M. Brack21e4ef22005-01-02 09:53:13 +000047713#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047714 int mem_base;
47715 xmlChar * ret_val;
47716 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47717 int n_ctxt;
47718
47719 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47720 mem_base = xmlMemBlocks();
47721 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47722
47723 ret_val = xmlXPathPopString(ctxt);
47724 desret_xmlChar_ptr(ret_val);
47725 call_tests++;
47726 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47727 xmlResetLastError();
47728 if (mem_base != xmlMemBlocks()) {
47729 printf("Leak of %d blocks found in xmlXPathPopString",
47730 xmlMemBlocks() - mem_base);
47731 test_ret++;
47732 printf(" %d", n_ctxt);
47733 printf("\n");
47734 }
47735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047736 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047737#endif
47738
Daniel Veillarda82b1822004-11-08 16:24:57 +000047739 return(test_ret);
47740}
47741
47742
47743static int
47744test_xmlXPathPositionFunction(void) {
47745 int test_ret = 0;
47746
William M. Brack21e4ef22005-01-02 09:53:13 +000047747#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047748 int mem_base;
47749 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47750 int n_ctxt;
47751 int nargs; /* the number of arguments */
47752 int n_nargs;
47753
47754 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47755 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47756 mem_base = xmlMemBlocks();
47757 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47758 nargs = gen_int(n_nargs, 1);
47759
47760 xmlXPathPositionFunction(ctxt, nargs);
47761 call_tests++;
47762 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47763 des_int(n_nargs, nargs, 1);
47764 xmlResetLastError();
47765 if (mem_base != xmlMemBlocks()) {
47766 printf("Leak of %d blocks found in xmlXPathPositionFunction",
47767 xmlMemBlocks() - mem_base);
47768 test_ret++;
47769 printf(" %d", n_ctxt);
47770 printf(" %d", n_nargs);
47771 printf("\n");
47772 }
47773 }
47774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047775 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047776#endif
47777
Daniel Veillarda82b1822004-11-08 16:24:57 +000047778 return(test_ret);
47779}
47780
47781
47782static int
47783test_xmlXPathRegisterAllFunctions(void) {
47784 int test_ret = 0;
47785
William M. Brack21e4ef22005-01-02 09:53:13 +000047786#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047787 int mem_base;
47788 xmlXPathContextPtr ctxt; /* the XPath context */
47789 int n_ctxt;
47790
47791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47792 mem_base = xmlMemBlocks();
47793 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47794
47795 xmlXPathRegisterAllFunctions(ctxt);
47796 call_tests++;
47797 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47798 xmlResetLastError();
47799 if (mem_base != xmlMemBlocks()) {
47800 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
47801 xmlMemBlocks() - mem_base);
47802 test_ret++;
47803 printf(" %d", n_ctxt);
47804 printf("\n");
47805 }
47806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047807 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047808#endif
47809
Daniel Veillarda82b1822004-11-08 16:24:57 +000047810 return(test_ret);
47811}
47812
47813
47814static int
47815test_xmlXPathRegisterFunc(void) {
47816 int test_ret = 0;
47817
47818
47819 /* missing type support */
47820 return(test_ret);
47821}
47822
47823
47824static int
47825test_xmlXPathRegisterFuncLookup(void) {
47826 int test_ret = 0;
47827
47828
47829 /* missing type support */
47830 return(test_ret);
47831}
47832
47833
47834static int
47835test_xmlXPathRegisterFuncNS(void) {
47836 int test_ret = 0;
47837
47838
47839 /* missing type support */
47840 return(test_ret);
47841}
47842
47843
47844static int
47845test_xmlXPathRegisterNs(void) {
47846 int test_ret = 0;
47847
William M. Brack21e4ef22005-01-02 09:53:13 +000047848#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047849 int mem_base;
47850 int ret_val;
47851 xmlXPathContextPtr ctxt; /* the XPath context */
47852 int n_ctxt;
47853 xmlChar * prefix; /* the namespace prefix */
47854 int n_prefix;
47855 xmlChar * ns_uri; /* the namespace name */
47856 int n_ns_uri;
47857
47858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47859 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47860 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47861 mem_base = xmlMemBlocks();
47862 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47863 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47864 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47865
William M. Brackf13f77f2004-11-12 16:03:48 +000047866 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047867 desret_int(ret_val);
47868 call_tests++;
47869 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047870 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47871 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047872 xmlResetLastError();
47873 if (mem_base != xmlMemBlocks()) {
47874 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47875 xmlMemBlocks() - mem_base);
47876 test_ret++;
47877 printf(" %d", n_ctxt);
47878 printf(" %d", n_prefix);
47879 printf(" %d", n_ns_uri);
47880 printf("\n");
47881 }
47882 }
47883 }
47884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047885 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047886#endif
47887
Daniel Veillarda82b1822004-11-08 16:24:57 +000047888 return(test_ret);
47889}
47890
47891
47892static int
47893test_xmlXPathRegisterVariable(void) {
47894 int test_ret = 0;
47895
William M. Brack21e4ef22005-01-02 09:53:13 +000047896#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047897 int mem_base;
47898 int ret_val;
47899 xmlXPathContextPtr ctxt; /* the XPath context */
47900 int n_ctxt;
47901 xmlChar * name; /* the variable name */
47902 int n_name;
47903 xmlXPathObjectPtr value; /* the variable value or NULL */
47904 int n_value;
47905
47906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47907 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47908 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47909 mem_base = xmlMemBlocks();
47910 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47911 name = gen_const_xmlChar_ptr(n_name, 1);
47912 value = gen_xmlXPathObjectPtr(n_value, 2);
47913
William M. Brackf13f77f2004-11-12 16:03:48 +000047914 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047915 desret_int(ret_val);
47916 call_tests++;
47917 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047918 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047919 des_xmlXPathObjectPtr(n_value, value, 2);
47920 xmlResetLastError();
47921 if (mem_base != xmlMemBlocks()) {
47922 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47923 xmlMemBlocks() - mem_base);
47924 test_ret++;
47925 printf(" %d", n_ctxt);
47926 printf(" %d", n_name);
47927 printf(" %d", n_value);
47928 printf("\n");
47929 }
47930 }
47931 }
47932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047933 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047934#endif
47935
Daniel Veillarda82b1822004-11-08 16:24:57 +000047936 return(test_ret);
47937}
47938
47939
47940static int
47941test_xmlXPathRegisterVariableLookup(void) {
47942 int test_ret = 0;
47943
47944
47945 /* missing type support */
47946 return(test_ret);
47947}
47948
47949
47950static int
47951test_xmlXPathRegisterVariableNS(void) {
47952 int test_ret = 0;
47953
William M. Brack21e4ef22005-01-02 09:53:13 +000047954#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047955 int mem_base;
47956 int ret_val;
47957 xmlXPathContextPtr ctxt; /* the XPath context */
47958 int n_ctxt;
47959 xmlChar * name; /* the variable name */
47960 int n_name;
47961 xmlChar * ns_uri; /* the variable namespace URI */
47962 int n_ns_uri;
47963 xmlXPathObjectPtr value; /* the variable value or NULL */
47964 int n_value;
47965
47966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47967 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47968 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47969 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47970 mem_base = xmlMemBlocks();
47971 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47972 name = gen_const_xmlChar_ptr(n_name, 1);
47973 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47974 value = gen_xmlXPathObjectPtr(n_value, 3);
47975
William M. Brackf13f77f2004-11-12 16:03:48 +000047976 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047977 desret_int(ret_val);
47978 call_tests++;
47979 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047980 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47981 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047982 des_xmlXPathObjectPtr(n_value, value, 3);
47983 xmlResetLastError();
47984 if (mem_base != xmlMemBlocks()) {
47985 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47986 xmlMemBlocks() - mem_base);
47987 test_ret++;
47988 printf(" %d", n_ctxt);
47989 printf(" %d", n_name);
47990 printf(" %d", n_ns_uri);
47991 printf(" %d", n_value);
47992 printf("\n");
47993 }
47994 }
47995 }
47996 }
47997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047998 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047999#endif
48000
Daniel Veillarda82b1822004-11-08 16:24:57 +000048001 return(test_ret);
48002}
48003
48004
48005static int
48006test_xmlXPathRegisteredFuncsCleanup(void) {
48007 int test_ret = 0;
48008
William M. Brack21e4ef22005-01-02 09:53:13 +000048009#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048010 int mem_base;
48011 xmlXPathContextPtr ctxt; /* the XPath context */
48012 int n_ctxt;
48013
48014 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48015 mem_base = xmlMemBlocks();
48016 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48017
48018 xmlXPathRegisteredFuncsCleanup(ctxt);
48019 call_tests++;
48020 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
48021 xmlResetLastError();
48022 if (mem_base != xmlMemBlocks()) {
48023 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
48024 xmlMemBlocks() - mem_base);
48025 test_ret++;
48026 printf(" %d", n_ctxt);
48027 printf("\n");
48028 }
48029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048030 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048031#endif
48032
Daniel Veillarda82b1822004-11-08 16:24:57 +000048033 return(test_ret);
48034}
48035
48036
48037static int
48038test_xmlXPathRegisteredNsCleanup(void) {
48039 int test_ret = 0;
48040
William M. Brack21e4ef22005-01-02 09:53:13 +000048041#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048042 int mem_base;
48043 xmlXPathContextPtr ctxt; /* the XPath context */
48044 int n_ctxt;
48045
48046 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48047 mem_base = xmlMemBlocks();
48048 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48049
48050 xmlXPathRegisteredNsCleanup(ctxt);
48051 call_tests++;
48052 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
48053 xmlResetLastError();
48054 if (mem_base != xmlMemBlocks()) {
48055 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
48056 xmlMemBlocks() - mem_base);
48057 test_ret++;
48058 printf(" %d", n_ctxt);
48059 printf("\n");
48060 }
48061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048062 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048063#endif
48064
Daniel Veillarda82b1822004-11-08 16:24:57 +000048065 return(test_ret);
48066}
48067
48068
48069static int
48070test_xmlXPathRegisteredVariablesCleanup(void) {
48071 int test_ret = 0;
48072
William M. Brack21e4ef22005-01-02 09:53:13 +000048073#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048074 int mem_base;
48075 xmlXPathContextPtr ctxt; /* the XPath context */
48076 int n_ctxt;
48077
48078 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48079 mem_base = xmlMemBlocks();
48080 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48081
48082 xmlXPathRegisteredVariablesCleanup(ctxt);
48083 call_tests++;
48084 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
48085 xmlResetLastError();
48086 if (mem_base != xmlMemBlocks()) {
48087 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
48088 xmlMemBlocks() - mem_base);
48089 test_ret++;
48090 printf(" %d", n_ctxt);
48091 printf("\n");
48092 }
48093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048095#endif
48096
Daniel Veillarda82b1822004-11-08 16:24:57 +000048097 return(test_ret);
48098}
48099
48100
48101static int
48102test_xmlXPathRoot(void) {
48103 int test_ret = 0;
48104
William M. Brack21e4ef22005-01-02 09:53:13 +000048105#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048106 int mem_base;
48107 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48108 int n_ctxt;
48109
48110 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48111 mem_base = xmlMemBlocks();
48112 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48113
48114 xmlXPathRoot(ctxt);
48115 call_tests++;
48116 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48117 xmlResetLastError();
48118 if (mem_base != xmlMemBlocks()) {
48119 printf("Leak of %d blocks found in xmlXPathRoot",
48120 xmlMemBlocks() - mem_base);
48121 test_ret++;
48122 printf(" %d", n_ctxt);
48123 printf("\n");
48124 }
48125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048126 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048127#endif
48128
Daniel Veillarda82b1822004-11-08 16:24:57 +000048129 return(test_ret);
48130}
48131
48132
48133static int
48134test_xmlXPathRoundFunction(void) {
48135 int test_ret = 0;
48136
William M. Brack21e4ef22005-01-02 09:53:13 +000048137#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048138 int mem_base;
48139 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48140 int n_ctxt;
48141 int nargs; /* the number of arguments */
48142 int n_nargs;
48143
48144 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48145 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48146 mem_base = xmlMemBlocks();
48147 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48148 nargs = gen_int(n_nargs, 1);
48149
48150 xmlXPathRoundFunction(ctxt, nargs);
48151 call_tests++;
48152 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48153 des_int(n_nargs, nargs, 1);
48154 xmlResetLastError();
48155 if (mem_base != xmlMemBlocks()) {
48156 printf("Leak of %d blocks found in xmlXPathRoundFunction",
48157 xmlMemBlocks() - mem_base);
48158 test_ret++;
48159 printf(" %d", n_ctxt);
48160 printf(" %d", n_nargs);
48161 printf("\n");
48162 }
48163 }
48164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048165 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048166#endif
48167
Daniel Veillarda82b1822004-11-08 16:24:57 +000048168 return(test_ret);
48169}
48170
48171
48172static int
48173test_xmlXPathStartsWithFunction(void) {
48174 int test_ret = 0;
48175
William M. Brack21e4ef22005-01-02 09:53:13 +000048176#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048177 int mem_base;
48178 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48179 int n_ctxt;
48180 int nargs; /* the number of arguments */
48181 int n_nargs;
48182
48183 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48184 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48185 mem_base = xmlMemBlocks();
48186 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48187 nargs = gen_int(n_nargs, 1);
48188
48189 xmlXPathStartsWithFunction(ctxt, nargs);
48190 call_tests++;
48191 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48192 des_int(n_nargs, nargs, 1);
48193 xmlResetLastError();
48194 if (mem_base != xmlMemBlocks()) {
48195 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
48196 xmlMemBlocks() - mem_base);
48197 test_ret++;
48198 printf(" %d", n_ctxt);
48199 printf(" %d", n_nargs);
48200 printf("\n");
48201 }
48202 }
48203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048204 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048205#endif
48206
Daniel Veillarda82b1822004-11-08 16:24:57 +000048207 return(test_ret);
48208}
48209
48210
48211static int
48212test_xmlXPathStringEvalNumber(void) {
48213 int test_ret = 0;
48214
William M. Brack21e4ef22005-01-02 09:53:13 +000048215#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048216 int mem_base;
48217 double ret_val;
48218 xmlChar * str; /* A string to scan */
48219 int n_str;
48220
48221 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48222 mem_base = xmlMemBlocks();
48223 str = gen_const_xmlChar_ptr(n_str, 0);
48224
William M. Brackf13f77f2004-11-12 16:03:48 +000048225 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048226 desret_double(ret_val);
48227 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048228 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048229 xmlResetLastError();
48230 if (mem_base != xmlMemBlocks()) {
48231 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
48232 xmlMemBlocks() - mem_base);
48233 test_ret++;
48234 printf(" %d", n_str);
48235 printf("\n");
48236 }
48237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048238 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048239#endif
48240
Daniel Veillarda82b1822004-11-08 16:24:57 +000048241 return(test_ret);
48242}
48243
48244
48245static int
48246test_xmlXPathStringFunction(void) {
48247 int test_ret = 0;
48248
William M. Brack21e4ef22005-01-02 09:53:13 +000048249#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048250 int mem_base;
48251 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48252 int n_ctxt;
48253 int nargs; /* the number of arguments */
48254 int n_nargs;
48255
48256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48257 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48258 mem_base = xmlMemBlocks();
48259 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48260 nargs = gen_int(n_nargs, 1);
48261
48262 xmlXPathStringFunction(ctxt, nargs);
48263 call_tests++;
48264 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48265 des_int(n_nargs, nargs, 1);
48266 xmlResetLastError();
48267 if (mem_base != xmlMemBlocks()) {
48268 printf("Leak of %d blocks found in xmlXPathStringFunction",
48269 xmlMemBlocks() - mem_base);
48270 test_ret++;
48271 printf(" %d", n_ctxt);
48272 printf(" %d", n_nargs);
48273 printf("\n");
48274 }
48275 }
48276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048277 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048278#endif
48279
Daniel Veillarda82b1822004-11-08 16:24:57 +000048280 return(test_ret);
48281}
48282
48283
48284static int
48285test_xmlXPathStringLengthFunction(void) {
48286 int test_ret = 0;
48287
William M. Brack21e4ef22005-01-02 09:53:13 +000048288#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048289 int mem_base;
48290 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48291 int n_ctxt;
48292 int nargs; /* the number of arguments */
48293 int n_nargs;
48294
48295 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48296 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48297 mem_base = xmlMemBlocks();
48298 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48299 nargs = gen_int(n_nargs, 1);
48300
48301 xmlXPathStringLengthFunction(ctxt, nargs);
48302 call_tests++;
48303 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48304 des_int(n_nargs, nargs, 1);
48305 xmlResetLastError();
48306 if (mem_base != xmlMemBlocks()) {
48307 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
48308 xmlMemBlocks() - mem_base);
48309 test_ret++;
48310 printf(" %d", n_ctxt);
48311 printf(" %d", n_nargs);
48312 printf("\n");
48313 }
48314 }
48315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048316 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048317#endif
48318
Daniel Veillarda82b1822004-11-08 16:24:57 +000048319 return(test_ret);
48320}
48321
48322
48323static int
48324test_xmlXPathSubValues(void) {
48325 int test_ret = 0;
48326
William M. Brack21e4ef22005-01-02 09:53:13 +000048327#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048328 int mem_base;
48329 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48330 int n_ctxt;
48331
48332 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48333 mem_base = xmlMemBlocks();
48334 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48335
48336 xmlXPathSubValues(ctxt);
48337 call_tests++;
48338 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48339 xmlResetLastError();
48340 if (mem_base != xmlMemBlocks()) {
48341 printf("Leak of %d blocks found in xmlXPathSubValues",
48342 xmlMemBlocks() - mem_base);
48343 test_ret++;
48344 printf(" %d", n_ctxt);
48345 printf("\n");
48346 }
48347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048348 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048349#endif
48350
Daniel Veillarda82b1822004-11-08 16:24:57 +000048351 return(test_ret);
48352}
48353
48354
48355static int
48356test_xmlXPathSubstringAfterFunction(void) {
48357 int test_ret = 0;
48358
William M. Brack21e4ef22005-01-02 09:53:13 +000048359#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048360 int mem_base;
48361 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48362 int n_ctxt;
48363 int nargs; /* the number of arguments */
48364 int n_nargs;
48365
48366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48367 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48368 mem_base = xmlMemBlocks();
48369 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48370 nargs = gen_int(n_nargs, 1);
48371
48372 xmlXPathSubstringAfterFunction(ctxt, nargs);
48373 call_tests++;
48374 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48375 des_int(n_nargs, nargs, 1);
48376 xmlResetLastError();
48377 if (mem_base != xmlMemBlocks()) {
48378 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
48379 xmlMemBlocks() - mem_base);
48380 test_ret++;
48381 printf(" %d", n_ctxt);
48382 printf(" %d", n_nargs);
48383 printf("\n");
48384 }
48385 }
48386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048387 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048388#endif
48389
Daniel Veillarda82b1822004-11-08 16:24:57 +000048390 return(test_ret);
48391}
48392
48393
48394static int
48395test_xmlXPathSubstringBeforeFunction(void) {
48396 int test_ret = 0;
48397
William M. Brack21e4ef22005-01-02 09:53:13 +000048398#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048399 int mem_base;
48400 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48401 int n_ctxt;
48402 int nargs; /* the number of arguments */
48403 int n_nargs;
48404
48405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48406 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48407 mem_base = xmlMemBlocks();
48408 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48409 nargs = gen_int(n_nargs, 1);
48410
48411 xmlXPathSubstringBeforeFunction(ctxt, nargs);
48412 call_tests++;
48413 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48414 des_int(n_nargs, nargs, 1);
48415 xmlResetLastError();
48416 if (mem_base != xmlMemBlocks()) {
48417 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
48418 xmlMemBlocks() - mem_base);
48419 test_ret++;
48420 printf(" %d", n_ctxt);
48421 printf(" %d", n_nargs);
48422 printf("\n");
48423 }
48424 }
48425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048426 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048427#endif
48428
Daniel Veillarda82b1822004-11-08 16:24:57 +000048429 return(test_ret);
48430}
48431
48432
48433static int
48434test_xmlXPathSubstringFunction(void) {
48435 int test_ret = 0;
48436
William M. Brack21e4ef22005-01-02 09:53:13 +000048437#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048438 int mem_base;
48439 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48440 int n_ctxt;
48441 int nargs; /* the number of arguments */
48442 int n_nargs;
48443
48444 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48445 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48446 mem_base = xmlMemBlocks();
48447 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48448 nargs = gen_int(n_nargs, 1);
48449
48450 xmlXPathSubstringFunction(ctxt, nargs);
48451 call_tests++;
48452 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48453 des_int(n_nargs, nargs, 1);
48454 xmlResetLastError();
48455 if (mem_base != xmlMemBlocks()) {
48456 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
48457 xmlMemBlocks() - mem_base);
48458 test_ret++;
48459 printf(" %d", n_ctxt);
48460 printf(" %d", n_nargs);
48461 printf("\n");
48462 }
48463 }
48464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048465 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048466#endif
48467
Daniel Veillarda82b1822004-11-08 16:24:57 +000048468 return(test_ret);
48469}
48470
48471
48472static int
48473test_xmlXPathSumFunction(void) {
48474 int test_ret = 0;
48475
William M. Brack21e4ef22005-01-02 09:53:13 +000048476#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048477 int mem_base;
48478 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48479 int n_ctxt;
48480 int nargs; /* the number of arguments */
48481 int n_nargs;
48482
48483 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48484 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48485 mem_base = xmlMemBlocks();
48486 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48487 nargs = gen_int(n_nargs, 1);
48488
48489 xmlXPathSumFunction(ctxt, nargs);
48490 call_tests++;
48491 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48492 des_int(n_nargs, nargs, 1);
48493 xmlResetLastError();
48494 if (mem_base != xmlMemBlocks()) {
48495 printf("Leak of %d blocks found in xmlXPathSumFunction",
48496 xmlMemBlocks() - mem_base);
48497 test_ret++;
48498 printf(" %d", n_ctxt);
48499 printf(" %d", n_nargs);
48500 printf("\n");
48501 }
48502 }
48503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048504 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048505#endif
48506
Daniel Veillarda82b1822004-11-08 16:24:57 +000048507 return(test_ret);
48508}
48509
48510
48511static int
48512test_xmlXPathTrailing(void) {
48513 int test_ret = 0;
48514
William M. Brack21e4ef22005-01-02 09:53:13 +000048515#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048516 int mem_base;
48517 xmlNodeSetPtr ret_val;
48518 xmlNodeSetPtr nodes1; /* a node-set */
48519 int n_nodes1;
48520 xmlNodeSetPtr nodes2; /* a node-set */
48521 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048522
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048523 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
48524 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
48525 mem_base = xmlMemBlocks();
48526 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
48527 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
48528
48529 ret_val = xmlXPathTrailing(nodes1, nodes2);
48530 desret_xmlNodeSetPtr(ret_val);
48531 call_tests++;
48532 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
48533 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
48534 xmlResetLastError();
48535 if (mem_base != xmlMemBlocks()) {
48536 printf("Leak of %d blocks found in xmlXPathTrailing",
48537 xmlMemBlocks() - mem_base);
48538 test_ret++;
48539 printf(" %d", n_nodes1);
48540 printf(" %d", n_nodes2);
48541 printf("\n");
48542 }
48543 }
48544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048545 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048546#endif
48547
Daniel Veillarda82b1822004-11-08 16:24:57 +000048548 return(test_ret);
48549}
48550
48551
48552static int
48553test_xmlXPathTrailingSorted(void) {
48554 int test_ret = 0;
48555
William M. Brack21e4ef22005-01-02 09:53:13 +000048556#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048557 int mem_base;
48558 xmlNodeSetPtr ret_val;
48559 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
48560 int n_nodes1;
48561 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
48562 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048563
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048564 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
48565 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
48566 mem_base = xmlMemBlocks();
48567 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
48568 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
48569
48570 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
48571 desret_xmlNodeSetPtr(ret_val);
48572 call_tests++;
48573 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
48574 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
48575 xmlResetLastError();
48576 if (mem_base != xmlMemBlocks()) {
48577 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
48578 xmlMemBlocks() - mem_base);
48579 test_ret++;
48580 printf(" %d", n_nodes1);
48581 printf(" %d", n_nodes2);
48582 printf("\n");
48583 }
48584 }
48585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048586 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000048587#endif
48588
Daniel Veillarda82b1822004-11-08 16:24:57 +000048589 return(test_ret);
48590}
48591
48592
48593static int
48594test_xmlXPathTranslateFunction(void) {
48595 int test_ret = 0;
48596
William M. Brack21e4ef22005-01-02 09:53:13 +000048597#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048598 int mem_base;
48599 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48600 int n_ctxt;
48601 int nargs; /* the number of arguments */
48602 int n_nargs;
48603
48604 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48605 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48606 mem_base = xmlMemBlocks();
48607 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48608 nargs = gen_int(n_nargs, 1);
48609
48610 xmlXPathTranslateFunction(ctxt, nargs);
48611 call_tests++;
48612 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48613 des_int(n_nargs, nargs, 1);
48614 xmlResetLastError();
48615 if (mem_base != xmlMemBlocks()) {
48616 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
48617 xmlMemBlocks() - mem_base);
48618 test_ret++;
48619 printf(" %d", n_ctxt);
48620 printf(" %d", n_nargs);
48621 printf("\n");
48622 }
48623 }
48624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048625 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048626#endif
48627
Daniel Veillarda82b1822004-11-08 16:24:57 +000048628 return(test_ret);
48629}
48630
48631
48632static int
48633test_xmlXPathTrueFunction(void) {
48634 int test_ret = 0;
48635
William M. Brack21e4ef22005-01-02 09:53:13 +000048636#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048637 int mem_base;
48638 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48639 int n_ctxt;
48640 int nargs; /* the number of arguments */
48641 int n_nargs;
48642
48643 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48644 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48645 mem_base = xmlMemBlocks();
48646 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48647 nargs = gen_int(n_nargs, 1);
48648
48649 xmlXPathTrueFunction(ctxt, nargs);
48650 call_tests++;
48651 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48652 des_int(n_nargs, nargs, 1);
48653 xmlResetLastError();
48654 if (mem_base != xmlMemBlocks()) {
48655 printf("Leak of %d blocks found in xmlXPathTrueFunction",
48656 xmlMemBlocks() - mem_base);
48657 test_ret++;
48658 printf(" %d", n_ctxt);
48659 printf(" %d", n_nargs);
48660 printf("\n");
48661 }
48662 }
48663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048664 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048665#endif
48666
Daniel Veillarda82b1822004-11-08 16:24:57 +000048667 return(test_ret);
48668}
48669
48670
48671static int
48672test_xmlXPathValueFlipSign(void) {
48673 int test_ret = 0;
48674
William M. Brack21e4ef22005-01-02 09:53:13 +000048675#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048676 int mem_base;
48677 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48678 int n_ctxt;
48679
48680 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48681 mem_base = xmlMemBlocks();
48682 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48683
48684 xmlXPathValueFlipSign(ctxt);
48685 call_tests++;
48686 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48687 xmlResetLastError();
48688 if (mem_base != xmlMemBlocks()) {
48689 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
48690 xmlMemBlocks() - mem_base);
48691 test_ret++;
48692 printf(" %d", n_ctxt);
48693 printf("\n");
48694 }
48695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048696 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048697#endif
48698
Daniel Veillarda82b1822004-11-08 16:24:57 +000048699 return(test_ret);
48700}
48701
48702
48703static int
48704test_xmlXPathVariableLookup(void) {
48705 int test_ret = 0;
48706
William M. Brack21e4ef22005-01-02 09:53:13 +000048707#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048708 int mem_base;
48709 xmlXPathObjectPtr ret_val;
48710 xmlXPathContextPtr ctxt; /* the XPath context */
48711 int n_ctxt;
48712 xmlChar * name; /* the variable name */
48713 int n_name;
48714
48715 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48716 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48717 mem_base = xmlMemBlocks();
48718 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48719 name = gen_const_xmlChar_ptr(n_name, 1);
48720
William M. Brackf13f77f2004-11-12 16:03:48 +000048721 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048722 desret_xmlXPathObjectPtr(ret_val);
48723 call_tests++;
48724 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048725 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048726 xmlResetLastError();
48727 if (mem_base != xmlMemBlocks()) {
48728 printf("Leak of %d blocks found in xmlXPathVariableLookup",
48729 xmlMemBlocks() - mem_base);
48730 test_ret++;
48731 printf(" %d", n_ctxt);
48732 printf(" %d", n_name);
48733 printf("\n");
48734 }
48735 }
48736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048737 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048738#endif
48739
Daniel Veillarda82b1822004-11-08 16:24:57 +000048740 return(test_ret);
48741}
48742
48743
48744static int
48745test_xmlXPathVariableLookupNS(void) {
48746 int test_ret = 0;
48747
William M. Brack21e4ef22005-01-02 09:53:13 +000048748#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048749 int mem_base;
48750 xmlXPathObjectPtr ret_val;
48751 xmlXPathContextPtr ctxt; /* the XPath context */
48752 int n_ctxt;
48753 xmlChar * name; /* the variable name */
48754 int n_name;
48755 xmlChar * ns_uri; /* the variable namespace URI */
48756 int n_ns_uri;
48757
48758 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48759 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48760 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
48761 mem_base = xmlMemBlocks();
48762 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48763 name = gen_const_xmlChar_ptr(n_name, 1);
48764 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
48765
William M. Brackf13f77f2004-11-12 16:03:48 +000048766 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048767 desret_xmlXPathObjectPtr(ret_val);
48768 call_tests++;
48769 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048770 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
48771 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048772 xmlResetLastError();
48773 if (mem_base != xmlMemBlocks()) {
48774 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
48775 xmlMemBlocks() - mem_base);
48776 test_ret++;
48777 printf(" %d", n_ctxt);
48778 printf(" %d", n_name);
48779 printf(" %d", n_ns_uri);
48780 printf("\n");
48781 }
48782 }
48783 }
48784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048785 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048786#endif
48787
Daniel Veillarda82b1822004-11-08 16:24:57 +000048788 return(test_ret);
48789}
48790
48791
48792static int
48793test_xmlXPathWrapCString(void) {
48794 int test_ret = 0;
48795
William M. Brack21e4ef22005-01-02 09:53:13 +000048796#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048797 int mem_base;
48798 xmlXPathObjectPtr ret_val;
48799 char * val; /* the char * value */
48800 int n_val;
48801
48802 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
48803 mem_base = xmlMemBlocks();
48804 val = gen_char_ptr(n_val, 0);
48805
48806 ret_val = xmlXPathWrapCString(val);
48807 desret_xmlXPathObjectPtr(ret_val);
48808 call_tests++;
48809 des_char_ptr(n_val, val, 0);
48810 xmlResetLastError();
48811 if (mem_base != xmlMemBlocks()) {
48812 printf("Leak of %d blocks found in xmlXPathWrapCString",
48813 xmlMemBlocks() - mem_base);
48814 test_ret++;
48815 printf(" %d", n_val);
48816 printf("\n");
48817 }
48818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048819 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048820#endif
48821
Daniel Veillarda82b1822004-11-08 16:24:57 +000048822 return(test_ret);
48823}
48824
48825
48826static int
48827test_xmlXPathWrapExternal(void) {
48828 int test_ret = 0;
48829
William M. Brack21e4ef22005-01-02 09:53:13 +000048830#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048831 int mem_base;
48832 xmlXPathObjectPtr ret_val;
48833 void * val; /* the user data */
48834 int n_val;
48835
48836 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48837 mem_base = xmlMemBlocks();
48838 val = gen_void_ptr(n_val, 0);
48839
48840 ret_val = xmlXPathWrapExternal(val);
48841 desret_xmlXPathObjectPtr(ret_val);
48842 call_tests++;
48843 des_void_ptr(n_val, val, 0);
48844 xmlResetLastError();
48845 if (mem_base != xmlMemBlocks()) {
48846 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48847 xmlMemBlocks() - mem_base);
48848 test_ret++;
48849 printf(" %d", n_val);
48850 printf("\n");
48851 }
48852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048853 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048854#endif
48855
Daniel Veillarda82b1822004-11-08 16:24:57 +000048856 return(test_ret);
48857}
48858
48859
48860static int
48861test_xmlXPathWrapNodeSet(void) {
48862 int test_ret = 0;
48863
William M. Brack21e4ef22005-01-02 09:53:13 +000048864#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048865 int mem_base;
48866 xmlXPathObjectPtr ret_val;
48867 xmlNodeSetPtr val; /* the NodePtr value */
48868 int n_val;
48869
48870 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48871 mem_base = xmlMemBlocks();
48872 val = gen_xmlNodeSetPtr(n_val, 0);
48873
48874 ret_val = xmlXPathWrapNodeSet(val);
48875 desret_xmlXPathObjectPtr(ret_val);
48876 call_tests++;
48877 des_xmlNodeSetPtr(n_val, val, 0);
48878 xmlResetLastError();
48879 if (mem_base != xmlMemBlocks()) {
48880 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48881 xmlMemBlocks() - mem_base);
48882 test_ret++;
48883 printf(" %d", n_val);
48884 printf("\n");
48885 }
48886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048887 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048888#endif
48889
Daniel Veillarda82b1822004-11-08 16:24:57 +000048890 return(test_ret);
48891}
48892
48893
48894static int
48895test_xmlXPatherror(void) {
48896 int test_ret = 0;
48897
William M. Brack21e4ef22005-01-02 09:53:13 +000048898#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048899 int mem_base;
48900 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48901 int n_ctxt;
48902 const char * file; /* the file name */
48903 int n_file;
48904 int line; /* the line number */
48905 int n_line;
48906 int no; /* the error number */
48907 int n_no;
48908
48909 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48910 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48911 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48912 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48913 mem_base = xmlMemBlocks();
48914 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48915 file = gen_filepath(n_file, 1);
48916 line = gen_int(n_line, 2);
48917 no = gen_int(n_no, 3);
48918
48919 xmlXPatherror(ctxt, file, line, no);
48920 call_tests++;
48921 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48922 des_filepath(n_file, file, 1);
48923 des_int(n_line, line, 2);
48924 des_int(n_no, no, 3);
48925 xmlResetLastError();
48926 if (mem_base != xmlMemBlocks()) {
48927 printf("Leak of %d blocks found in xmlXPatherror",
48928 xmlMemBlocks() - mem_base);
48929 test_ret++;
48930 printf(" %d", n_ctxt);
48931 printf(" %d", n_file);
48932 printf(" %d", n_line);
48933 printf(" %d", n_no);
48934 printf("\n");
48935 }
48936 }
48937 }
48938 }
48939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048940 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048941#endif
48942
Daniel Veillarda82b1822004-11-08 16:24:57 +000048943 return(test_ret);
48944}
48945
48946static int
48947test_xpathInternals(void) {
48948 int test_ret = 0;
48949
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048950 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048951 test_ret += test_valuePop();
48952 test_ret += test_valuePush();
48953 test_ret += test_xmlXPathAddValues();
48954 test_ret += test_xmlXPathBooleanFunction();
48955 test_ret += test_xmlXPathCeilingFunction();
48956 test_ret += test_xmlXPathCompareValues();
48957 test_ret += test_xmlXPathConcatFunction();
48958 test_ret += test_xmlXPathContainsFunction();
48959 test_ret += test_xmlXPathCountFunction();
48960 test_ret += test_xmlXPathDebugDumpCompExpr();
48961 test_ret += test_xmlXPathDebugDumpObject();
48962 test_ret += test_xmlXPathDifference();
48963 test_ret += test_xmlXPathDistinct();
48964 test_ret += test_xmlXPathDistinctSorted();
48965 test_ret += test_xmlXPathDivValues();
48966 test_ret += test_xmlXPathEqualValues();
48967 test_ret += test_xmlXPathErr();
48968 test_ret += test_xmlXPathEvalExpr();
48969 test_ret += test_xmlXPathEvaluatePredicateResult();
48970 test_ret += test_xmlXPathFalseFunction();
48971 test_ret += test_xmlXPathFloorFunction();
48972 test_ret += test_xmlXPathFunctionLookup();
48973 test_ret += test_xmlXPathFunctionLookupNS();
48974 test_ret += test_xmlXPathHasSameNodes();
48975 test_ret += test_xmlXPathIdFunction();
48976 test_ret += test_xmlXPathIntersection();
48977 test_ret += test_xmlXPathIsNodeType();
48978 test_ret += test_xmlXPathLangFunction();
48979 test_ret += test_xmlXPathLastFunction();
48980 test_ret += test_xmlXPathLeading();
48981 test_ret += test_xmlXPathLeadingSorted();
48982 test_ret += test_xmlXPathLocalNameFunction();
48983 test_ret += test_xmlXPathModValues();
48984 test_ret += test_xmlXPathMultValues();
48985 test_ret += test_xmlXPathNamespaceURIFunction();
48986 test_ret += test_xmlXPathNewBoolean();
48987 test_ret += test_xmlXPathNewCString();
48988 test_ret += test_xmlXPathNewFloat();
48989 test_ret += test_xmlXPathNewNodeSet();
48990 test_ret += test_xmlXPathNewNodeSetList();
48991 test_ret += test_xmlXPathNewParserContext();
48992 test_ret += test_xmlXPathNewString();
48993 test_ret += test_xmlXPathNextAncestor();
48994 test_ret += test_xmlXPathNextAncestorOrSelf();
48995 test_ret += test_xmlXPathNextAttribute();
48996 test_ret += test_xmlXPathNextChild();
48997 test_ret += test_xmlXPathNextDescendant();
48998 test_ret += test_xmlXPathNextDescendantOrSelf();
48999 test_ret += test_xmlXPathNextFollowing();
49000 test_ret += test_xmlXPathNextFollowingSibling();
49001 test_ret += test_xmlXPathNextNamespace();
49002 test_ret += test_xmlXPathNextParent();
49003 test_ret += test_xmlXPathNextPreceding();
49004 test_ret += test_xmlXPathNextPrecedingSibling();
49005 test_ret += test_xmlXPathNextSelf();
49006 test_ret += test_xmlXPathNodeLeading();
49007 test_ret += test_xmlXPathNodeLeadingSorted();
49008 test_ret += test_xmlXPathNodeSetAdd();
49009 test_ret += test_xmlXPathNodeSetAddNs();
49010 test_ret += test_xmlXPathNodeSetAddUnique();
49011 test_ret += test_xmlXPathNodeSetContains();
49012 test_ret += test_xmlXPathNodeSetDel();
49013 test_ret += test_xmlXPathNodeSetMerge();
49014 test_ret += test_xmlXPathNodeSetRemove();
49015 test_ret += test_xmlXPathNodeSetSort();
49016 test_ret += test_xmlXPathNodeTrailing();
49017 test_ret += test_xmlXPathNodeTrailingSorted();
49018 test_ret += test_xmlXPathNormalizeFunction();
49019 test_ret += test_xmlXPathNotEqualValues();
49020 test_ret += test_xmlXPathNotFunction();
49021 test_ret += test_xmlXPathNsLookup();
49022 test_ret += test_xmlXPathNumberFunction();
49023 test_ret += test_xmlXPathParseNCName();
49024 test_ret += test_xmlXPathParseName();
49025 test_ret += test_xmlXPathPopBoolean();
49026 test_ret += test_xmlXPathPopExternal();
49027 test_ret += test_xmlXPathPopNodeSet();
49028 test_ret += test_xmlXPathPopNumber();
49029 test_ret += test_xmlXPathPopString();
49030 test_ret += test_xmlXPathPositionFunction();
49031 test_ret += test_xmlXPathRegisterAllFunctions();
49032 test_ret += test_xmlXPathRegisterFunc();
49033 test_ret += test_xmlXPathRegisterFuncLookup();
49034 test_ret += test_xmlXPathRegisterFuncNS();
49035 test_ret += test_xmlXPathRegisterNs();
49036 test_ret += test_xmlXPathRegisterVariable();
49037 test_ret += test_xmlXPathRegisterVariableLookup();
49038 test_ret += test_xmlXPathRegisterVariableNS();
49039 test_ret += test_xmlXPathRegisteredFuncsCleanup();
49040 test_ret += test_xmlXPathRegisteredNsCleanup();
49041 test_ret += test_xmlXPathRegisteredVariablesCleanup();
49042 test_ret += test_xmlXPathRoot();
49043 test_ret += test_xmlXPathRoundFunction();
49044 test_ret += test_xmlXPathStartsWithFunction();
49045 test_ret += test_xmlXPathStringEvalNumber();
49046 test_ret += test_xmlXPathStringFunction();
49047 test_ret += test_xmlXPathStringLengthFunction();
49048 test_ret += test_xmlXPathSubValues();
49049 test_ret += test_xmlXPathSubstringAfterFunction();
49050 test_ret += test_xmlXPathSubstringBeforeFunction();
49051 test_ret += test_xmlXPathSubstringFunction();
49052 test_ret += test_xmlXPathSumFunction();
49053 test_ret += test_xmlXPathTrailing();
49054 test_ret += test_xmlXPathTrailingSorted();
49055 test_ret += test_xmlXPathTranslateFunction();
49056 test_ret += test_xmlXPathTrueFunction();
49057 test_ret += test_xmlXPathValueFlipSign();
49058 test_ret += test_xmlXPathVariableLookup();
49059 test_ret += test_xmlXPathVariableLookupNS();
49060 test_ret += test_xmlXPathWrapCString();
49061 test_ret += test_xmlXPathWrapExternal();
49062 test_ret += test_xmlXPathWrapNodeSet();
49063 test_ret += test_xmlXPatherror();
49064
49065 if (test_ret != 0)
49066 printf("Module xpathInternals: %d errors\n", test_ret);
49067 return(test_ret);
49068}
49069
Daniel Veillardd93f6252004-11-02 15:53:51 +000049070static int
49071test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049073
William M. Brack21e4ef22005-01-02 09:53:13 +000049074#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049075 int mem_base;
49076 xmlNodePtr ret_val;
49077 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
49078 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049079
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049080 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
49081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000049082 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049083
49084 ret_val = xmlXPtrBuildNodeList(obj);
49085 desret_xmlNodePtr(ret_val);
49086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049087 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049088 xmlResetLastError();
49089 if (mem_base != xmlMemBlocks()) {
49090 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
49091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049092 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049093 printf(" %d", n_obj);
49094 printf("\n");
49095 }
49096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049097 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000049098#endif
49099
Daniel Veillard42595322004-11-08 10:52:06 +000049100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049101}
49102
49103
49104static int
49105test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049107
William M. Brack21e4ef22005-01-02 09:53:13 +000049108#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049109 int mem_base;
49110 xmlXPathObjectPtr ret_val;
49111 xmlChar * str; /* the XPointer expression */
49112 int n_str;
49113 xmlXPathContextPtr ctx; /* the XPointer context */
49114 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049115
Daniel Veillardce682bc2004-11-05 17:22:25 +000049116 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
49117 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
49118 mem_base = xmlMemBlocks();
49119 str = gen_const_xmlChar_ptr(n_str, 0);
49120 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
49121
William M. Brackf13f77f2004-11-12 16:03:48 +000049122 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000049123 desret_xmlXPathObjectPtr(ret_val);
49124 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000049125 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000049126 des_xmlXPathContextPtr(n_ctx, ctx, 1);
49127 xmlResetLastError();
49128 if (mem_base != xmlMemBlocks()) {
49129 printf("Leak of %d blocks found in xmlXPtrEval",
49130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049131 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049132 printf(" %d", n_str);
49133 printf(" %d", n_ctx);
49134 printf("\n");
49135 }
49136 }
49137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049138 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049139#endif
49140
Daniel Veillard42595322004-11-08 10:52:06 +000049141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049142}
49143
49144
49145static int
49146test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049148
William M. Brack21e4ef22005-01-02 09:53:13 +000049149#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049150 int mem_base;
49151 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49152 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049153
Daniel Veillardce682bc2004-11-05 17:22:25 +000049154 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49155 mem_base = xmlMemBlocks();
49156 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49157
49158 xmlXPtrEvalRangePredicate(ctxt);
49159 call_tests++;
49160 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49161 xmlResetLastError();
49162 if (mem_base != xmlMemBlocks()) {
49163 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
49164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049165 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049166 printf(" %d", n_ctxt);
49167 printf("\n");
49168 }
49169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049170 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049171#endif
49172
Daniel Veillard42595322004-11-08 10:52:06 +000049173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049174}
49175
Daniel Veillarda521d282004-11-09 14:59:59 +000049176#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000049177
Daniel Veillardce682bc2004-11-05 17:22:25 +000049178#define gen_nb_xmlLocationSetPtr 1
49179static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
49180 return(NULL);
49181}
49182static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
49183}
Daniel Veillarda521d282004-11-09 14:59:59 +000049184#endif
49185
Daniel Veillardce682bc2004-11-05 17:22:25 +000049186
Daniel Veillardd93f6252004-11-02 15:53:51 +000049187static int
49188test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049190
William M. Brack21e4ef22005-01-02 09:53:13 +000049191#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049192 int mem_base;
49193 xmlLocationSetPtr cur; /* the initial range set */
49194 int n_cur;
49195 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
49196 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049197
Daniel Veillardce682bc2004-11-05 17:22:25 +000049198 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49199 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
49200 mem_base = xmlMemBlocks();
49201 cur = gen_xmlLocationSetPtr(n_cur, 0);
49202 val = gen_xmlXPathObjectPtr(n_val, 1);
49203
49204 xmlXPtrLocationSetAdd(cur, val);
49205 call_tests++;
49206 des_xmlLocationSetPtr(n_cur, cur, 0);
49207 des_xmlXPathObjectPtr(n_val, val, 1);
49208 xmlResetLastError();
49209 if (mem_base != xmlMemBlocks()) {
49210 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
49211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049212 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049213 printf(" %d", n_cur);
49214 printf(" %d", n_val);
49215 printf("\n");
49216 }
49217 }
49218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049219 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049220#endif
49221
Daniel Veillard42595322004-11-08 10:52:06 +000049222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049223}
49224
49225
49226static int
49227test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049229
49230
49231 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049233}
49234
49235
49236static int
49237test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049239
William M. Brack21e4ef22005-01-02 09:53:13 +000049240#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049241 int mem_base;
49242 xmlLocationSetPtr cur; /* the initial range set */
49243 int n_cur;
49244 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
49245 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049246
Daniel Veillardce682bc2004-11-05 17:22:25 +000049247 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49248 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
49249 mem_base = xmlMemBlocks();
49250 cur = gen_xmlLocationSetPtr(n_cur, 0);
49251 val = gen_xmlXPathObjectPtr(n_val, 1);
49252
49253 xmlXPtrLocationSetDel(cur, val);
49254 call_tests++;
49255 des_xmlLocationSetPtr(n_cur, cur, 0);
49256 des_xmlXPathObjectPtr(n_val, val, 1);
49257 xmlResetLastError();
49258 if (mem_base != xmlMemBlocks()) {
49259 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
49260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049261 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049262 printf(" %d", n_cur);
49263 printf(" %d", n_val);
49264 printf("\n");
49265 }
49266 }
49267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049268 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049269#endif
49270
Daniel Veillard42595322004-11-08 10:52:06 +000049271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049272}
49273
49274
49275static int
49276test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049278
49279
49280 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049282}
49283
49284
49285static int
49286test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049288
William M. Brack21e4ef22005-01-02 09:53:13 +000049289#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049290 int mem_base;
49291 xmlLocationSetPtr cur; /* the initial range set */
49292 int n_cur;
49293 int val; /* the index to remove */
49294 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049295
Daniel Veillardce682bc2004-11-05 17:22:25 +000049296 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
49297 for (n_val = 0;n_val < gen_nb_int;n_val++) {
49298 mem_base = xmlMemBlocks();
49299 cur = gen_xmlLocationSetPtr(n_cur, 0);
49300 val = gen_int(n_val, 1);
49301
49302 xmlXPtrLocationSetRemove(cur, val);
49303 call_tests++;
49304 des_xmlLocationSetPtr(n_cur, cur, 0);
49305 des_int(n_val, val, 1);
49306 xmlResetLastError();
49307 if (mem_base != xmlMemBlocks()) {
49308 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
49309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049310 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049311 printf(" %d", n_cur);
49312 printf(" %d", n_val);
49313 printf("\n");
49314 }
49315 }
49316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049317 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049318#endif
49319
Daniel Veillard42595322004-11-08 10:52:06 +000049320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049321}
49322
49323
49324static int
49325test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049327
William M. Brack21e4ef22005-01-02 09:53:13 +000049328#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049329 int mem_base;
49330 xmlXPathObjectPtr ret_val;
49331 xmlNodePtr start; /* the starting and ending node */
49332 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049333
Daniel Veillard3d97e662004-11-04 10:49:00 +000049334 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49335 mem_base = xmlMemBlocks();
49336 start = gen_xmlNodePtr(n_start, 0);
49337
49338 ret_val = xmlXPtrNewCollapsedRange(start);
49339 desret_xmlXPathObjectPtr(ret_val);
49340 call_tests++;
49341 des_xmlNodePtr(n_start, start, 0);
49342 xmlResetLastError();
49343 if (mem_base != xmlMemBlocks()) {
49344 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
49345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049346 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049347 printf(" %d", n_start);
49348 printf("\n");
49349 }
49350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049351 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049352#endif
49353
Daniel Veillard42595322004-11-08 10:52:06 +000049354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049355}
49356
49357
49358static int
49359test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049361
49362
49363 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000049364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049365}
49366
49367
49368static int
49369test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049371
William M. Brack21e4ef22005-01-02 09:53:13 +000049372#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049373 int mem_base;
49374 xmlXPathObjectPtr ret_val;
49375 xmlNodeSetPtr set; /* a node set */
49376 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049377
Daniel Veillardce682bc2004-11-05 17:22:25 +000049378 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
49379 mem_base = xmlMemBlocks();
49380 set = gen_xmlNodeSetPtr(n_set, 0);
49381
49382 ret_val = xmlXPtrNewLocationSetNodeSet(set);
49383 desret_xmlXPathObjectPtr(ret_val);
49384 call_tests++;
49385 des_xmlNodeSetPtr(n_set, set, 0);
49386 xmlResetLastError();
49387 if (mem_base != xmlMemBlocks()) {
49388 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
49389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049390 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049391 printf(" %d", n_set);
49392 printf("\n");
49393 }
49394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049395 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049396#endif
49397
Daniel Veillard42595322004-11-08 10:52:06 +000049398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049399}
49400
49401
49402static int
49403test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049405
William M. Brack21e4ef22005-01-02 09:53:13 +000049406#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049407 int mem_base;
49408 xmlXPathObjectPtr ret_val;
49409 xmlNodePtr start; /* the start NodePtr value */
49410 int n_start;
49411 xmlNodePtr end; /* the end NodePtr value or NULL */
49412 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049413
Daniel Veillard3d97e662004-11-04 10:49:00 +000049414 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49415 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49416 mem_base = xmlMemBlocks();
49417 start = gen_xmlNodePtr(n_start, 0);
49418 end = gen_xmlNodePtr(n_end, 1);
49419
49420 ret_val = xmlXPtrNewLocationSetNodes(start, end);
49421 desret_xmlXPathObjectPtr(ret_val);
49422 call_tests++;
49423 des_xmlNodePtr(n_start, start, 0);
49424 des_xmlNodePtr(n_end, end, 1);
49425 xmlResetLastError();
49426 if (mem_base != xmlMemBlocks()) {
49427 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
49428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049429 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049430 printf(" %d", n_start);
49431 printf(" %d", n_end);
49432 printf("\n");
49433 }
49434 }
49435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049436 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049437#endif
49438
Daniel Veillard42595322004-11-08 10:52:06 +000049439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049440}
49441
49442
49443static int
49444test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049446
William M. Brack21e4ef22005-01-02 09:53:13 +000049447#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049448 int mem_base;
49449 xmlXPathObjectPtr ret_val;
49450 xmlNodePtr start; /* the starting node */
49451 int n_start;
49452 int startindex; /* the start index */
49453 int n_startindex;
49454 xmlNodePtr end; /* the ending point */
49455 int n_end;
49456 int endindex; /* the ending index */
49457 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049458
Daniel Veillard3d97e662004-11-04 10:49:00 +000049459 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49460 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
49461 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49462 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
49463 mem_base = xmlMemBlocks();
49464 start = gen_xmlNodePtr(n_start, 0);
49465 startindex = gen_int(n_startindex, 1);
49466 end = gen_xmlNodePtr(n_end, 2);
49467 endindex = gen_int(n_endindex, 3);
49468
49469 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
49470 desret_xmlXPathObjectPtr(ret_val);
49471 call_tests++;
49472 des_xmlNodePtr(n_start, start, 0);
49473 des_int(n_startindex, startindex, 1);
49474 des_xmlNodePtr(n_end, end, 2);
49475 des_int(n_endindex, endindex, 3);
49476 xmlResetLastError();
49477 if (mem_base != xmlMemBlocks()) {
49478 printf("Leak of %d blocks found in xmlXPtrNewRange",
49479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049480 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049481 printf(" %d", n_start);
49482 printf(" %d", n_startindex);
49483 printf(" %d", n_end);
49484 printf(" %d", n_endindex);
49485 printf("\n");
49486 }
49487 }
49488 }
49489 }
49490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049491 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049492#endif
49493
Daniel Veillard42595322004-11-08 10:52:06 +000049494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049495}
49496
49497
49498static int
49499test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049501
William M. Brack21e4ef22005-01-02 09:53:13 +000049502#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049503 int mem_base;
49504 xmlXPathObjectPtr ret_val;
49505 xmlNodePtr start; /* the starting node */
49506 int n_start;
49507 xmlXPathObjectPtr end; /* the ending object */
49508 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049509
Daniel Veillard3d97e662004-11-04 10:49:00 +000049510 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49511 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49512 mem_base = xmlMemBlocks();
49513 start = gen_xmlNodePtr(n_start, 0);
49514 end = gen_xmlXPathObjectPtr(n_end, 1);
49515
49516 ret_val = xmlXPtrNewRangeNodeObject(start, end);
49517 desret_xmlXPathObjectPtr(ret_val);
49518 call_tests++;
49519 des_xmlNodePtr(n_start, start, 0);
49520 des_xmlXPathObjectPtr(n_end, end, 1);
49521 xmlResetLastError();
49522 if (mem_base != xmlMemBlocks()) {
49523 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
49524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049525 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049526 printf(" %d", n_start);
49527 printf(" %d", n_end);
49528 printf("\n");
49529 }
49530 }
49531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049532 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049533#endif
49534
Daniel Veillard42595322004-11-08 10:52:06 +000049535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049536}
49537
49538
49539static int
49540test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049542
William M. Brack21e4ef22005-01-02 09:53:13 +000049543#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049544 int mem_base;
49545 xmlXPathObjectPtr ret_val;
49546 xmlNodePtr start; /* the starting node */
49547 int n_start;
49548 xmlXPathObjectPtr end; /* the ending point */
49549 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049550
Daniel Veillard3d97e662004-11-04 10:49:00 +000049551 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49552 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49553 mem_base = xmlMemBlocks();
49554 start = gen_xmlNodePtr(n_start, 0);
49555 end = gen_xmlXPathObjectPtr(n_end, 1);
49556
49557 ret_val = xmlXPtrNewRangeNodePoint(start, end);
49558 desret_xmlXPathObjectPtr(ret_val);
49559 call_tests++;
49560 des_xmlNodePtr(n_start, start, 0);
49561 des_xmlXPathObjectPtr(n_end, end, 1);
49562 xmlResetLastError();
49563 if (mem_base != xmlMemBlocks()) {
49564 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
49565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049566 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049567 printf(" %d", n_start);
49568 printf(" %d", n_end);
49569 printf("\n");
49570 }
49571 }
49572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049573 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049574#endif
49575
Daniel Veillard42595322004-11-08 10:52:06 +000049576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049577}
49578
49579
49580static int
49581test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049583
William M. Brack21e4ef22005-01-02 09:53:13 +000049584#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049585 int mem_base;
49586 xmlXPathObjectPtr ret_val;
49587 xmlNodePtr start; /* the starting node */
49588 int n_start;
49589 xmlNodePtr end; /* the ending node */
49590 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049591
Daniel Veillard3d97e662004-11-04 10:49:00 +000049592 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
49593 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49594 mem_base = xmlMemBlocks();
49595 start = gen_xmlNodePtr(n_start, 0);
49596 end = gen_xmlNodePtr(n_end, 1);
49597
49598 ret_val = xmlXPtrNewRangeNodes(start, end);
49599 desret_xmlXPathObjectPtr(ret_val);
49600 call_tests++;
49601 des_xmlNodePtr(n_start, start, 0);
49602 des_xmlNodePtr(n_end, end, 1);
49603 xmlResetLastError();
49604 if (mem_base != xmlMemBlocks()) {
49605 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
49606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049607 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049608 printf(" %d", n_start);
49609 printf(" %d", n_end);
49610 printf("\n");
49611 }
49612 }
49613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049614 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049615#endif
49616
Daniel Veillard42595322004-11-08 10:52:06 +000049617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049618}
49619
49620
49621static int
49622test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049624
William M. Brack21e4ef22005-01-02 09:53:13 +000049625#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049626 int mem_base;
49627 xmlXPathObjectPtr ret_val;
49628 xmlXPathObjectPtr start; /* the starting point */
49629 int n_start;
49630 xmlNodePtr end; /* the ending node */
49631 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049632
Daniel Veillard3d97e662004-11-04 10:49:00 +000049633 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49634 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49635 mem_base = xmlMemBlocks();
49636 start = gen_xmlXPathObjectPtr(n_start, 0);
49637 end = gen_xmlNodePtr(n_end, 1);
49638
49639 ret_val = xmlXPtrNewRangePointNode(start, end);
49640 desret_xmlXPathObjectPtr(ret_val);
49641 call_tests++;
49642 des_xmlXPathObjectPtr(n_start, start, 0);
49643 des_xmlNodePtr(n_end, end, 1);
49644 xmlResetLastError();
49645 if (mem_base != xmlMemBlocks()) {
49646 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
49647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049648 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049649 printf(" %d", n_start);
49650 printf(" %d", n_end);
49651 printf("\n");
49652 }
49653 }
49654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049655 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049656#endif
49657
Daniel Veillard42595322004-11-08 10:52:06 +000049658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049659}
49660
49661
49662static int
49663test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049665
William M. Brack21e4ef22005-01-02 09:53:13 +000049666#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049667 int mem_base;
49668 xmlXPathObjectPtr ret_val;
49669 xmlXPathObjectPtr start; /* the starting point */
49670 int n_start;
49671 xmlXPathObjectPtr end; /* the ending point */
49672 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049673
Daniel Veillard3d97e662004-11-04 10:49:00 +000049674 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49675 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49676 mem_base = xmlMemBlocks();
49677 start = gen_xmlXPathObjectPtr(n_start, 0);
49678 end = gen_xmlXPathObjectPtr(n_end, 1);
49679
49680 ret_val = xmlXPtrNewRangePoints(start, end);
49681 desret_xmlXPathObjectPtr(ret_val);
49682 call_tests++;
49683 des_xmlXPathObjectPtr(n_start, start, 0);
49684 des_xmlXPathObjectPtr(n_end, end, 1);
49685 xmlResetLastError();
49686 if (mem_base != xmlMemBlocks()) {
49687 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
49688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049689 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049690 printf(" %d", n_start);
49691 printf(" %d", n_end);
49692 printf("\n");
49693 }
49694 }
49695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049696 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049697#endif
49698
Daniel Veillard42595322004-11-08 10:52:06 +000049699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049700}
49701
49702
49703static int
49704test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049706
William M. Brack21e4ef22005-01-02 09:53:13 +000049707#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049708 int mem_base;
49709 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49710 int n_ctxt;
49711 int nargs; /* the number of args */
49712 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049713
Daniel Veillardce682bc2004-11-05 17:22:25 +000049714 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49715 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
49716 mem_base = xmlMemBlocks();
49717 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49718 nargs = gen_int(n_nargs, 1);
49719
49720 xmlXPtrRangeToFunction(ctxt, nargs);
49721 call_tests++;
49722 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49723 des_int(n_nargs, nargs, 1);
49724 xmlResetLastError();
49725 if (mem_base != xmlMemBlocks()) {
49726 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
49727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049728 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049729 printf(" %d", n_ctxt);
49730 printf(" %d", n_nargs);
49731 printf("\n");
49732 }
49733 }
49734 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049735 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049736#endif
49737
Daniel Veillard42595322004-11-08 10:52:06 +000049738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049739}
49740
49741
49742static int
49743test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049745
William M. Brack21e4ef22005-01-02 09:53:13 +000049746#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049747 int mem_base;
49748 xmlXPathObjectPtr ret_val;
49749 xmlLocationSetPtr val; /* the LocationSet value */
49750 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049751
Daniel Veillardce682bc2004-11-05 17:22:25 +000049752 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
49753 mem_base = xmlMemBlocks();
49754 val = gen_xmlLocationSetPtr(n_val, 0);
49755
49756 ret_val = xmlXPtrWrapLocationSet(val);
49757 desret_xmlXPathObjectPtr(ret_val);
49758 call_tests++;
49759 des_xmlLocationSetPtr(n_val, val, 0);
49760 xmlResetLastError();
49761 if (mem_base != xmlMemBlocks()) {
49762 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
49763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049764 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049765 printf(" %d", n_val);
49766 printf("\n");
49767 }
49768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049769 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049770#endif
49771
Daniel Veillard42595322004-11-08 10:52:06 +000049772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049773}
49774
49775static int
49776test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049778
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049779 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000049780 test_ret += test_xmlXPtrBuildNodeList();
49781 test_ret += test_xmlXPtrEval();
49782 test_ret += test_xmlXPtrEvalRangePredicate();
49783 test_ret += test_xmlXPtrLocationSetAdd();
49784 test_ret += test_xmlXPtrLocationSetCreate();
49785 test_ret += test_xmlXPtrLocationSetDel();
49786 test_ret += test_xmlXPtrLocationSetMerge();
49787 test_ret += test_xmlXPtrLocationSetRemove();
49788 test_ret += test_xmlXPtrNewCollapsedRange();
49789 test_ret += test_xmlXPtrNewContext();
49790 test_ret += test_xmlXPtrNewLocationSetNodeSet();
49791 test_ret += test_xmlXPtrNewLocationSetNodes();
49792 test_ret += test_xmlXPtrNewRange();
49793 test_ret += test_xmlXPtrNewRangeNodeObject();
49794 test_ret += test_xmlXPtrNewRangeNodePoint();
49795 test_ret += test_xmlXPtrNewRangeNodes();
49796 test_ret += test_xmlXPtrNewRangePointNode();
49797 test_ret += test_xmlXPtrNewRangePoints();
49798 test_ret += test_xmlXPtrRangeToFunction();
49799 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000049800
Daniel Veillard42595322004-11-08 10:52:06 +000049801 if (test_ret != 0)
49802 printf("Module xpointer: %d errors\n", test_ret);
49803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049804}
Daniel Veillardce244ad2004-11-05 10:03:46 +000049805static int
49806test_module(const char *module) {
49807 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49808 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049809 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049810 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049811 if (!strcmp(module, "catalog")) return(test_catalog());
49812 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049813 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049814 if (!strcmp(module, "dict")) return(test_dict());
49815 if (!strcmp(module, "encoding")) return(test_encoding());
49816 if (!strcmp(module, "entities")) return(test_entities());
49817 if (!strcmp(module, "hash")) return(test_hash());
49818 if (!strcmp(module, "list")) return(test_list());
49819 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49820 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49821 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049822 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049823 if (!strcmp(module, "pattern")) return(test_pattern());
49824 if (!strcmp(module, "relaxng")) return(test_relaxng());
49825 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49826 if (!strcmp(module, "tree")) return(test_tree());
49827 if (!strcmp(module, "uri")) return(test_uri());
49828 if (!strcmp(module, "valid")) return(test_valid());
49829 if (!strcmp(module, "xinclude")) return(test_xinclude());
49830 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049831 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049832 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049833 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049834 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049835 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049836 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49837 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49838 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49839 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049840 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049841 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49842 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049843 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049844 if (!strcmp(module, "xpointer")) return(test_xpointer());
49845 return(0);
49846}