blob: c10d50ec73faf3fadbb3614f685c7073ac36a04f [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 Veillardce244ad2004-11-05 10:03:46 +0000521 if (no == 1) free_api_doc();
522 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000523 xmlUnlinkNode(val);
524 xmlFreeNode(val);
525 }
526}
527
Daniel Veillard27f20102004-11-05 11:50:11 +0000528#define gen_nb_xmlDtdPtr 3
529static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 if (no == 0)
531 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 if (no == 1) return(get_api_dtd());
533 return(NULL);
534}
535static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
536 if (no == 1) free_api_doc();
537 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000538 xmlUnlinkNode((xmlNodePtr) val);
539 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000540 }
541}
542
543#define gen_nb_xmlNsPtr 2
544static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
545 if (no == 0) return(get_api_ns());
546 return(NULL);
547}
548static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
549 if (no == 0) free_api_doc();
550}
551
Daniel Veillardd93f6252004-11-02 15:53:51 +0000552#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000553static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000554 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
555 if (no == 0) return(xmlNewText(BAD_CAST "text"));
556 return(NULL);
557}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000558static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000559}
560
Daniel Veillardc8311492004-11-08 16:51:13 +0000561#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000562#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000563static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000564 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
565 return(NULL);
566}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000567static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000568 if (val != NULL) xmlFreeTextWriter(val);
569}
Daniel Veillardc8311492004-11-08 16:51:13 +0000570#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000571
Daniel Veillardc8311492004-11-08 16:51:13 +0000572#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000574static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000575 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
576 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
577 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
578 return(NULL);
579}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000580static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000581 if (val != NULL) xmlFreeTextReader(val);
582}
Daniel Veillardc8311492004-11-08 16:51:13 +0000583#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000584
Daniel Veillard34099b42004-11-04 17:34:35 +0000585#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000586static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000587 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000588 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000589 return(NULL);
590}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000591static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000592 if (val != NULL) {
593 xmlBufferFree(val);
594 }
595}
596
597#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000598static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000599 if (no == 0) return(xmlListCreate(NULL, NULL));
600 return(NULL);
601}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000602static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000603 if (val != NULL) {
604 xmlListDelete(val);
605 }
606}
607
608#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000609static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000610 if (no == 0) return(xmlHashCreate(10));
611 return(NULL);
612}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000613static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614 if (val != NULL) {
615 xmlHashFree(val, NULL);
616 }
617}
618
619#include <libxml/xpathInternals.h>
620
Daniel Veillardc8311492004-11-08 16:51:13 +0000621#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000622#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000623static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000624 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
625 if (no == 1) return(xmlXPathNewFloat(1.1));
626 if (no == 2) return(xmlXPathNewBoolean(1));
627 if (no == 3) return(xmlXPathNewNodeSet(NULL));
628 return(NULL);
629}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000631 if (val != NULL) {
632 xmlXPathFreeObject(val);
633 }
634}
Daniel Veillardc8311492004-11-08 16:51:13 +0000635#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000636
Daniel Veillardc8311492004-11-08 16:51:13 +0000637#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000638#define gen_nb_xmlOutputBufferPtr 2
639static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
640 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
641 return(NULL);
642}
643static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
644 if (val != NULL) {
645 xmlOutputBufferClose(val);
646 }
647}
Daniel Veillardc8311492004-11-08 16:51:13 +0000648#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000649
Daniel Veillardc8311492004-11-08 16:51:13 +0000650#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000651#define gen_nb_xmlNanoFTPCtxtPtr 4
652static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
William M. Brack015ccb22005-02-13 08:18:52 +0000653 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
654 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
Daniel Veillard27f20102004-11-05 11:50:11 +0000655 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
656 return(NULL);
657}
658static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
659 if (val != NULL) {
660 xmlNanoFTPFreeCtxt(val);
661 }
662}
Daniel Veillardc8311492004-11-08 16:51:13 +0000663#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000664
Daniel Veillardc8311492004-11-08 16:51:13 +0000665#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000666#define gen_nb_xmlNanoHTTPCtxtPtr 1
William M. Brack015ccb22005-02-13 08:18:52 +0000667static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
669 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
670 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
Daniel Veillard27f20102004-11-05 11:50:11 +0000671 return(NULL);
672}
William M. Brack015ccb22005-02-13 08:18:52 +0000673static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
674 if (val != NULL) {
675 xmlNanoHTTPClose(val);
676 }
Daniel Veillard27f20102004-11-05 11:50:11 +0000677}
Daniel Veillardc8311492004-11-08 16:51:13 +0000678#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000679
Daniel Veillard3d97e662004-11-04 10:49:00 +0000680#define gen_nb_xmlCharEncoding 4
681static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
683 if (no == 1) return(XML_CHAR_ENCODING_NONE);
William M. Brack015ccb22005-02-13 08:18:52 +0000684 if (no == 2) return(XML_CHAR_ENCODING_8859_1);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000685 return(XML_CHAR_ENCODING_ERROR);
686}
687static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
688}
689
Daniel Veillard42595322004-11-08 10:52:06 +0000690#define gen_nb_xmlHashDeallocator 2
691static void
692test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
693}
694
695static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
696 if (no == 0) return(test_xmlHashDeallocator);
697 return(NULL);
698}
699static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
700}
701
Daniel Veillardd93f6252004-11-02 15:53:51 +0000702
703static void desret_int(int val ATTRIBUTE_UNUSED) {
704}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000705static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
706}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000707static void desret_long(long val ATTRIBUTE_UNUSED) {
708}
William M. Brack094dd862004-11-14 14:28:34 +0000709static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000711static void desret_double(double val ATTRIBUTE_UNUSED) {
712}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000713static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
714}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000715#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000716static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
717}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000718#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000719static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
720}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000721static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
722}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000723static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
724}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000725static void desret_xmlChar_ptr(xmlChar *val) {
726 if (val != NULL)
727 xmlFree(val);
728}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000729static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000730 if (val != api_doc)
731 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000733static void desret_xmlDictPtr(xmlDictPtr val) {
734 xmlDictFree(val);
735}
Daniel Veillardc8311492004-11-08 16:51:13 +0000736#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000737static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
738 xmlOutputBufferClose(val);
739}
Daniel Veillardc8311492004-11-08 16:51:13 +0000740#endif
741#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000742static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
743 xmlFreeTextReader(val);
744}
Daniel Veillardc8311492004-11-08 16:51:13 +0000745#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000746static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000747 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
748 xmlUnlinkNode(val);
749 xmlFreeNode(val);
750 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000751}
Daniel Veillard57b25162004-11-06 14:50:18 +0000752static void desret_xmlAttrPtr(xmlAttrPtr val) {
753 if (val != NULL) {
754 xmlUnlinkNode((xmlNodePtr) val);
755 xmlFreeNode((xmlNodePtr) val);
756 }
757}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000758static void desret_xmlEntityPtr(xmlEntityPtr val) {
759 if (val != NULL) {
760 xmlUnlinkNode((xmlNodePtr) val);
761 xmlFreeNode((xmlNodePtr) val);
762 }
763}
Daniel Veillard42595322004-11-08 10:52:06 +0000764static void desret_xmlElementPtr(xmlElementPtr val) {
765 if (val != NULL) {
766 xmlUnlinkNode((xmlNodePtr) val);
767 }
768}
769static void desret_xmlAttributePtr(xmlAttributePtr val) {
770 if (val != NULL) {
771 xmlUnlinkNode((xmlNodePtr) val);
772 }
773}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000774static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
775}
Daniel Veillard34099b42004-11-04 17:34:35 +0000776static void desret_xmlDtdPtr(xmlDtdPtr val) {
777 desret_xmlNodePtr((xmlNodePtr)val);
778}
Daniel Veillardc8311492004-11-08 16:51:13 +0000779#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000780static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000781 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000782}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000783static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
784 xmlXPathFreeNodeSet(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000787static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
788 xmlFreeParserCtxt(val);
789}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000790static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
791 xmlFreeParserInputBuffer(val);
792}
Daniel Veillard42595322004-11-08 10:52:06 +0000793static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
794 xmlFreeInputStream(val);
795}
Daniel Veillardc8311492004-11-08 16:51:13 +0000796#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000797static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
798 xmlFreeTextWriter(val);
799}
Daniel Veillardc8311492004-11-08 16:51:13 +0000800#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000801static void desret_xmlBufferPtr(xmlBufferPtr val) {
802 xmlBufferFree(val);
803}
Daniel Veillardc8311492004-11-08 16:51:13 +0000804#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000805static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
806 xmlSchemaFreeParserCtxt(val);
807}
808static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
809}
810static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
811 xmlRelaxNGFreeParserCtxt(val);
812}
Daniel Veillardc8311492004-11-08 16:51:13 +0000813#endif
814#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000815static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000816}
William M. Brack015ccb22005-02-13 08:18:52 +0000817static void desret_xmlNanoHTTPCtxtPtr(void *val) {
818 xmlNanoHTTPClose(val);
819}
Daniel Veillardc8311492004-11-08 16:51:13 +0000820#endif
William M. Brack015ccb22005-02-13 08:18:52 +0000821#ifdef LIBXML_FTP_ENABLED
822static void desret_xmlNanoFTPCtxtPtr(void *val) {
823 xmlNanoFTPClose(val);
824}
825#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000826/* cut and pasted from autogenerated to avoid troubles */
827#define gen_nb_const_xmlChar_ptr_ptr 1
828static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
829 return(NULL);
830}
831static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832}
833
834#define gen_nb_unsigned_char_ptr 1
835static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
836 return(NULL);
837}
838static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839}
840
841#define gen_nb_const_unsigned_char_ptr 1
842static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
843 return(NULL);
844}
845static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
846}
847
848#ifdef LIBXML_HTML_ENABLED
849#define gen_nb_const_htmlNodePtr 1
850static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
851 return(NULL);
852}
853static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
854}
855#endif
856
857#ifdef LIBXML_HTML_ENABLED
858#define gen_nb_htmlDocPtr 3
859static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
860 if (no == 0) return(htmlNewDoc(NULL, NULL));
861 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
862 return(NULL);
863}
864static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
865 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
866 xmlFreeDoc(val);
867}
868static void desret_htmlDocPtr(htmlDocPtr val) {
869 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
870 xmlFreeDoc(val);
871}
872#define gen_nb_htmlParserCtxtPtr 3
873static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
874 if (no == 0) return(xmlNewParserCtxt());
875 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
876 return(NULL);
877}
878static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
879 if (val != NULL)
880 htmlFreeParserCtxt(val);
881}
882static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
883 if (val != NULL)
884 htmlFreeParserCtxt(val);
885}
886#endif
887
888#ifdef LIBXML_XPATH_ENABLED
889#define gen_nb_xmlNodeSetPtr 1
890static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
891 return(NULL);
892}
893static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
894}
895#endif
896
897#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000898#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000899#define gen_nb_xmlShellCtxtPtr 1
900static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
901 return(NULL);
902}
903static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
904}
905#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000906#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000907
908#ifdef LIBXML_PATTERN_ENABLED
909#define gen_nb_xmlPatternPtr 1
910static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915#endif
916
William M. Brack094dd862004-11-14 14:28:34 +0000917#define gen_nb_xmlElementContentPtr 1
918static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
919 return(NULL);
920}
921static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
922 if (val != NULL)
923 xmlFreeElementContent(val);
924}
925static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
926 if (val != NULL)
927 xmlFreeElementContent(val);
928}
929
930#define gen_nb_xmlParserNodeInfoSeqPtr 1
931static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
932 return(NULL);
933}
934static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
935}
936
937static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
938}
939
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000940/************************************************************************
941 * *
942 * WARNING: end of the manually maintained part of the test code *
943 * do not remove or alter the CUT HERE line *
944 * *
945 ************************************************************************/
946
Daniel Veillard34099b42004-11-04 17:34:35 +0000947/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000948#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000949static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
950}
951
Daniel Veillarda521d282004-11-09 14:59:59 +0000952#endif
953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954#define gen_nb_xmlAttributeDefault 4
955static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
956 if (no == 1) return(XML_ATTRIBUTE_FIXED);
957 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
958 if (no == 3) return(XML_ATTRIBUTE_NONE);
959 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
960 return(0);
961}
William M. Brack094dd862004-11-14 14:28:34 +0000962
Daniel Veillard57b25162004-11-06 14:50:18 +0000963static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
964}
Daniel Veillard57b25162004-11-06 14:50:18 +0000965
966#define gen_nb_xmlAttributeType 4
967static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
968 if (no == 1) return(XML_ATTRIBUTE_CDATA);
969 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
970 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
971 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
972 return(0);
973}
William M. Brack094dd862004-11-14 14:28:34 +0000974
Daniel Veillard57b25162004-11-06 14:50:18 +0000975static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976}
Daniel Veillard57b25162004-11-06 14:50:18 +0000977
978#define gen_nb_xmlBufferAllocationScheme 3
979static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
980 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
981 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
982 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
983 return(0);
984}
William M. Brack094dd862004-11-14 14:28:34 +0000985
Daniel Veillard57b25162004-11-06 14:50:18 +0000986static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
987}
William M. Brack094dd862004-11-14 14:28:34 +0000988
Daniel Veillard57b25162004-11-06 14:50:18 +0000989static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
990}
991
Daniel Veillarda521d282004-11-09 14:59:59 +0000992#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000993#define gen_nb_xmlCatalogAllow 4
994static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
995 if (no == 1) return(XML_CATA_ALLOW_ALL);
996 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
997 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
998 if (no == 4) return(XML_CATA_ALLOW_NONE);
999 return(0);
1000}
William M. Brack094dd862004-11-14 14:28:34 +00001001
Daniel Veillard57b25162004-11-06 14:50:18 +00001002static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1003}
William M. Brack094dd862004-11-14 14:28:34 +00001004
Daniel Veillard57b25162004-11-06 14:50:18 +00001005static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1006}
1007
Daniel Veillarda521d282004-11-09 14:59:59 +00001008#endif
1009
1010#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001011#define gen_nb_xmlCatalogPrefer 3
1012static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1013 if (no == 1) return(XML_CATA_PREFER_NONE);
1014 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1015 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1016 return(0);
1017}
William M. Brack094dd862004-11-14 14:28:34 +00001018
Daniel Veillard57b25162004-11-06 14:50:18 +00001019static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1020}
William M. Brack094dd862004-11-14 14:28:34 +00001021
Daniel Veillard57b25162004-11-06 14:50:18 +00001022static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1023}
1024
Daniel Veillarda521d282004-11-09 14:59:59 +00001025#endif
1026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027#define gen_nb_xmlElementContentType 4
1028static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1029 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1030 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1031 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1032 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1033 return(0);
1034}
Daniel Veillard57b25162004-11-06 14:50:18 +00001035
William M. Brack094dd862004-11-14 14:28:34 +00001036static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001037}
1038
1039#define gen_nb_xmlElementTypeVal 4
1040static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1041 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1042 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1043 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1044 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1045 return(0);
1046}
William M. Brack094dd862004-11-14 14:28:34 +00001047
Daniel Veillard57b25162004-11-06 14:50:18 +00001048static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1049}
Daniel Veillard57b25162004-11-06 14:50:18 +00001050
Daniel Veillard57b25162004-11-06 14:50:18 +00001051static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1052}
1053
Daniel Veillarda521d282004-11-09 14:59:59 +00001054#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001055#define gen_nb_xmlSchemaValType 4
1056static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1057 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1058 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1059 if (no == 3) return(XML_SCHEMAS_ANYURI);
1060 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1061 return(0);
1062}
William M. Brack094dd862004-11-14 14:28:34 +00001063
Daniel Veillard57b25162004-11-06 14:50:18 +00001064static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1065}
Daniel Veillard57b25162004-11-06 14:50:18 +00001066
Daniel Veillarda521d282004-11-09 14:59:59 +00001067#endif
1068
Daniel Veillard34099b42004-11-04 17:34:35 +00001069#include <libxml/HTMLparser.h>
1070#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001071#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/catalog.h>
1074#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001075#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001076#include <libxml/dict.h>
1077#include <libxml/encoding.h>
1078#include <libxml/entities.h>
1079#include <libxml/hash.h>
1080#include <libxml/list.h>
1081#include <libxml/nanoftp.h>
1082#include <libxml/nanohttp.h>
1083#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001084#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001085#include <libxml/pattern.h>
1086#include <libxml/relaxng.h>
1087#include <libxml/schemasInternals.h>
1088#include <libxml/tree.h>
1089#include <libxml/uri.h>
1090#include <libxml/valid.h>
1091#include <libxml/xinclude.h>
1092#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001093#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001094#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001095#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001096#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001097#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001098#include <libxml/xmlsave.h>
1099#include <libxml/xmlschemas.h>
1100#include <libxml/xmlschemastypes.h>
1101#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001102#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001103#include <libxml/xmlwriter.h>
1104#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001105#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001106#include <libxml/xpointer.h>
1107static int test_HTMLparser(void);
1108static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001109static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001110static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001111static int test_catalog(void);
1112static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001113static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001114static int test_dict(void);
1115static int test_encoding(void);
1116static int test_entities(void);
1117static int test_hash(void);
1118static int test_list(void);
1119static int test_nanoftp(void);
1120static int test_nanohttp(void);
1121static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001122static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001123static int test_pattern(void);
1124static int test_relaxng(void);
1125static int test_schemasInternals(void);
1126static int test_tree(void);
1127static int test_uri(void);
1128static int test_valid(void);
1129static int test_xinclude(void);
1130static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001131static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001132static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001133static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001134static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001135static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001136static int test_xmlsave(void);
1137static int test_xmlschemas(void);
1138static int test_xmlschemastypes(void);
1139static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001140static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001141static int test_xmlwriter(void);
1142static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001143static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001144static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001145
1146/**
1147 * testlibxml2:
1148 *
1149 * Main entry point of the tester for the full libxml2 module,
1150 * it calls all the tester entry point for each module.
1151 *
1152 * Returns the number of error found
1153 */
1154static int
1155testlibxml2(void)
1156{
Daniel Veillard42595322004-11-08 10:52:06 +00001157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001158
Daniel Veillard42595322004-11-08 10:52:06 +00001159 test_ret += test_HTMLparser();
1160 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001161 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001162 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001163 test_ret += test_catalog();
1164 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001165 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001166 test_ret += test_dict();
1167 test_ret += test_encoding();
1168 test_ret += test_entities();
1169 test_ret += test_hash();
1170 test_ret += test_list();
1171 test_ret += test_nanoftp();
1172 test_ret += test_nanohttp();
1173 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001174 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001175 test_ret += test_pattern();
1176 test_ret += test_relaxng();
1177 test_ret += test_schemasInternals();
1178 test_ret += test_tree();
1179 test_ret += test_uri();
1180 test_ret += test_valid();
1181 test_ret += test_xinclude();
1182 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001183 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001184 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001185 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001186 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001187 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001188 test_ret += test_xmlsave();
1189 test_ret += test_xmlschemas();
1190 test_ret += test_xmlschemastypes();
1191 test_ret += test_xmlstring();
1192 test_ret += test_xmlunicode();
1193 test_ret += test_xmlwriter();
1194 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001195 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001196 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001197
Daniel Veillard3d97e662004-11-04 10:49:00 +00001198 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001199 function_tests, call_tests, test_ret);
1200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001201}
1202
1203
1204static int
1205test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001207
William M. Brack21e4ef22005-01-02 09:53:13 +00001208#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001209 int mem_base;
1210 int ret_val;
1211 unsigned char * out; /* a pointer to an array of bytes to store the result */
1212 int n_out;
1213 int * outlen; /* the length of @out */
1214 int n_outlen;
1215 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1216 int n_in;
1217 int * inlen; /* the length of @in */
1218 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001219
Daniel Veillardce682bc2004-11-05 17:22:25 +00001220 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1221 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1222 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1223 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1224 mem_base = xmlMemBlocks();
1225 out = gen_unsigned_char_ptr(n_out, 0);
1226 outlen = gen_int_ptr(n_outlen, 1);
1227 in = gen_const_unsigned_char_ptr(n_in, 2);
1228 inlen = gen_int_ptr(n_inlen, 3);
1229
William M. Brackf13f77f2004-11-12 16:03:48 +00001230 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001231 desret_int(ret_val);
1232 call_tests++;
1233 des_unsigned_char_ptr(n_out, out, 0);
1234 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001235 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001236 des_int_ptr(n_inlen, inlen, 3);
1237 xmlResetLastError();
1238 if (mem_base != xmlMemBlocks()) {
1239 printf("Leak of %d blocks found in UTF8ToHtml",
1240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001241 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001242 printf(" %d", n_out);
1243 printf(" %d", n_outlen);
1244 printf(" %d", n_in);
1245 printf(" %d", n_inlen);
1246 printf("\n");
1247 }
1248 }
1249 }
1250 }
1251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001252 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001253#endif
1254
Daniel Veillard42595322004-11-08 10:52:06 +00001255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001256}
1257
Daniel Veillarda521d282004-11-09 14:59:59 +00001258#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001259
Daniel Veillardce682bc2004-11-05 17:22:25 +00001260#define gen_nb_const_htmlElemDesc_ptr 1
1261static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1262 return(NULL);
1263}
1264static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1265}
Daniel Veillarda521d282004-11-09 14:59:59 +00001266#endif
1267
Daniel Veillardce682bc2004-11-05 17:22:25 +00001268
Daniel Veillardd93f6252004-11-02 15:53:51 +00001269static int
1270test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001272
William M. Brack21e4ef22005-01-02 09:53:13 +00001273#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001274 int mem_base;
1275 htmlStatus ret_val;
1276 htmlElemDesc * elt; /* HTML element */
1277 int n_elt;
1278 xmlChar * attr; /* HTML attribute */
1279 int n_attr;
1280 int legacy; /* whether to allow deprecated attributes */
1281 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001282
Daniel Veillard57b25162004-11-06 14:50:18 +00001283 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1284 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1285 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1286 mem_base = xmlMemBlocks();
1287 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1288 attr = gen_const_xmlChar_ptr(n_attr, 1);
1289 legacy = gen_int(n_legacy, 2);
1290
William M. Brackf13f77f2004-11-12 16:03:48 +00001291 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001292 desret_htmlStatus(ret_val);
1293 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001294 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1295 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001296 des_int(n_legacy, legacy, 2);
1297 xmlResetLastError();
1298 if (mem_base != xmlMemBlocks()) {
1299 printf("Leak of %d blocks found in htmlAttrAllowed",
1300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001301 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001302 printf(" %d", n_elt);
1303 printf(" %d", n_attr);
1304 printf(" %d", n_legacy);
1305 printf("\n");
1306 }
1307 }
1308 }
1309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001310 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001311#endif
1312
Daniel Veillard42595322004-11-08 10:52:06 +00001313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001314}
1315
Daniel Veillarda521d282004-11-09 14:59:59 +00001316#ifdef LIBXML_HTML_ENABLED
1317
1318#define gen_nb_htmlNodePtr 1
1319static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1320 return(NULL);
1321}
1322static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1323}
1324#endif
1325
Daniel Veillardd93f6252004-11-02 15:53:51 +00001326
1327static int
1328test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001330
William M. Brack21e4ef22005-01-02 09:53:13 +00001331#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001332 int mem_base;
1333 int ret_val;
1334 htmlDocPtr doc; /* the HTML document */
1335 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001336 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001337 int n_name;
1338 htmlNodePtr elem; /* the HTML element */
1339 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001340
Daniel Veillarda521d282004-11-09 14:59:59 +00001341 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001342 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001343 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001344 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001345 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001346 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001347 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001348
William M. Brackf13f77f2004-11-12 16:03:48 +00001349 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001350 desret_int(ret_val);
1351 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001352 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001353 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001354 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001355 xmlResetLastError();
1356 if (mem_base != xmlMemBlocks()) {
1357 printf("Leak of %d blocks found in htmlAutoCloseTag",
1358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001359 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001360 printf(" %d", n_doc);
1361 printf(" %d", n_name);
1362 printf(" %d", n_elem);
1363 printf("\n");
1364 }
1365 }
1366 }
1367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001368 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001369#endif
1370
Daniel Veillard42595322004-11-08 10:52:06 +00001371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001372}
1373
1374
1375static int
1376test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001378
William M. Brack21e4ef22005-01-02 09:53:13 +00001379#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001380 int mem_base;
1381 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001382 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001383 int n_buffer;
1384 int size; /* the size of the array */
1385 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001386
Daniel Veillard34099b42004-11-04 17:34:35 +00001387 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1388 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1389 mem_base = xmlMemBlocks();
1390 buffer = gen_const_char_ptr(n_buffer, 0);
1391 size = gen_int(n_size, 1);
1392
William M. Brackf13f77f2004-11-12 16:03:48 +00001393 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001394 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001395 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001396 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001397 des_int(n_size, size, 1);
1398 xmlResetLastError();
1399 if (mem_base != xmlMemBlocks()) {
1400 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001402 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001403 printf(" %d", n_buffer);
1404 printf(" %d", n_size);
1405 printf("\n");
1406 }
1407 }
1408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001409 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001410#endif
1411
Daniel Veillard42595322004-11-08 10:52:06 +00001412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001413}
1414
Daniel Veillarda521d282004-11-09 14:59:59 +00001415#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001416
Daniel Veillardce682bc2004-11-05 17:22:25 +00001417#define gen_nb_htmlSAXHandlerPtr 1
1418static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1419 return(NULL);
1420}
1421static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1422}
Daniel Veillarda521d282004-11-09 14:59:59 +00001423#endif
1424
Daniel Veillardce682bc2004-11-05 17:22:25 +00001425
Daniel Veillardd93f6252004-11-02 15:53:51 +00001426static int
1427test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001429
William M. Brack21e4ef22005-01-02 09:53:13 +00001430#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001431 int mem_base;
1432 htmlParserCtxtPtr ret_val;
1433 htmlSAXHandlerPtr sax; /* a SAX handler */
1434 int n_sax;
1435 void * user_data; /* The user data returned on SAX callbacks */
1436 int n_user_data;
1437 char * chunk; /* a pointer to an array of chars */
1438 int n_chunk;
1439 int size; /* number of chars in the array */
1440 int n_size;
1441 const char * filename; /* an optional file name or URI */
1442 int n_filename;
1443 xmlCharEncoding enc; /* an optional encoding */
1444 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001445
Daniel Veillardce682bc2004-11-05 17:22:25 +00001446 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1447 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1448 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1449 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001450 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001451 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1452 mem_base = xmlMemBlocks();
1453 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1454 user_data = gen_userdata(n_user_data, 1);
1455 chunk = gen_const_char_ptr(n_chunk, 2);
1456 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001457 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001458 enc = gen_xmlCharEncoding(n_enc, 5);
1459
William M. Brackf13f77f2004-11-12 16:03:48 +00001460 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001461 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001462 call_tests++;
1463 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1464 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001465 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001467 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001468 des_xmlCharEncoding(n_enc, enc, 5);
1469 xmlResetLastError();
1470 if (mem_base != xmlMemBlocks()) {
1471 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001473 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001474 printf(" %d", n_sax);
1475 printf(" %d", n_user_data);
1476 printf(" %d", n_chunk);
1477 printf(" %d", n_size);
1478 printf(" %d", n_filename);
1479 printf(" %d", n_enc);
1480 printf("\n");
1481 }
1482 }
1483 }
1484 }
1485 }
1486 }
1487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001488 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001489#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001490
Daniel Veillard42595322004-11-08 10:52:06 +00001491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001492}
1493
1494
1495static int
1496test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001498
William M. Brack21e4ef22005-01-02 09:53:13 +00001499#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001500 int mem_base;
1501 htmlDocPtr ret_val;
1502 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1503 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001505 int n_cur;
1506 const char * URL; /* the base URL to use for the document */
1507 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001508 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001509 int n_encoding;
1510 int options; /* a combination of htmlParserOption(s) */
1511 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001512
Daniel Veillarda521d282004-11-09 14:59:59 +00001513 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001514 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1515 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1516 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1517 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1518 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001519 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001520 cur = gen_const_xmlChar_ptr(n_cur, 1);
1521 URL = gen_filepath(n_URL, 2);
1522 encoding = gen_const_char_ptr(n_encoding, 3);
1523 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001524
William M. Brackf13f77f2004-11-12 16:03:48 +00001525 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001526 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001527 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001528 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001529 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001530 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001531 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001532 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001533 xmlResetLastError();
1534 if (mem_base != xmlMemBlocks()) {
1535 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001537 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001538 printf(" %d", n_ctxt);
1539 printf(" %d", n_cur);
1540 printf(" %d", n_URL);
1541 printf(" %d", n_encoding);
1542 printf(" %d", n_options);
1543 printf("\n");
1544 }
1545 }
1546 }
1547 }
1548 }
1549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001550 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001551#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001552
Daniel Veillard42595322004-11-08 10:52:06 +00001553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001554}
1555
1556
1557static int
1558test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001560
William M. Brack21e4ef22005-01-02 09:53:13 +00001561#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001562 htmlDocPtr ret_val;
1563 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1564 int n_ctxt;
1565 const char * filename; /* a file or URL */
1566 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001567 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 int n_encoding;
1569 int options; /* a combination of htmlParserOption(s) */
1570 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001571
Daniel Veillarda521d282004-11-09 14:59:59 +00001572 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1574 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1575 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001576 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001577 filename = gen_filepath(n_filename, 1);
1578 encoding = gen_const_char_ptr(n_encoding, 2);
1579 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001580
William M. Brackf13f77f2004-11-12 16:03:48 +00001581 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001582 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001583 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001584 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001585 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001586 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001587 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001588 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001589 }
1590 }
1591 }
1592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001593 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001594#endif
1595
Daniel Veillard42595322004-11-08 10:52:06 +00001596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001597}
1598
1599
1600static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001601test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001603
William M. Brack21e4ef22005-01-02 09:53:13 +00001604#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001605 int mem_base;
1606 htmlDocPtr ret_val;
1607 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1608 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001609 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001610 int n_buffer;
1611 int size; /* the size of the array */
1612 int n_size;
1613 const char * URL; /* the base URL to use for the document */
1614 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001615 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001616 int n_encoding;
1617 int options; /* a combination of htmlParserOption(s) */
1618 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001619
Daniel Veillarda521d282004-11-09 14:59:59 +00001620 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001621 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1622 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1623 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1624 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1625 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1626 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001627 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001628 buffer = gen_const_char_ptr(n_buffer, 1);
1629 size = gen_int(n_size, 2);
1630 URL = gen_filepath(n_URL, 3);
1631 encoding = gen_const_char_ptr(n_encoding, 4);
1632 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001633
William M. Brackf13f77f2004-11-12 16:03:48 +00001634 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001635 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001636 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001637 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001638 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001639 des_int(n_size, size, 2);
1640 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001641 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001642 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001643 xmlResetLastError();
1644 if (mem_base != xmlMemBlocks()) {
1645 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648 printf(" %d", n_ctxt);
1649 printf(" %d", n_buffer);
1650 printf(" %d", n_size);
1651 printf(" %d", n_URL);
1652 printf(" %d", n_encoding);
1653 printf(" %d", n_options);
1654 printf("\n");
1655 }
1656 }
1657 }
1658 }
1659 }
1660 }
1661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001662 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663#endif
1664
Daniel Veillard42595322004-11-08 10:52:06 +00001665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001666}
1667
1668
1669static int
1670test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001672
William M. Brack21e4ef22005-01-02 09:53:13 +00001673#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001674 int mem_base;
1675 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1676 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001677
Daniel Veillarda521d282004-11-09 14:59:59 +00001678 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001679 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001680 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001681
1682 htmlCtxtReset(ctxt);
1683 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001684 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001685 xmlResetLastError();
1686 if (mem_base != xmlMemBlocks()) {
1687 printf("Leak of %d blocks found in htmlCtxtReset",
1688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001689 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001690 printf(" %d", n_ctxt);
1691 printf("\n");
1692 }
1693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001694 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001695#endif
1696
Daniel Veillard42595322004-11-08 10:52:06 +00001697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001698}
1699
1700
1701static int
1702test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001704
William M. Brack21e4ef22005-01-02 09:53:13 +00001705#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001706 int mem_base;
1707 int ret_val;
1708 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1709 int n_ctxt;
1710 int options; /* a combination of htmlParserOption(s) */
1711 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001712
Daniel Veillarda521d282004-11-09 14:59:59 +00001713 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001714 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1715 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001716 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001717 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001718
1719 ret_val = htmlCtxtUseOptions(ctxt, options);
1720 desret_int(ret_val);
1721 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001722 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001723 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001724 xmlResetLastError();
1725 if (mem_base != xmlMemBlocks()) {
1726 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001728 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001729 printf(" %d", n_ctxt);
1730 printf(" %d", n_options);
1731 printf("\n");
1732 }
1733 }
1734 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001735 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001736#endif
1737
Daniel Veillard42595322004-11-08 10:52:06 +00001738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001739}
1740
1741
1742static int
1743test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001745
William M. Brack21e4ef22005-01-02 09:53:13 +00001746#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001747 int mem_base;
1748 int ret_val;
1749 htmlElemDesc * parent; /* HTML parent element */
1750 int n_parent;
1751 xmlChar * elt; /* HTML element */
1752 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001753
Daniel Veillardce682bc2004-11-05 17:22:25 +00001754 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1755 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1756 mem_base = xmlMemBlocks();
1757 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1758 elt = gen_const_xmlChar_ptr(n_elt, 1);
1759
William M. Brackf13f77f2004-11-12 16:03:48 +00001760 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001761 desret_int(ret_val);
1762 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001763 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1764 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001765 xmlResetLastError();
1766 if (mem_base != xmlMemBlocks()) {
1767 printf("Leak of %d blocks found in htmlElementAllowedHere",
1768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001769 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001770 printf(" %d", n_parent);
1771 printf(" %d", n_elt);
1772 printf("\n");
1773 }
1774 }
1775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001776 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001777#endif
1778
Daniel Veillard42595322004-11-08 10:52:06 +00001779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001780}
1781
1782
1783static int
1784test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001786
William M. Brack21e4ef22005-01-02 09:53:13 +00001787#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001788 int mem_base;
1789 htmlStatus ret_val;
1790 htmlElemDesc * parent; /* HTML parent element */
1791 int n_parent;
1792 htmlElemDesc * elt; /* HTML element */
1793 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001794
Daniel Veillard57b25162004-11-06 14:50:18 +00001795 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1796 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1797 mem_base = xmlMemBlocks();
1798 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1799 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1800
William M. Brackf13f77f2004-11-12 16:03:48 +00001801 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001802 desret_htmlStatus(ret_val);
1803 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001804 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1805 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001806 xmlResetLastError();
1807 if (mem_base != xmlMemBlocks()) {
1808 printf("Leak of %d blocks found in htmlElementStatusHere",
1809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001810 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001811 printf(" %d", n_parent);
1812 printf(" %d", n_elt);
1813 printf("\n");
1814 }
1815 }
1816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001817 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001818#endif
1819
Daniel Veillard42595322004-11-08 10:52:06 +00001820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001821}
1822
1823
1824static int
1825test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001827
William M. Brack21e4ef22005-01-02 09:53:13 +00001828#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001829 int mem_base;
1830 int ret_val;
1831 unsigned char * out; /* a pointer to an array of bytes to store the result */
1832 int n_out;
1833 int * outlen; /* the length of @out */
1834 int n_outlen;
1835 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1836 int n_in;
1837 int * inlen; /* the length of @in */
1838 int n_inlen;
1839 int quoteChar; /* the quote character to escape (' or ") or zero. */
1840 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001841
Daniel Veillardce682bc2004-11-05 17:22:25 +00001842 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1843 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1844 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1845 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1846 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1847 mem_base = xmlMemBlocks();
1848 out = gen_unsigned_char_ptr(n_out, 0);
1849 outlen = gen_int_ptr(n_outlen, 1);
1850 in = gen_const_unsigned_char_ptr(n_in, 2);
1851 inlen = gen_int_ptr(n_inlen, 3);
1852 quoteChar = gen_int(n_quoteChar, 4);
1853
William M. Brackf13f77f2004-11-12 16:03:48 +00001854 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001855 desret_int(ret_val);
1856 call_tests++;
1857 des_unsigned_char_ptr(n_out, out, 0);
1858 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001859 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001860 des_int_ptr(n_inlen, inlen, 3);
1861 des_int(n_quoteChar, quoteChar, 4);
1862 xmlResetLastError();
1863 if (mem_base != xmlMemBlocks()) {
1864 printf("Leak of %d blocks found in htmlEncodeEntities",
1865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001866 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001867 printf(" %d", n_out);
1868 printf(" %d", n_outlen);
1869 printf(" %d", n_in);
1870 printf(" %d", n_inlen);
1871 printf(" %d", n_quoteChar);
1872 printf("\n");
1873 }
1874 }
1875 }
1876 }
1877 }
1878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001879 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001880#endif
1881
Daniel Veillard42595322004-11-08 10:52:06 +00001882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001883}
1884
1885
1886static int
1887test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001889
William M. Brack21e4ef22005-01-02 09:53:13 +00001890#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001891 int mem_base;
1892 const htmlEntityDesc * ret_val;
1893 xmlChar * name; /* the entity name */
1894 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001895
Daniel Veillard42595322004-11-08 10:52:06 +00001896 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1897 mem_base = xmlMemBlocks();
1898 name = gen_const_xmlChar_ptr(n_name, 0);
1899
William M. Brackf13f77f2004-11-12 16:03:48 +00001900 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001901 desret_const_htmlEntityDesc_ptr(ret_val);
1902 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001903 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001904 xmlResetLastError();
1905 if (mem_base != xmlMemBlocks()) {
1906 printf("Leak of %d blocks found in htmlEntityLookup",
1907 xmlMemBlocks() - mem_base);
1908 test_ret++;
1909 printf(" %d", n_name);
1910 printf("\n");
1911 }
1912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001913 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001914#endif
1915
Daniel Veillard42595322004-11-08 10:52:06 +00001916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001917}
1918
1919
1920static int
1921test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001923
William M. Brack21e4ef22005-01-02 09:53:13 +00001924#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001925 int mem_base;
1926 const htmlEntityDesc * ret_val;
1927 unsigned int value; /* the entity's unicode value */
1928 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001929
Daniel Veillard42595322004-11-08 10:52:06 +00001930 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1931 mem_base = xmlMemBlocks();
1932 value = gen_unsigned_int(n_value, 0);
1933
1934 ret_val = htmlEntityValueLookup(value);
1935 desret_const_htmlEntityDesc_ptr(ret_val);
1936 call_tests++;
1937 des_unsigned_int(n_value, value, 0);
1938 xmlResetLastError();
1939 if (mem_base != xmlMemBlocks()) {
1940 printf("Leak of %d blocks found in htmlEntityValueLookup",
1941 xmlMemBlocks() - mem_base);
1942 test_ret++;
1943 printf(" %d", n_value);
1944 printf("\n");
1945 }
1946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001947 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001948#endif
1949
Daniel Veillard42595322004-11-08 10:52:06 +00001950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001951}
1952
1953
1954static int
1955test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001957
William M. Brack21e4ef22005-01-02 09:53:13 +00001958#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001959 int mem_base;
1960 int ret_val;
1961 int val; /* int 0 or 1 */
1962 int n_val;
1963
1964 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1965 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001966 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001967
1968 ret_val = htmlHandleOmittedElem(val);
1969 desret_int(ret_val);
1970 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001971 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001972 xmlResetLastError();
1973 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001974 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001976 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001977 printf(" %d", n_val);
1978 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001979 }
1980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001981 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001982#endif
1983
Daniel Veillard42595322004-11-08 10:52:06 +00001984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001985}
1986
1987
1988static int
1989test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001991
William M. Brack21e4ef22005-01-02 09:53:13 +00001992#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001993 int mem_base;
1994 int ret_val;
1995 htmlDocPtr doc; /* the HTML document */
1996 int n_doc;
1997 htmlNodePtr elem; /* the HTML element */
1998 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001999
Daniel Veillarda521d282004-11-09 14:59:59 +00002000 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2001 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002002 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002003 doc = gen_htmlDocPtr(n_doc, 0);
2004 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002005
2006 ret_val = htmlIsAutoClosed(doc, elem);
2007 desret_int(ret_val);
2008 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002009 des_htmlDocPtr(n_doc, doc, 0);
2010 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002011 xmlResetLastError();
2012 if (mem_base != xmlMemBlocks()) {
2013 printf("Leak of %d blocks found in htmlIsAutoClosed",
2014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002015 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002016 printf(" %d", n_doc);
2017 printf(" %d", n_elem);
2018 printf("\n");
2019 }
2020 }
2021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002022 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002023#endif
2024
Daniel Veillard42595322004-11-08 10:52:06 +00002025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026}
2027
2028
2029static int
2030test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002032
William M. Brack21e4ef22005-01-02 09:53:13 +00002033#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002034 int mem_base;
2035 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002036 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002037 int n_name;
2038
2039 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002041 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002042
William M. Brackf13f77f2004-11-12 16:03:48 +00002043 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002044 desret_int(ret_val);
2045 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002046 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047 xmlResetLastError();
2048 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002049 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002051 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002052 printf(" %d", n_name);
2053 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002054 }
2055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002056 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002057#endif
2058
Daniel Veillard42595322004-11-08 10:52:06 +00002059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002060}
2061
2062
2063static int
2064test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002066
William M. Brack21e4ef22005-01-02 09:53:13 +00002067#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002068 int mem_base;
2069 htmlStatus ret_val;
2070 htmlNodePtr node; /* an htmlNodePtr in a tree */
2071 int n_node;
2072 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2073 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002074
Daniel Veillarda521d282004-11-09 14:59:59 +00002075 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002076 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2077 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002078 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002079 legacy = gen_int(n_legacy, 1);
2080
William M. Brackf13f77f2004-11-12 16:03:48 +00002081 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002082 desret_htmlStatus(ret_val);
2083 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002084 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002085 des_int(n_legacy, legacy, 1);
2086 xmlResetLastError();
2087 if (mem_base != xmlMemBlocks()) {
2088 printf("Leak of %d blocks found in htmlNodeStatus",
2089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002090 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002091 printf(" %d", n_node);
2092 printf(" %d", n_legacy);
2093 printf("\n");
2094 }
2095 }
2096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002097 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002098#endif
2099
Daniel Veillard42595322004-11-08 10:52:06 +00002100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002101}
2102
2103
2104static int
2105test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002107
William M. Brack21e4ef22005-01-02 09:53:13 +00002108#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002109 int mem_base;
2110 int ret_val;
2111 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2112 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002113
Daniel Veillarda521d282004-11-09 14:59:59 +00002114 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002115 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002116 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002117
2118 ret_val = htmlParseCharRef(ctxt);
2119 desret_int(ret_val);
2120 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002121 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002122 xmlResetLastError();
2123 if (mem_base != xmlMemBlocks()) {
2124 printf("Leak of %d blocks found in htmlParseCharRef",
2125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002126 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002127 printf(" %d", n_ctxt);
2128 printf("\n");
2129 }
2130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002131 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002132#endif
2133
Daniel Veillard42595322004-11-08 10:52:06 +00002134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002135}
2136
2137
2138static int
2139test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002141
William M. Brack21e4ef22005-01-02 09:53:13 +00002142#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002143 int mem_base;
2144 int ret_val;
2145 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2146 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002147 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002148 int n_chunk;
2149 int size; /* the size in byte of the chunk */
2150 int n_size;
2151 int terminate; /* last chunk indicator */
2152 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002153
Daniel Veillarda521d282004-11-09 14:59:59 +00002154 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002155 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2156 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2157 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2158 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002159 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002160 chunk = gen_const_char_ptr(n_chunk, 1);
2161 size = gen_int(n_size, 2);
2162 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163
William M. Brackf13f77f2004-11-12 16:03:48 +00002164 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002165 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002166 desret_int(ret_val);
2167 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002168 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002169 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002170 des_int(n_size, size, 2);
2171 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002172 xmlResetLastError();
2173 if (mem_base != xmlMemBlocks()) {
2174 printf("Leak of %d blocks found in htmlParseChunk",
2175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002177 printf(" %d", n_ctxt);
2178 printf(" %d", n_chunk);
2179 printf(" %d", n_size);
2180 printf(" %d", n_terminate);
2181 printf("\n");
2182 }
2183 }
2184 }
2185 }
2186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002187 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002188#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002189
Daniel Veillard42595322004-11-08 10:52:06 +00002190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002191}
2192
2193
2194static int
2195test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002197
William M. Brack21e4ef22005-01-02 09:53:13 +00002198#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002199 int mem_base;
2200 htmlDocPtr ret_val;
2201 xmlChar * cur; /* a pointer to an array of xmlChar */
2202 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002203 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002204 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002205
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002206 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2207 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002209 cur = gen_xmlChar_ptr(n_cur, 0);
2210 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002211
William M. Brackf13f77f2004-11-12 16:03:48 +00002212 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002213 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002215 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002216 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002217 xmlResetLastError();
2218 if (mem_base != xmlMemBlocks()) {
2219 printf("Leak of %d blocks found in htmlParseDoc",
2220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002221 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002222 printf(" %d", n_cur);
2223 printf(" %d", n_encoding);
2224 printf("\n");
2225 }
2226 }
2227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002228 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002229#endif
2230
Daniel Veillard42595322004-11-08 10:52:06 +00002231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002232}
2233
2234
2235static int
2236test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002238
William M. Brack21e4ef22005-01-02 09:53:13 +00002239#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002240 int mem_base;
2241 int ret_val;
2242 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2243 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002244
Daniel Veillarda521d282004-11-09 14:59:59 +00002245 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002246 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002247 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002248
2249 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002250 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002251 desret_int(ret_val);
2252 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002253 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254 xmlResetLastError();
2255 if (mem_base != xmlMemBlocks()) {
2256 printf("Leak of %d blocks found in htmlParseDocument",
2257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002258 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002259 printf(" %d", n_ctxt);
2260 printf("\n");
2261 }
2262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002263 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002264#endif
2265
Daniel Veillard42595322004-11-08 10:52:06 +00002266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002267}
2268
2269
2270static int
2271test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002273
William M. Brack21e4ef22005-01-02 09:53:13 +00002274#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002275 int mem_base;
2276 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2277 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002278
Daniel Veillarda521d282004-11-09 14:59:59 +00002279 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002280 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002281 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002282
2283 htmlParseElement(ctxt);
2284 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002285 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002286 xmlResetLastError();
2287 if (mem_base != xmlMemBlocks()) {
2288 printf("Leak of %d blocks found in htmlParseElement",
2289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002290 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002291 printf(" %d", n_ctxt);
2292 printf("\n");
2293 }
2294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002295 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002296#endif
2297
Daniel Veillard42595322004-11-08 10:52:06 +00002298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002299}
2300
2301
2302static int
2303test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002305
William M. Brack21e4ef22005-01-02 09:53:13 +00002306#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002307 int mem_base;
2308 const htmlEntityDesc * ret_val;
2309 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2310 int n_ctxt;
2311 xmlChar ** str; /* location to store the entity name */
2312 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002313
Daniel Veillarda521d282004-11-09 14:59:59 +00002314 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002315 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2316 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002317 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002318 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2319
William M. Brackf13f77f2004-11-12 16:03:48 +00002320 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002321 desret_const_htmlEntityDesc_ptr(ret_val);
2322 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002323 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002324 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002325 xmlResetLastError();
2326 if (mem_base != xmlMemBlocks()) {
2327 printf("Leak of %d blocks found in htmlParseEntityRef",
2328 xmlMemBlocks() - mem_base);
2329 test_ret++;
2330 printf(" %d", n_ctxt);
2331 printf(" %d", n_str);
2332 printf("\n");
2333 }
2334 }
2335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002336 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002337#endif
2338
Daniel Veillard42595322004-11-08 10:52:06 +00002339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002340}
2341
2342
2343static int
2344test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002346
William M. Brack21e4ef22005-01-02 09:53:13 +00002347#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002348 htmlDocPtr ret_val;
2349 const char * filename; /* the filename */
2350 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002351 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002352 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002353
Daniel Veillarda03e3652004-11-02 18:45:30 +00002354 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2355 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002356 filename = gen_filepath(n_filename, 0);
2357 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358
William M. Brackf13f77f2004-11-12 16:03:48 +00002359 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002360 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002361 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002362 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002363 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002364 xmlResetLastError();
2365 }
2366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002367 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002368#endif
2369
Daniel Veillard42595322004-11-08 10:52:06 +00002370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002371}
2372
2373
2374static int
2375test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002377
William M. Brack21e4ef22005-01-02 09:53:13 +00002378#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002379 int mem_base;
2380 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002381 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002382 int n_cur;
2383 const char * URL; /* the base URL to use for the document */
2384 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002385 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002386 int n_encoding;
2387 int options; /* a combination of htmlParserOption(s) */
2388 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002389
Daniel Veillarda03e3652004-11-02 18:45:30 +00002390 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2391 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2392 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2393 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2394 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002395 cur = gen_const_xmlChar_ptr(n_cur, 0);
2396 URL = gen_filepath(n_URL, 1);
2397 encoding = gen_const_char_ptr(n_encoding, 2);
2398 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002399
William M. Brackf13f77f2004-11-12 16:03:48 +00002400 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002401 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002402 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002403 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002404 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002405 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002406 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002407 xmlResetLastError();
2408 if (mem_base != xmlMemBlocks()) {
2409 printf("Leak of %d blocks found in htmlReadDoc",
2410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002411 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002412 printf(" %d", n_cur);
2413 printf(" %d", n_URL);
2414 printf(" %d", n_encoding);
2415 printf(" %d", n_options);
2416 printf("\n");
2417 }
2418 }
2419 }
2420 }
2421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002422 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002423#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002424
Daniel Veillard42595322004-11-08 10:52:06 +00002425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002426}
2427
2428
2429static int
2430test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002432
William M. Brack21e4ef22005-01-02 09:53:13 +00002433#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002434 int mem_base;
2435 htmlDocPtr ret_val;
2436 const char * filename; /* a file or URL */
2437 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002438 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002439 int n_encoding;
2440 int options; /* a combination of htmlParserOption(s) */
2441 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002442
Daniel Veillarda03e3652004-11-02 18:45:30 +00002443 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2444 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2445 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2446 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002447 filename = gen_filepath(n_filename, 0);
2448 encoding = gen_const_char_ptr(n_encoding, 1);
2449 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002450
William M. Brackf13f77f2004-11-12 16:03:48 +00002451 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002452 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002453 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002454 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002455 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002456 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002457 xmlResetLastError();
2458 if (mem_base != xmlMemBlocks()) {
2459 printf("Leak of %d blocks found in htmlReadFile",
2460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002461 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002462 printf(" %d", n_filename);
2463 printf(" %d", n_encoding);
2464 printf(" %d", n_options);
2465 printf("\n");
2466 }
2467 }
2468 }
2469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002470 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002471#endif
2472
Daniel Veillard42595322004-11-08 10:52:06 +00002473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002474}
2475
2476
2477static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002478test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002480
William M. Brack21e4ef22005-01-02 09:53:13 +00002481#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002482 int mem_base;
2483 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002484 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485 int n_buffer;
2486 int size; /* the size of the array */
2487 int n_size;
2488 const char * URL; /* the base URL to use for the document */
2489 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002490 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002491 int n_encoding;
2492 int options; /* a combination of htmlParserOption(s) */
2493 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002494
Daniel Veillarda03e3652004-11-02 18:45:30 +00002495 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2496 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2497 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2498 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2499 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002501 buffer = gen_const_char_ptr(n_buffer, 0);
2502 size = gen_int(n_size, 1);
2503 URL = gen_filepath(n_URL, 2);
2504 encoding = gen_const_char_ptr(n_encoding, 3);
2505 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002506
William M. Brackf13f77f2004-11-12 16:03:48 +00002507 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002508 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002509 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002510 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002511 des_int(n_size, size, 1);
2512 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002513 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002514 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002515 xmlResetLastError();
2516 if (mem_base != xmlMemBlocks()) {
2517 printf("Leak of %d blocks found in htmlReadMemory",
2518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002519 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002520 printf(" %d", n_buffer);
2521 printf(" %d", n_size);
2522 printf(" %d", n_URL);
2523 printf(" %d", n_encoding);
2524 printf(" %d", n_options);
2525 printf("\n");
2526 }
2527 }
2528 }
2529 }
2530 }
2531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002532 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002533#endif
2534
Daniel Veillard42595322004-11-08 10:52:06 +00002535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002536}
2537
2538
2539static int
2540test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002542
William M. Brack21e4ef22005-01-02 09:53:13 +00002543#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002544 int mem_base;
2545 htmlDocPtr ret_val;
2546 xmlChar * cur; /* a pointer to an array of xmlChar */
2547 int n_cur;
2548 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2549 int n_encoding;
2550 htmlSAXHandlerPtr sax; /* the SAX handler block */
2551 int n_sax;
2552 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2553 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002554
Daniel Veillardce682bc2004-11-05 17:22:25 +00002555 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2556 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2557 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2558 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2559 mem_base = xmlMemBlocks();
2560 cur = gen_xmlChar_ptr(n_cur, 0);
2561 encoding = gen_const_char_ptr(n_encoding, 1);
2562 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2563 userData = gen_userdata(n_userData, 3);
2564
William M. Brackf13f77f2004-11-12 16:03:48 +00002565 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002566 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002567 call_tests++;
2568 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002569 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002570 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2571 des_userdata(n_userData, userData, 3);
2572 xmlResetLastError();
2573 if (mem_base != xmlMemBlocks()) {
2574 printf("Leak of %d blocks found in htmlSAXParseDoc",
2575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002576 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002577 printf(" %d", n_cur);
2578 printf(" %d", n_encoding);
2579 printf(" %d", n_sax);
2580 printf(" %d", n_userData);
2581 printf("\n");
2582 }
2583 }
2584 }
2585 }
2586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002587 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002588#endif
2589
Daniel Veillard42595322004-11-08 10:52:06 +00002590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002591}
2592
2593
2594static int
2595test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002597
William M. Brack21e4ef22005-01-02 09:53:13 +00002598#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002599 int mem_base;
2600 htmlDocPtr ret_val;
2601 const char * filename; /* the filename */
2602 int n_filename;
2603 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2604 int n_encoding;
2605 htmlSAXHandlerPtr sax; /* the SAX handler block */
2606 int n_sax;
2607 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2608 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002609
Daniel Veillardce682bc2004-11-05 17:22:25 +00002610 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2611 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2612 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2613 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2614 mem_base = xmlMemBlocks();
2615 filename = gen_filepath(n_filename, 0);
2616 encoding = gen_const_char_ptr(n_encoding, 1);
2617 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2618 userData = gen_userdata(n_userData, 3);
2619
William M. Brackf13f77f2004-11-12 16:03:48 +00002620 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002621 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002622 call_tests++;
2623 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002624 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002625 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2626 des_userdata(n_userData, userData, 3);
2627 xmlResetLastError();
2628 if (mem_base != xmlMemBlocks()) {
2629 printf("Leak of %d blocks found in htmlSAXParseFile",
2630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002631 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002632 printf(" %d", n_filename);
2633 printf(" %d", n_encoding);
2634 printf(" %d", n_sax);
2635 printf(" %d", n_userData);
2636 printf("\n");
2637 }
2638 }
2639 }
2640 }
2641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002642 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002643#endif
2644
Daniel Veillard42595322004-11-08 10:52:06 +00002645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002646}
2647
2648
2649static int
2650test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002652
2653
2654 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002656}
2657
2658static int
2659test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002661
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002662 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002663 test_ret += test_UTF8ToHtml();
2664 test_ret += test_htmlAttrAllowed();
2665 test_ret += test_htmlAutoCloseTag();
2666 test_ret += test_htmlCreateMemoryParserCtxt();
2667 test_ret += test_htmlCreatePushParserCtxt();
2668 test_ret += test_htmlCtxtReadDoc();
2669 test_ret += test_htmlCtxtReadFile();
2670 test_ret += test_htmlCtxtReadMemory();
2671 test_ret += test_htmlCtxtReset();
2672 test_ret += test_htmlCtxtUseOptions();
2673 test_ret += test_htmlElementAllowedHere();
2674 test_ret += test_htmlElementStatusHere();
2675 test_ret += test_htmlEncodeEntities();
2676 test_ret += test_htmlEntityLookup();
2677 test_ret += test_htmlEntityValueLookup();
2678 test_ret += test_htmlHandleOmittedElem();
2679 test_ret += test_htmlIsAutoClosed();
2680 test_ret += test_htmlIsScriptAttribute();
2681 test_ret += test_htmlNodeStatus();
2682 test_ret += test_htmlParseCharRef();
2683 test_ret += test_htmlParseChunk();
2684 test_ret += test_htmlParseDoc();
2685 test_ret += test_htmlParseDocument();
2686 test_ret += test_htmlParseElement();
2687 test_ret += test_htmlParseEntityRef();
2688 test_ret += test_htmlParseFile();
2689 test_ret += test_htmlReadDoc();
2690 test_ret += test_htmlReadFile();
2691 test_ret += test_htmlReadMemory();
2692 test_ret += test_htmlSAXParseDoc();
2693 test_ret += test_htmlSAXParseFile();
2694 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002695
Daniel Veillard42595322004-11-08 10:52:06 +00002696 if (test_ret != 0)
2697 printf("Module HTMLparser: %d errors\n", test_ret);
2698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002699}
2700
2701static int
2702test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002704
William M. Brack21e4ef22005-01-02 09:53:13 +00002705#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002706 int mem_base;
2707 xmlOutputBufferPtr buf; /* the HTML buffer output */
2708 int n_buf;
2709 xmlDocPtr cur; /* the document */
2710 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002711 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002712 int n_encoding;
2713 int format; /* should formatting spaces been added */
2714 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002715
Daniel Veillard3d97e662004-11-04 10:49:00 +00002716 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2717 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2718 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2719 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2720 mem_base = xmlMemBlocks();
2721 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2722 cur = gen_xmlDocPtr(n_cur, 1);
2723 encoding = gen_const_char_ptr(n_encoding, 2);
2724 format = gen_int(n_format, 3);
2725
William M. Brackf13f77f2004-11-12 16:03:48 +00002726 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727 call_tests++;
2728 des_xmlOutputBufferPtr(n_buf, buf, 0);
2729 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002730 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002731 des_int(n_format, format, 3);
2732 xmlResetLastError();
2733 if (mem_base != xmlMemBlocks()) {
2734 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002736 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002737 printf(" %d", n_buf);
2738 printf(" %d", n_cur);
2739 printf(" %d", n_encoding);
2740 printf(" %d", n_format);
2741 printf("\n");
2742 }
2743 }
2744 }
2745 }
2746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002747 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002748#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002749
Daniel Veillard42595322004-11-08 10:52:06 +00002750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002751}
2752
2753
2754static int
2755test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002757
William M. Brack21e4ef22005-01-02 09:53:13 +00002758#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002759 int mem_base;
2760 xmlOutputBufferPtr buf; /* the HTML buffer output */
2761 int n_buf;
2762 xmlDocPtr cur; /* the document */
2763 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002764 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002765 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002766
Daniel Veillard3d97e662004-11-04 10:49:00 +00002767 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2768 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2769 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2770 mem_base = xmlMemBlocks();
2771 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2772 cur = gen_xmlDocPtr(n_cur, 1);
2773 encoding = gen_const_char_ptr(n_encoding, 2);
2774
William M. Brackf13f77f2004-11-12 16:03:48 +00002775 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002776 call_tests++;
2777 des_xmlOutputBufferPtr(n_buf, buf, 0);
2778 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002779 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 xmlResetLastError();
2781 if (mem_base != xmlMemBlocks()) {
2782 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002784 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002785 printf(" %d", n_buf);
2786 printf(" %d", n_cur);
2787 printf(" %d", n_encoding);
2788 printf("\n");
2789 }
2790 }
2791 }
2792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002793 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002794#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002795
Daniel Veillard42595322004-11-08 10:52:06 +00002796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002797}
2798
2799
2800static int
2801test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002803
William M. Brack21e4ef22005-01-02 09:53:13 +00002804#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002805 int mem_base;
2806 int ret_val;
2807 FILE * f; /* the FILE* */
2808 int n_f;
2809 xmlDocPtr cur; /* the document */
2810 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002811
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002812 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2813 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2814 mem_base = xmlMemBlocks();
2815 f = gen_FILE_ptr(n_f, 0);
2816 cur = gen_xmlDocPtr(n_cur, 1);
2817
2818 ret_val = htmlDocDump(f, cur);
2819 desret_int(ret_val);
2820 call_tests++;
2821 des_FILE_ptr(n_f, f, 0);
2822 des_xmlDocPtr(n_cur, cur, 1);
2823 xmlResetLastError();
2824 if (mem_base != xmlMemBlocks()) {
2825 printf("Leak of %d blocks found in htmlDocDump",
2826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002827 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002828 printf(" %d", n_f);
2829 printf(" %d", n_cur);
2830 printf("\n");
2831 }
2832 }
2833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002834 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002835#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002836
Daniel Veillard42595322004-11-08 10:52:06 +00002837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002838}
2839
2840
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002841#define gen_nb_xmlChar_ptr_ptr 1
2842static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2843 return(NULL);
2844}
2845static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2846}
2847
Daniel Veillardd93f6252004-11-02 15:53:51 +00002848static int
2849test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002851
William M. Brack21e4ef22005-01-02 09:53:13 +00002852#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002853 int mem_base;
2854 xmlDocPtr cur; /* the document */
2855 int n_cur;
2856 xmlChar ** mem; /* OUT: the memory pointer */
2857 int n_mem;
2858 int * size; /* OUT: the memory length */
2859 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002860
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002861 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2862 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2863 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2864 mem_base = xmlMemBlocks();
2865 cur = gen_xmlDocPtr(n_cur, 0);
2866 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2867 size = gen_int_ptr(n_size, 2);
2868
2869 htmlDocDumpMemory(cur, mem, size);
2870 call_tests++;
2871 des_xmlDocPtr(n_cur, cur, 0);
2872 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2873 des_int_ptr(n_size, size, 2);
2874 xmlResetLastError();
2875 if (mem_base != xmlMemBlocks()) {
2876 printf("Leak of %d blocks found in htmlDocDumpMemory",
2877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002878 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002879 printf(" %d", n_cur);
2880 printf(" %d", n_mem);
2881 printf(" %d", n_size);
2882 printf("\n");
2883 }
2884 }
2885 }
2886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002887 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002888#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002889
Daniel Veillard42595322004-11-08 10:52:06 +00002890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002891}
2892
2893
2894static int
2895test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002897
William M. Brack21e4ef22005-01-02 09:53:13 +00002898#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002899 int mem_base;
2900 const xmlChar * ret_val;
2901 htmlDocPtr doc; /* the document */
2902 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002903
Daniel Veillarda521d282004-11-09 14:59:59 +00002904 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002905 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002906 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002907
2908 ret_val = htmlGetMetaEncoding(doc);
2909 desret_const_xmlChar_ptr(ret_val);
2910 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002911 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002912 xmlResetLastError();
2913 if (mem_base != xmlMemBlocks()) {
2914 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002916 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002917 printf(" %d", n_doc);
2918 printf("\n");
2919 }
2920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002921 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002922#endif
2923
Daniel Veillard42595322004-11-08 10:52:06 +00002924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925}
2926
2927
2928static int
2929test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002931
William M. Brack21e4ef22005-01-02 09:53:13 +00002932#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002933 int mem_base;
2934 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002935 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002936 int n_name;
2937
2938 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002940 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002941
William M. Brackf13f77f2004-11-12 16:03:48 +00002942 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002943 desret_int(ret_val);
2944 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946 xmlResetLastError();
2947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002948 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002951 printf(" %d", n_name);
2952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002953 }
2954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002955 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002956#endif
2957
Daniel Veillard42595322004-11-08 10:52:06 +00002958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002959}
2960
2961
2962static int
2963test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002965
William M. Brack21e4ef22005-01-02 09:53:13 +00002966#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002967 int mem_base;
2968 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002969 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002970 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002971 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002972 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002973
Daniel Veillarda03e3652004-11-02 18:45:30 +00002974 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2975 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002977 URI = gen_const_xmlChar_ptr(n_URI, 0);
2978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002979
William M. Brackf13f77f2004-11-12 16:03:48 +00002980 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002981 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002982 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002983 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2984 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985 xmlResetLastError();
2986 if (mem_base != xmlMemBlocks()) {
2987 printf("Leak of %d blocks found in htmlNewDoc",
2988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002989 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002990 printf(" %d", n_URI);
2991 printf(" %d", n_ExternalID);
2992 printf("\n");
2993 }
2994 }
2995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002996 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002997#endif
2998
Daniel Veillard42595322004-11-08 10:52:06 +00002999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003000}
3001
3002
3003static int
3004test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003006
William M. Brack21e4ef22005-01-02 09:53:13 +00003007#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003008 int mem_base;
3009 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003010 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003011 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003012 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003013 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003014
Daniel Veillarda03e3652004-11-02 18:45:30 +00003015 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3016 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003018 URI = gen_const_xmlChar_ptr(n_URI, 0);
3019 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003020
William M. Brackf13f77f2004-11-12 16:03:48 +00003021 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003022 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003023 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003024 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3025 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 xmlResetLastError();
3027 if (mem_base != xmlMemBlocks()) {
3028 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003031 printf(" %d", n_URI);
3032 printf(" %d", n_ExternalID);
3033 printf("\n");
3034 }
3035 }
3036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003037 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003038#endif
3039
Daniel Veillard42595322004-11-08 10:52:06 +00003040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003041}
3042
3043
3044static int
3045test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003047
William M. Brack21e4ef22005-01-02 09:53:13 +00003048#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003049 int mem_base;
3050 int ret_val;
3051 xmlBufferPtr buf; /* the HTML buffer output */
3052 int n_buf;
3053 xmlDocPtr doc; /* the document */
3054 int n_doc;
3055 xmlNodePtr cur; /* the current node */
3056 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003057
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003058 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3059 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3060 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3061 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003062 buf = gen_xmlBufferPtr(n_buf, 0);
3063 doc = gen_xmlDocPtr(n_doc, 1);
3064 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003065
3066 ret_val = htmlNodeDump(buf, doc, cur);
3067 desret_int(ret_val);
3068 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003069 des_xmlBufferPtr(n_buf, buf, 0);
3070 des_xmlDocPtr(n_doc, doc, 1);
3071 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003072 xmlResetLastError();
3073 if (mem_base != xmlMemBlocks()) {
3074 printf("Leak of %d blocks found in htmlNodeDump",
3075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003076 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003077 printf(" %d", n_buf);
3078 printf(" %d", n_doc);
3079 printf(" %d", n_cur);
3080 printf("\n");
3081 }
3082 }
3083 }
3084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003085 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003086#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003087
Daniel Veillard42595322004-11-08 10:52:06 +00003088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003089}
3090
3091
3092static int
3093test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003095
William M. Brack21e4ef22005-01-02 09:53:13 +00003096#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003097 int mem_base;
3098 FILE * out; /* the FILE pointer */
3099 int n_out;
3100 xmlDocPtr doc; /* the document */
3101 int n_doc;
3102 xmlNodePtr cur; /* the current node */
3103 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003104
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003105 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3106 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3107 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3108 mem_base = xmlMemBlocks();
3109 out = gen_FILE_ptr(n_out, 0);
3110 doc = gen_xmlDocPtr(n_doc, 1);
3111 cur = gen_xmlNodePtr(n_cur, 2);
3112
3113 htmlNodeDumpFile(out, doc, cur);
3114 call_tests++;
3115 des_FILE_ptr(n_out, out, 0);
3116 des_xmlDocPtr(n_doc, doc, 1);
3117 des_xmlNodePtr(n_cur, cur, 2);
3118 xmlResetLastError();
3119 if (mem_base != xmlMemBlocks()) {
3120 printf("Leak of %d blocks found in htmlNodeDumpFile",
3121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003122 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003123 printf(" %d", n_out);
3124 printf(" %d", n_doc);
3125 printf(" %d", n_cur);
3126 printf("\n");
3127 }
3128 }
3129 }
3130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003131 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003132#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003133
Daniel Veillard42595322004-11-08 10:52:06 +00003134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003135}
3136
3137
3138static int
3139test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003141
William M. Brack21e4ef22005-01-02 09:53:13 +00003142#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003143 int mem_base;
3144 int ret_val;
3145 FILE * out; /* the FILE pointer */
3146 int n_out;
3147 xmlDocPtr doc; /* the document */
3148 int n_doc;
3149 xmlNodePtr cur; /* the current node */
3150 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003151 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003152 int n_encoding;
3153 int format; /* should formatting spaces been added */
3154 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003155
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003156 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3157 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3158 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3159 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3160 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3161 mem_base = xmlMemBlocks();
3162 out = gen_FILE_ptr(n_out, 0);
3163 doc = gen_xmlDocPtr(n_doc, 1);
3164 cur = gen_xmlNodePtr(n_cur, 2);
3165 encoding = gen_const_char_ptr(n_encoding, 3);
3166 format = gen_int(n_format, 4);
3167
William M. Brackf13f77f2004-11-12 16:03:48 +00003168 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003169 desret_int(ret_val);
3170 call_tests++;
3171 des_FILE_ptr(n_out, out, 0);
3172 des_xmlDocPtr(n_doc, doc, 1);
3173 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003174 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003175 des_int(n_format, format, 4);
3176 xmlResetLastError();
3177 if (mem_base != xmlMemBlocks()) {
3178 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003180 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003181 printf(" %d", n_out);
3182 printf(" %d", n_doc);
3183 printf(" %d", n_cur);
3184 printf(" %d", n_encoding);
3185 printf(" %d", n_format);
3186 printf("\n");
3187 }
3188 }
3189 }
3190 }
3191 }
3192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003193 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003194#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003195
Daniel Veillard42595322004-11-08 10:52:06 +00003196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003197}
3198
3199
3200static int
3201test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003203
William M. Brack21e4ef22005-01-02 09:53:13 +00003204#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003205 int mem_base;
3206 xmlOutputBufferPtr buf; /* the HTML buffer output */
3207 int n_buf;
3208 xmlDocPtr doc; /* the document */
3209 int n_doc;
3210 xmlNodePtr cur; /* the current node */
3211 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003212 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003213 int n_encoding;
3214 int format; /* should formatting spaces been added */
3215 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003216
Daniel Veillard3d97e662004-11-04 10:49:00 +00003217 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3218 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3219 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3220 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3221 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3222 mem_base = xmlMemBlocks();
3223 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3224 doc = gen_xmlDocPtr(n_doc, 1);
3225 cur = gen_xmlNodePtr(n_cur, 2);
3226 encoding = gen_const_char_ptr(n_encoding, 3);
3227 format = gen_int(n_format, 4);
3228
William M. Brackf13f77f2004-11-12 16:03:48 +00003229 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003230 call_tests++;
3231 des_xmlOutputBufferPtr(n_buf, buf, 0);
3232 des_xmlDocPtr(n_doc, doc, 1);
3233 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003234 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003235 des_int(n_format, format, 4);
3236 xmlResetLastError();
3237 if (mem_base != xmlMemBlocks()) {
3238 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003240 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003241 printf(" %d", n_buf);
3242 printf(" %d", n_doc);
3243 printf(" %d", n_cur);
3244 printf(" %d", n_encoding);
3245 printf(" %d", n_format);
3246 printf("\n");
3247 }
3248 }
3249 }
3250 }
3251 }
3252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003253 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003254#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003255
Daniel Veillard42595322004-11-08 10:52:06 +00003256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003257}
3258
3259
3260static int
3261test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003263
William M. Brack21e4ef22005-01-02 09:53:13 +00003264#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003265 int mem_base;
3266 xmlOutputBufferPtr buf; /* the HTML buffer output */
3267 int n_buf;
3268 xmlDocPtr doc; /* the document */
3269 int n_doc;
3270 xmlNodePtr cur; /* the current node */
3271 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003272 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003273 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003274
Daniel Veillard3d97e662004-11-04 10:49:00 +00003275 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3276 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3277 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3278 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3279 mem_base = xmlMemBlocks();
3280 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3281 doc = gen_xmlDocPtr(n_doc, 1);
3282 cur = gen_xmlNodePtr(n_cur, 2);
3283 encoding = gen_const_char_ptr(n_encoding, 3);
3284
William M. Brackf13f77f2004-11-12 16:03:48 +00003285 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003286 call_tests++;
3287 des_xmlOutputBufferPtr(n_buf, buf, 0);
3288 des_xmlDocPtr(n_doc, doc, 1);
3289 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003290 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003291 xmlResetLastError();
3292 if (mem_base != xmlMemBlocks()) {
3293 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003295 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003296 printf(" %d", n_buf);
3297 printf(" %d", n_doc);
3298 printf(" %d", n_cur);
3299 printf(" %d", n_encoding);
3300 printf("\n");
3301 }
3302 }
3303 }
3304 }
3305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003306 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003307#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003308
Daniel Veillard42595322004-11-08 10:52:06 +00003309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003310}
3311
3312
3313static int
3314test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003316
William M. Brack21e4ef22005-01-02 09:53:13 +00003317#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003318 int mem_base;
3319 int ret_val;
3320 const char * filename; /* the filename (or URL) */
3321 int n_filename;
3322 xmlDocPtr cur; /* the document */
3323 int n_cur;
3324
3325 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3326 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3327 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003328 filename = gen_fileoutput(n_filename, 0);
3329 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003330
3331 ret_val = htmlSaveFile(filename, cur);
3332 desret_int(ret_val);
3333 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003334 des_fileoutput(n_filename, filename, 0);
3335 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003336 xmlResetLastError();
3337 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003338 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003340 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003341 printf(" %d", n_filename);
3342 printf(" %d", n_cur);
3343 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003344 }
3345 }
3346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003347 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003348#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003349
Daniel Veillard42595322004-11-08 10:52:06 +00003350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351}
3352
3353
3354static int
3355test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003357
William M. Brack21e4ef22005-01-02 09:53:13 +00003358#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359 int mem_base;
3360 int ret_val;
3361 const char * filename; /* the filename */
3362 int n_filename;
3363 xmlDocPtr cur; /* the document */
3364 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003365 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003366 int n_encoding;
3367
3368 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3369 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3370 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003372 filename = gen_fileoutput(n_filename, 0);
3373 cur = gen_xmlDocPtr(n_cur, 1);
3374 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375
William M. Brackf13f77f2004-11-12 16:03:48 +00003376 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003377 desret_int(ret_val);
3378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003379 des_fileoutput(n_filename, filename, 0);
3380 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003381 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003382 xmlResetLastError();
3383 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003384 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003386 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003387 printf(" %d", n_filename);
3388 printf(" %d", n_cur);
3389 printf(" %d", n_encoding);
3390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003391 }
3392 }
3393 }
3394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003395 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003396#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003397
Daniel Veillard42595322004-11-08 10:52:06 +00003398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003399}
3400
3401
3402static int
3403test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003405
William M. Brack21e4ef22005-01-02 09:53:13 +00003406#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003407 int mem_base;
3408 int ret_val;
3409 const char * filename; /* the filename */
3410 int n_filename;
3411 xmlDocPtr cur; /* the document */
3412 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003413 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414 int n_encoding;
3415 int format; /* should formatting spaces been added */
3416 int n_format;
3417
3418 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3419 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3420 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3421 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003423 filename = gen_fileoutput(n_filename, 0);
3424 cur = gen_xmlDocPtr(n_cur, 1);
3425 encoding = gen_const_char_ptr(n_encoding, 2);
3426 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003427
William M. Brackf13f77f2004-11-12 16:03:48 +00003428 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003429 desret_int(ret_val);
3430 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003431 des_fileoutput(n_filename, filename, 0);
3432 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003433 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003434 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003435 xmlResetLastError();
3436 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003437 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003440 printf(" %d", n_filename);
3441 printf(" %d", n_cur);
3442 printf(" %d", n_encoding);
3443 printf(" %d", n_format);
3444 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003445 }
3446 }
3447 }
3448 }
3449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003450 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003451#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003452
Daniel Veillard42595322004-11-08 10:52:06 +00003453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003454}
3455
3456
3457static int
3458test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003460
William M. Brack21e4ef22005-01-02 09:53:13 +00003461#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003462 int mem_base;
3463 int ret_val;
3464 htmlDocPtr doc; /* the document */
3465 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003466 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003467 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003468
Daniel Veillarda521d282004-11-09 14:59:59 +00003469 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003470 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3471 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003472 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003473 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003474
William M. Brackf13f77f2004-11-12 16:03:48 +00003475 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003476 desret_int(ret_val);
3477 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003478 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003479 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003480 xmlResetLastError();
3481 if (mem_base != xmlMemBlocks()) {
3482 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003484 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003485 printf(" %d", n_doc);
3486 printf(" %d", n_encoding);
3487 printf("\n");
3488 }
3489 }
3490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003491 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003492#endif
3493
Daniel Veillard42595322004-11-08 10:52:06 +00003494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003495}
3496
3497static int
3498test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003500
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003501 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003502 test_ret += test_htmlDocContentDumpFormatOutput();
3503 test_ret += test_htmlDocContentDumpOutput();
3504 test_ret += test_htmlDocDump();
3505 test_ret += test_htmlDocDumpMemory();
3506 test_ret += test_htmlGetMetaEncoding();
3507 test_ret += test_htmlIsBooleanAttr();
3508 test_ret += test_htmlNewDoc();
3509 test_ret += test_htmlNewDocNoDtD();
3510 test_ret += test_htmlNodeDump();
3511 test_ret += test_htmlNodeDumpFile();
3512 test_ret += test_htmlNodeDumpFileFormat();
3513 test_ret += test_htmlNodeDumpFormatOutput();
3514 test_ret += test_htmlNodeDumpOutput();
3515 test_ret += test_htmlSaveFile();
3516 test_ret += test_htmlSaveFileEnc();
3517 test_ret += test_htmlSaveFileFormat();
3518 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003519
Daniel Veillard42595322004-11-08 10:52:06 +00003520 if (test_ret != 0)
3521 printf("Module HTMLtree: %d errors\n", test_ret);
3522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003523}
3524
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003525static int
3526test_docbDefaultSAXHandlerInit(void) {
3527 int test_ret = 0;
3528
William M. Brack21e4ef22005-01-02 09:53:13 +00003529#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003530#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003531 int mem_base;
3532
3533 mem_base = xmlMemBlocks();
3534
3535 docbDefaultSAXHandlerInit();
3536 call_tests++;
3537 xmlResetLastError();
3538 if (mem_base != xmlMemBlocks()) {
3539 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3540 xmlMemBlocks() - mem_base);
3541 test_ret++;
3542 printf("\n");
3543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003544 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003545#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003546#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003547
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003548 return(test_ret);
3549}
3550
3551
3552static int
3553test_htmlDefaultSAXHandlerInit(void) {
3554 int test_ret = 0;
3555
William M. Brack21e4ef22005-01-02 09:53:13 +00003556#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003557#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003558 int mem_base;
3559
3560 mem_base = xmlMemBlocks();
3561
3562 htmlDefaultSAXHandlerInit();
3563 call_tests++;
3564 xmlResetLastError();
3565 if (mem_base != xmlMemBlocks()) {
3566 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3567 xmlMemBlocks() - mem_base);
3568 test_ret++;
3569 printf("\n");
3570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003571 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003572#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003573#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003574
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003575 return(test_ret);
3576}
3577
3578
3579static int
3580test_xmlDefaultSAXHandlerInit(void) {
3581 int test_ret = 0;
3582
3583 int mem_base;
3584
3585 mem_base = xmlMemBlocks();
3586
3587 xmlDefaultSAXHandlerInit();
3588 call_tests++;
3589 xmlResetLastError();
3590 if (mem_base != xmlMemBlocks()) {
3591 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3592 xmlMemBlocks() - mem_base);
3593 test_ret++;
3594 printf("\n");
3595 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003596 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003597
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003598 return(test_ret);
3599}
3600
3601
3602#define gen_nb_xmlEnumerationPtr 1
3603static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3604 return(NULL);
3605}
3606static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3607}
3608
3609static int
3610test_xmlSAX2AttributeDecl(void) {
3611 int test_ret = 0;
3612
3613 int mem_base;
3614 void * ctx; /* the user data (XML parser context) */
3615 int n_ctx;
3616 xmlChar * elem; /* the name of the element */
3617 int n_elem;
3618 xmlChar * fullname; /* the attribute name */
3619 int n_fullname;
3620 int type; /* the attribute type */
3621 int n_type;
3622 int def; /* the type of default value */
3623 int n_def;
3624 xmlChar * defaultValue; /* the attribute default value */
3625 int n_defaultValue;
3626 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3627 int n_tree;
3628
3629 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3630 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3631 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3632 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3633 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3634 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3635 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3636 mem_base = xmlMemBlocks();
3637 ctx = gen_void_ptr(n_ctx, 0);
3638 elem = gen_const_xmlChar_ptr(n_elem, 1);
3639 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3640 type = gen_int(n_type, 3);
3641 def = gen_int(n_def, 4);
3642 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3643 tree = gen_xmlEnumerationPtr(n_tree, 6);
3644
William M. Brackf13f77f2004-11-12 16:03:48 +00003645 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003646 call_tests++;
3647 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003648 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3649 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003650 des_int(n_type, type, 3);
3651 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003652 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003653 des_xmlEnumerationPtr(n_tree, tree, 6);
3654 xmlResetLastError();
3655 if (mem_base != xmlMemBlocks()) {
3656 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3657 xmlMemBlocks() - mem_base);
3658 test_ret++;
3659 printf(" %d", n_ctx);
3660 printf(" %d", n_elem);
3661 printf(" %d", n_fullname);
3662 printf(" %d", n_type);
3663 printf(" %d", n_def);
3664 printf(" %d", n_defaultValue);
3665 printf(" %d", n_tree);
3666 printf("\n");
3667 }
3668 }
3669 }
3670 }
3671 }
3672 }
3673 }
3674 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003676
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003677 return(test_ret);
3678}
3679
3680
3681static int
3682test_xmlSAX2CDataBlock(void) {
3683 int test_ret = 0;
3684
3685 int mem_base;
3686 void * ctx; /* the user data (XML parser context) */
3687 int n_ctx;
3688 xmlChar * value; /* The pcdata content */
3689 int n_value;
3690 int len; /* the block length */
3691 int n_len;
3692
3693 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3694 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3695 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3696 mem_base = xmlMemBlocks();
3697 ctx = gen_void_ptr(n_ctx, 0);
3698 value = gen_const_xmlChar_ptr(n_value, 1);
3699 len = gen_int(n_len, 2);
3700
William M. Brackf13f77f2004-11-12 16:03:48 +00003701 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003702 call_tests++;
3703 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003704 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003705 des_int(n_len, len, 2);
3706 xmlResetLastError();
3707 if (mem_base != xmlMemBlocks()) {
3708 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3709 xmlMemBlocks() - mem_base);
3710 test_ret++;
3711 printf(" %d", n_ctx);
3712 printf(" %d", n_value);
3713 printf(" %d", n_len);
3714 printf("\n");
3715 }
3716 }
3717 }
3718 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003720
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003721 return(test_ret);
3722}
3723
3724
3725static int
3726test_xmlSAX2Characters(void) {
3727 int test_ret = 0;
3728
3729 int mem_base;
3730 void * ctx; /* the user data (XML parser context) */
3731 int n_ctx;
3732 xmlChar * ch; /* a xmlChar string */
3733 int n_ch;
3734 int len; /* the number of xmlChar */
3735 int n_len;
3736
3737 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3738 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3739 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3740 mem_base = xmlMemBlocks();
3741 ctx = gen_void_ptr(n_ctx, 0);
3742 ch = gen_const_xmlChar_ptr(n_ch, 1);
3743 len = gen_int(n_len, 2);
3744
William M. Brackf13f77f2004-11-12 16:03:48 +00003745 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003746 call_tests++;
3747 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003748 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003749 des_int(n_len, len, 2);
3750 xmlResetLastError();
3751 if (mem_base != xmlMemBlocks()) {
3752 printf("Leak of %d blocks found in xmlSAX2Characters",
3753 xmlMemBlocks() - mem_base);
3754 test_ret++;
3755 printf(" %d", n_ctx);
3756 printf(" %d", n_ch);
3757 printf(" %d", n_len);
3758 printf("\n");
3759 }
3760 }
3761 }
3762 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003764
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 return(test_ret);
3766}
3767
3768
3769static int
3770test_xmlSAX2Comment(void) {
3771 int test_ret = 0;
3772
3773 int mem_base;
3774 void * ctx; /* the user data (XML parser context) */
3775 int n_ctx;
3776 xmlChar * value; /* the xmlSAX2Comment content */
3777 int n_value;
3778
3779 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3780 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3781 mem_base = xmlMemBlocks();
3782 ctx = gen_void_ptr(n_ctx, 0);
3783 value = gen_const_xmlChar_ptr(n_value, 1);
3784
William M. Brackf13f77f2004-11-12 16:03:48 +00003785 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003786 call_tests++;
3787 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003788 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003789 xmlResetLastError();
3790 if (mem_base != xmlMemBlocks()) {
3791 printf("Leak of %d blocks found in xmlSAX2Comment",
3792 xmlMemBlocks() - mem_base);
3793 test_ret++;
3794 printf(" %d", n_ctx);
3795 printf(" %d", n_value);
3796 printf("\n");
3797 }
3798 }
3799 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003800 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003801
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003802 return(test_ret);
3803}
3804
3805
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003806static int
3807test_xmlSAX2ElementDecl(void) {
3808 int test_ret = 0;
3809
3810 int mem_base;
3811 void * ctx; /* the user data (XML parser context) */
3812 int n_ctx;
3813 xmlChar * name; /* the element name */
3814 int n_name;
3815 int type; /* the element type */
3816 int n_type;
3817 xmlElementContentPtr content; /* the element value tree */
3818 int n_content;
3819
3820 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3822 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3823 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3824 mem_base = xmlMemBlocks();
3825 ctx = gen_void_ptr(n_ctx, 0);
3826 name = gen_const_xmlChar_ptr(n_name, 1);
3827 type = gen_int(n_type, 2);
3828 content = gen_xmlElementContentPtr(n_content, 3);
3829
William M. Brackf13f77f2004-11-12 16:03:48 +00003830 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003831 call_tests++;
3832 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003833 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003834 des_int(n_type, type, 2);
3835 des_xmlElementContentPtr(n_content, content, 3);
3836 xmlResetLastError();
3837 if (mem_base != xmlMemBlocks()) {
3838 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3839 xmlMemBlocks() - mem_base);
3840 test_ret++;
3841 printf(" %d", n_ctx);
3842 printf(" %d", n_name);
3843 printf(" %d", n_type);
3844 printf(" %d", n_content);
3845 printf("\n");
3846 }
3847 }
3848 }
3849 }
3850 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003852
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003853 return(test_ret);
3854}
3855
3856
3857static int
3858test_xmlSAX2EndDocument(void) {
3859 int test_ret = 0;
3860
3861 int mem_base;
3862 void * ctx; /* the user data (XML parser context) */
3863 int n_ctx;
3864
3865 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3866 mem_base = xmlMemBlocks();
3867 ctx = gen_void_ptr(n_ctx, 0);
3868
3869 xmlSAX2EndDocument(ctx);
3870 call_tests++;
3871 des_void_ptr(n_ctx, ctx, 0);
3872 xmlResetLastError();
3873 if (mem_base != xmlMemBlocks()) {
3874 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3875 xmlMemBlocks() - mem_base);
3876 test_ret++;
3877 printf(" %d", n_ctx);
3878 printf("\n");
3879 }
3880 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003881 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003882
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003883 return(test_ret);
3884}
3885
3886
3887static int
3888test_xmlSAX2EndElement(void) {
3889 int test_ret = 0;
3890
William M. Brack21e4ef22005-01-02 09:53:13 +00003891#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003892#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003893 int mem_base;
3894 void * ctx; /* the user data (XML parser context) */
3895 int n_ctx;
3896 xmlChar * name; /* The element name */
3897 int n_name;
3898
3899 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3900 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3901 mem_base = xmlMemBlocks();
3902 ctx = gen_void_ptr(n_ctx, 0);
3903 name = gen_const_xmlChar_ptr(n_name, 1);
3904
William M. Brackf13f77f2004-11-12 16:03:48 +00003905 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003906 call_tests++;
3907 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003908 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003909 xmlResetLastError();
3910 if (mem_base != xmlMemBlocks()) {
3911 printf("Leak of %d blocks found in xmlSAX2EndElement",
3912 xmlMemBlocks() - mem_base);
3913 test_ret++;
3914 printf(" %d", n_ctx);
3915 printf(" %d", n_name);
3916 printf("\n");
3917 }
3918 }
3919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003920 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003921#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003922#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003923
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003924 return(test_ret);
3925}
3926
3927
3928static int
3929test_xmlSAX2EndElementNs(void) {
3930 int test_ret = 0;
3931
3932 int mem_base;
3933 void * ctx; /* the user data (XML parser context) */
3934 int n_ctx;
3935 xmlChar * localname; /* the local name of the element */
3936 int n_localname;
3937 xmlChar * prefix; /* the element namespace prefix if available */
3938 int n_prefix;
3939 xmlChar * URI; /* the element namespace name if available */
3940 int n_URI;
3941
3942 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3943 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3944 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3945 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3946 mem_base = xmlMemBlocks();
3947 ctx = gen_void_ptr(n_ctx, 0);
3948 localname = gen_const_xmlChar_ptr(n_localname, 1);
3949 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3950 URI = gen_const_xmlChar_ptr(n_URI, 3);
3951
William M. Brackf13f77f2004-11-12 16:03:48 +00003952 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003953 call_tests++;
3954 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003955 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3956 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3957 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003958 xmlResetLastError();
3959 if (mem_base != xmlMemBlocks()) {
3960 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3961 xmlMemBlocks() - mem_base);
3962 test_ret++;
3963 printf(" %d", n_ctx);
3964 printf(" %d", n_localname);
3965 printf(" %d", n_prefix);
3966 printf(" %d", n_URI);
3967 printf("\n");
3968 }
3969 }
3970 }
3971 }
3972 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003973 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003974
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003975 return(test_ret);
3976}
3977
3978
3979static int
3980test_xmlSAX2EntityDecl(void) {
3981 int test_ret = 0;
3982
3983 int mem_base;
3984 void * ctx; /* the user data (XML parser context) */
3985 int n_ctx;
3986 xmlChar * name; /* the entity name */
3987 int n_name;
3988 int type; /* the entity type */
3989 int n_type;
3990 xmlChar * publicId; /* The public ID of the entity */
3991 int n_publicId;
3992 xmlChar * systemId; /* The system ID of the entity */
3993 int n_systemId;
3994 xmlChar * content; /* the entity value (without processing). */
3995 int n_content;
3996
3997 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3998 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3999 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4000 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4001 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4002 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4003 mem_base = xmlMemBlocks();
4004 ctx = gen_void_ptr(n_ctx, 0);
4005 name = gen_const_xmlChar_ptr(n_name, 1);
4006 type = gen_int(n_type, 2);
4007 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4008 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4009 content = gen_xmlChar_ptr(n_content, 5);
4010
William M. Brackf13f77f2004-11-12 16:03:48 +00004011 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004012 call_tests++;
4013 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004014 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004015 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004016 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4017 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004018 des_xmlChar_ptr(n_content, content, 5);
4019 xmlResetLastError();
4020 if (mem_base != xmlMemBlocks()) {
4021 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4022 xmlMemBlocks() - mem_base);
4023 test_ret++;
4024 printf(" %d", n_ctx);
4025 printf(" %d", n_name);
4026 printf(" %d", n_type);
4027 printf(" %d", n_publicId);
4028 printf(" %d", n_systemId);
4029 printf(" %d", n_content);
4030 printf("\n");
4031 }
4032 }
4033 }
4034 }
4035 }
4036 }
4037 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004039
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004040 return(test_ret);
4041}
4042
4043
4044static int
4045test_xmlSAX2ExternalSubset(void) {
4046 int test_ret = 0;
4047
4048 int mem_base;
4049 void * ctx; /* the user data (XML parser context) */
4050 int n_ctx;
4051 xmlChar * name; /* the root element name */
4052 int n_name;
4053 xmlChar * ExternalID; /* the external ID */
4054 int n_ExternalID;
4055 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4056 int n_SystemID;
4057
4058 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4059 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4060 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4061 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4062 mem_base = xmlMemBlocks();
4063 ctx = gen_void_ptr(n_ctx, 0);
4064 name = gen_const_xmlChar_ptr(n_name, 1);
4065 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4066 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4067
William M. Brackf13f77f2004-11-12 16:03:48 +00004068 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004069 call_tests++;
4070 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004071 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4072 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4073 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004074 xmlResetLastError();
4075 if (mem_base != xmlMemBlocks()) {
4076 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4077 xmlMemBlocks() - mem_base);
4078 test_ret++;
4079 printf(" %d", n_ctx);
4080 printf(" %d", n_name);
4081 printf(" %d", n_ExternalID);
4082 printf(" %d", n_SystemID);
4083 printf("\n");
4084 }
4085 }
4086 }
4087 }
4088 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004089 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004090
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004091 return(test_ret);
4092}
4093
4094
4095static int
4096test_xmlSAX2GetColumnNumber(void) {
4097 int test_ret = 0;
4098
4099 int mem_base;
4100 int ret_val;
4101 void * ctx; /* the user data (XML parser context) */
4102 int n_ctx;
4103
4104 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4105 mem_base = xmlMemBlocks();
4106 ctx = gen_void_ptr(n_ctx, 0);
4107
4108 ret_val = xmlSAX2GetColumnNumber(ctx);
4109 desret_int(ret_val);
4110 call_tests++;
4111 des_void_ptr(n_ctx, ctx, 0);
4112 xmlResetLastError();
4113 if (mem_base != xmlMemBlocks()) {
4114 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4115 xmlMemBlocks() - mem_base);
4116 test_ret++;
4117 printf(" %d", n_ctx);
4118 printf("\n");
4119 }
4120 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004122
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004123 return(test_ret);
4124}
4125
4126
4127static int
4128test_xmlSAX2GetEntity(void) {
4129 int test_ret = 0;
4130
4131 int mem_base;
4132 xmlEntityPtr ret_val;
4133 void * ctx; /* the user data (XML parser context) */
4134 int n_ctx;
4135 xmlChar * name; /* The entity name */
4136 int n_name;
4137
4138 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4139 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4140 mem_base = xmlMemBlocks();
4141 ctx = gen_void_ptr(n_ctx, 0);
4142 name = gen_const_xmlChar_ptr(n_name, 1);
4143
William M. Brackf13f77f2004-11-12 16:03:48 +00004144 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004145 desret_xmlEntityPtr(ret_val);
4146 call_tests++;
4147 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004148 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004149 xmlResetLastError();
4150 if (mem_base != xmlMemBlocks()) {
4151 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4152 xmlMemBlocks() - mem_base);
4153 test_ret++;
4154 printf(" %d", n_ctx);
4155 printf(" %d", n_name);
4156 printf("\n");
4157 }
4158 }
4159 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004161
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004162 return(test_ret);
4163}
4164
4165
4166static int
4167test_xmlSAX2GetLineNumber(void) {
4168 int test_ret = 0;
4169
4170 int mem_base;
4171 int ret_val;
4172 void * ctx; /* the user data (XML parser context) */
4173 int n_ctx;
4174
4175 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4176 mem_base = xmlMemBlocks();
4177 ctx = gen_void_ptr(n_ctx, 0);
4178
4179 ret_val = xmlSAX2GetLineNumber(ctx);
4180 desret_int(ret_val);
4181 call_tests++;
4182 des_void_ptr(n_ctx, ctx, 0);
4183 xmlResetLastError();
4184 if (mem_base != xmlMemBlocks()) {
4185 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4186 xmlMemBlocks() - mem_base);
4187 test_ret++;
4188 printf(" %d", n_ctx);
4189 printf("\n");
4190 }
4191 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004192 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004193
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004194 return(test_ret);
4195}
4196
4197
4198static int
4199test_xmlSAX2GetParameterEntity(void) {
4200 int test_ret = 0;
4201
4202 int mem_base;
4203 xmlEntityPtr ret_val;
4204 void * ctx; /* the user data (XML parser context) */
4205 int n_ctx;
4206 xmlChar * name; /* The entity name */
4207 int n_name;
4208
4209 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4210 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4211 mem_base = xmlMemBlocks();
4212 ctx = gen_void_ptr(n_ctx, 0);
4213 name = gen_const_xmlChar_ptr(n_name, 1);
4214
William M. Brackf13f77f2004-11-12 16:03:48 +00004215 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004216 desret_xmlEntityPtr(ret_val);
4217 call_tests++;
4218 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004219 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004220 xmlResetLastError();
4221 if (mem_base != xmlMemBlocks()) {
4222 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4223 xmlMemBlocks() - mem_base);
4224 test_ret++;
4225 printf(" %d", n_ctx);
4226 printf(" %d", n_name);
4227 printf("\n");
4228 }
4229 }
4230 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004231 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004232
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004233 return(test_ret);
4234}
4235
4236
4237static int
4238test_xmlSAX2GetPublicId(void) {
4239 int test_ret = 0;
4240
4241 int mem_base;
4242 const xmlChar * ret_val;
4243 void * ctx; /* the user data (XML parser context) */
4244 int n_ctx;
4245
4246 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4247 mem_base = xmlMemBlocks();
4248 ctx = gen_void_ptr(n_ctx, 0);
4249
4250 ret_val = xmlSAX2GetPublicId(ctx);
4251 desret_const_xmlChar_ptr(ret_val);
4252 call_tests++;
4253 des_void_ptr(n_ctx, ctx, 0);
4254 xmlResetLastError();
4255 if (mem_base != xmlMemBlocks()) {
4256 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4257 xmlMemBlocks() - mem_base);
4258 test_ret++;
4259 printf(" %d", n_ctx);
4260 printf("\n");
4261 }
4262 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004264
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004265 return(test_ret);
4266}
4267
4268
4269static int
4270test_xmlSAX2GetSystemId(void) {
4271 int test_ret = 0;
4272
4273 int mem_base;
4274 const xmlChar * ret_val;
4275 void * ctx; /* the user data (XML parser context) */
4276 int n_ctx;
4277
4278 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4279 mem_base = xmlMemBlocks();
4280 ctx = gen_void_ptr(n_ctx, 0);
4281
4282 ret_val = xmlSAX2GetSystemId(ctx);
4283 desret_const_xmlChar_ptr(ret_val);
4284 call_tests++;
4285 des_void_ptr(n_ctx, ctx, 0);
4286 xmlResetLastError();
4287 if (mem_base != xmlMemBlocks()) {
4288 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4289 xmlMemBlocks() - mem_base);
4290 test_ret++;
4291 printf(" %d", n_ctx);
4292 printf("\n");
4293 }
4294 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004295 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004296
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004297 return(test_ret);
4298}
4299
4300
4301static int
4302test_xmlSAX2HasExternalSubset(void) {
4303 int test_ret = 0;
4304
4305 int mem_base;
4306 int ret_val;
4307 void * ctx; /* the user data (XML parser context) */
4308 int n_ctx;
4309
4310 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4311 mem_base = xmlMemBlocks();
4312 ctx = gen_void_ptr(n_ctx, 0);
4313
4314 ret_val = xmlSAX2HasExternalSubset(ctx);
4315 desret_int(ret_val);
4316 call_tests++;
4317 des_void_ptr(n_ctx, ctx, 0);
4318 xmlResetLastError();
4319 if (mem_base != xmlMemBlocks()) {
4320 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4321 xmlMemBlocks() - mem_base);
4322 test_ret++;
4323 printf(" %d", n_ctx);
4324 printf("\n");
4325 }
4326 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004327 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004328
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004329 return(test_ret);
4330}
4331
4332
4333static int
4334test_xmlSAX2HasInternalSubset(void) {
4335 int test_ret = 0;
4336
4337 int mem_base;
4338 int ret_val;
4339 void * ctx; /* the user data (XML parser context) */
4340 int n_ctx;
4341
4342 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4343 mem_base = xmlMemBlocks();
4344 ctx = gen_void_ptr(n_ctx, 0);
4345
4346 ret_val = xmlSAX2HasInternalSubset(ctx);
4347 desret_int(ret_val);
4348 call_tests++;
4349 des_void_ptr(n_ctx, ctx, 0);
4350 xmlResetLastError();
4351 if (mem_base != xmlMemBlocks()) {
4352 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4353 xmlMemBlocks() - mem_base);
4354 test_ret++;
4355 printf(" %d", n_ctx);
4356 printf("\n");
4357 }
4358 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004359 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004360
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004361 return(test_ret);
4362}
4363
4364
4365static int
4366test_xmlSAX2IgnorableWhitespace(void) {
4367 int test_ret = 0;
4368
4369 int mem_base;
4370 void * ctx; /* the user data (XML parser context) */
4371 int n_ctx;
4372 xmlChar * ch; /* a xmlChar string */
4373 int n_ch;
4374 int len; /* the number of xmlChar */
4375 int n_len;
4376
4377 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4378 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4379 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4380 mem_base = xmlMemBlocks();
4381 ctx = gen_void_ptr(n_ctx, 0);
4382 ch = gen_const_xmlChar_ptr(n_ch, 1);
4383 len = gen_int(n_len, 2);
4384
William M. Brackf13f77f2004-11-12 16:03:48 +00004385 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004386 call_tests++;
4387 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004388 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004389 des_int(n_len, len, 2);
4390 xmlResetLastError();
4391 if (mem_base != xmlMemBlocks()) {
4392 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4393 xmlMemBlocks() - mem_base);
4394 test_ret++;
4395 printf(" %d", n_ctx);
4396 printf(" %d", n_ch);
4397 printf(" %d", n_len);
4398 printf("\n");
4399 }
4400 }
4401 }
4402 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004403 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004404
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004405 return(test_ret);
4406}
4407
4408
4409#define gen_nb_xmlSAXHandler_ptr 1
4410static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4411 return(NULL);
4412}
4413static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4414}
4415
4416static int
4417test_xmlSAX2InitDefaultSAXHandler(void) {
4418 int test_ret = 0;
4419
4420 int mem_base;
4421 xmlSAXHandler * hdlr; /* the SAX handler */
4422 int n_hdlr;
4423 int warning; /* flag if non-zero sets the handler warning procedure */
4424 int n_warning;
4425
4426 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4427 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4428 mem_base = xmlMemBlocks();
4429 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4430 warning = gen_int(n_warning, 1);
4431
4432 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4433 call_tests++;
4434 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4435 des_int(n_warning, warning, 1);
4436 xmlResetLastError();
4437 if (mem_base != xmlMemBlocks()) {
4438 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4439 xmlMemBlocks() - mem_base);
4440 test_ret++;
4441 printf(" %d", n_hdlr);
4442 printf(" %d", n_warning);
4443 printf("\n");
4444 }
4445 }
4446 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004448
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004449 return(test_ret);
4450}
4451
4452
4453static int
4454test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4455 int test_ret = 0;
4456
William M. Brack21e4ef22005-01-02 09:53:13 +00004457#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004458 int mem_base;
4459 xmlSAXHandler * hdlr; /* the SAX handler */
4460 int n_hdlr;
4461
4462 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4463 mem_base = xmlMemBlocks();
4464 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4465
4466 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4467 call_tests++;
4468 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4469 xmlResetLastError();
4470 if (mem_base != xmlMemBlocks()) {
4471 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4472 xmlMemBlocks() - mem_base);
4473 test_ret++;
4474 printf(" %d", n_hdlr);
4475 printf("\n");
4476 }
4477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004478 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004479#endif
4480
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004481 return(test_ret);
4482}
4483
4484
4485static int
4486test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4487 int test_ret = 0;
4488
William M. Brack21e4ef22005-01-02 09:53:13 +00004489#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004490 int mem_base;
4491 xmlSAXHandler * hdlr; /* the SAX handler */
4492 int n_hdlr;
4493
4494 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4495 mem_base = xmlMemBlocks();
4496 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4497
4498 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4499 call_tests++;
4500 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4501 xmlResetLastError();
4502 if (mem_base != xmlMemBlocks()) {
4503 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4504 xmlMemBlocks() - mem_base);
4505 test_ret++;
4506 printf(" %d", n_hdlr);
4507 printf("\n");
4508 }
4509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004510 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004511#endif
4512
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004513 return(test_ret);
4514}
4515
4516
4517static int
4518test_xmlSAX2InternalSubset(void) {
4519 int test_ret = 0;
4520
4521 int mem_base;
4522 void * ctx; /* the user data (XML parser context) */
4523 int n_ctx;
4524 xmlChar * name; /* the root element name */
4525 int n_name;
4526 xmlChar * ExternalID; /* the external ID */
4527 int n_ExternalID;
4528 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4529 int n_SystemID;
4530
4531 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4532 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4533 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4534 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4535 mem_base = xmlMemBlocks();
4536 ctx = gen_void_ptr(n_ctx, 0);
4537 name = gen_const_xmlChar_ptr(n_name, 1);
4538 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4539 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4540
William M. Brackf13f77f2004-11-12 16:03:48 +00004541 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004542 call_tests++;
4543 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004544 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4545 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4546 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004547 xmlResetLastError();
4548 if (mem_base != xmlMemBlocks()) {
4549 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4550 xmlMemBlocks() - mem_base);
4551 test_ret++;
4552 printf(" %d", n_ctx);
4553 printf(" %d", n_name);
4554 printf(" %d", n_ExternalID);
4555 printf(" %d", n_SystemID);
4556 printf("\n");
4557 }
4558 }
4559 }
4560 }
4561 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004562 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004563
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004564 return(test_ret);
4565}
4566
4567
4568static int
4569test_xmlSAX2IsStandalone(void) {
4570 int test_ret = 0;
4571
4572 int mem_base;
4573 int ret_val;
4574 void * ctx; /* the user data (XML parser context) */
4575 int n_ctx;
4576
4577 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4578 mem_base = xmlMemBlocks();
4579 ctx = gen_void_ptr(n_ctx, 0);
4580
4581 ret_val = xmlSAX2IsStandalone(ctx);
4582 desret_int(ret_val);
4583 call_tests++;
4584 des_void_ptr(n_ctx, ctx, 0);
4585 xmlResetLastError();
4586 if (mem_base != xmlMemBlocks()) {
4587 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4588 xmlMemBlocks() - mem_base);
4589 test_ret++;
4590 printf(" %d", n_ctx);
4591 printf("\n");
4592 }
4593 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004595
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004596 return(test_ret);
4597}
4598
4599
4600static int
4601test_xmlSAX2NotationDecl(void) {
4602 int test_ret = 0;
4603
4604 int mem_base;
4605 void * ctx; /* the user data (XML parser context) */
4606 int n_ctx;
4607 xmlChar * name; /* The name of the notation */
4608 int n_name;
4609 xmlChar * publicId; /* The public ID of the entity */
4610 int n_publicId;
4611 xmlChar * systemId; /* The system ID of the entity */
4612 int n_systemId;
4613
4614 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4615 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4616 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4617 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4618 mem_base = xmlMemBlocks();
4619 ctx = gen_void_ptr(n_ctx, 0);
4620 name = gen_const_xmlChar_ptr(n_name, 1);
4621 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4622 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4623
William M. Brackf13f77f2004-11-12 16:03:48 +00004624 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004625 call_tests++;
4626 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004627 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4628 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4629 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004630 xmlResetLastError();
4631 if (mem_base != xmlMemBlocks()) {
4632 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4633 xmlMemBlocks() - mem_base);
4634 test_ret++;
4635 printf(" %d", n_ctx);
4636 printf(" %d", n_name);
4637 printf(" %d", n_publicId);
4638 printf(" %d", n_systemId);
4639 printf("\n");
4640 }
4641 }
4642 }
4643 }
4644 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004645 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004646
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004647 return(test_ret);
4648}
4649
4650
4651static int
4652test_xmlSAX2ProcessingInstruction(void) {
4653 int test_ret = 0;
4654
4655 int mem_base;
4656 void * ctx; /* the user data (XML parser context) */
4657 int n_ctx;
4658 xmlChar * target; /* the target name */
4659 int n_target;
4660 xmlChar * data; /* the PI data's */
4661 int n_data;
4662
4663 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4664 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4665 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4666 mem_base = xmlMemBlocks();
4667 ctx = gen_void_ptr(n_ctx, 0);
4668 target = gen_const_xmlChar_ptr(n_target, 1);
4669 data = gen_const_xmlChar_ptr(n_data, 2);
4670
William M. Brackf13f77f2004-11-12 16:03:48 +00004671 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004672 call_tests++;
4673 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004674 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4675 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004676 xmlResetLastError();
4677 if (mem_base != xmlMemBlocks()) {
4678 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4679 xmlMemBlocks() - mem_base);
4680 test_ret++;
4681 printf(" %d", n_ctx);
4682 printf(" %d", n_target);
4683 printf(" %d", n_data);
4684 printf("\n");
4685 }
4686 }
4687 }
4688 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004689 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004690
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 return(test_ret);
4692}
4693
4694
4695static int
4696test_xmlSAX2Reference(void) {
4697 int test_ret = 0;
4698
4699 int mem_base;
4700 void * ctx; /* the user data (XML parser context) */
4701 int n_ctx;
4702 xmlChar * name; /* The entity name */
4703 int n_name;
4704
4705 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4706 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4707 mem_base = xmlMemBlocks();
4708 ctx = gen_void_ptr(n_ctx, 0);
4709 name = gen_const_xmlChar_ptr(n_name, 1);
4710
William M. Brackf13f77f2004-11-12 16:03:48 +00004711 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004712 call_tests++;
4713 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004714 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004715 xmlResetLastError();
4716 if (mem_base != xmlMemBlocks()) {
4717 printf("Leak of %d blocks found in xmlSAX2Reference",
4718 xmlMemBlocks() - mem_base);
4719 test_ret++;
4720 printf(" %d", n_ctx);
4721 printf(" %d", n_name);
4722 printf("\n");
4723 }
4724 }
4725 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004726 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004727
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004728 return(test_ret);
4729}
4730
4731
4732static int
4733test_xmlSAX2ResolveEntity(void) {
4734 int test_ret = 0;
4735
4736 int mem_base;
4737 xmlParserInputPtr ret_val;
4738 void * ctx; /* the user data (XML parser context) */
4739 int n_ctx;
4740 xmlChar * publicId; /* The public ID of the entity */
4741 int n_publicId;
4742 xmlChar * systemId; /* The system ID of the entity */
4743 int n_systemId;
4744
4745 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4746 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4747 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4748 mem_base = xmlMemBlocks();
4749 ctx = gen_void_ptr(n_ctx, 0);
4750 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4751 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4752
William M. Brackf13f77f2004-11-12 16:03:48 +00004753 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004754 desret_xmlParserInputPtr(ret_val);
4755 call_tests++;
4756 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004757 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4758 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004759 xmlResetLastError();
4760 if (mem_base != xmlMemBlocks()) {
4761 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4762 xmlMemBlocks() - mem_base);
4763 test_ret++;
4764 printf(" %d", n_ctx);
4765 printf(" %d", n_publicId);
4766 printf(" %d", n_systemId);
4767 printf("\n");
4768 }
4769 }
4770 }
4771 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004773
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004774 return(test_ret);
4775}
4776
4777
4778#define gen_nb_xmlSAXLocatorPtr 1
4779static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4780 return(NULL);
4781}
4782static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4783}
4784
4785static int
4786test_xmlSAX2SetDocumentLocator(void) {
4787 int test_ret = 0;
4788
4789 int mem_base;
4790 void * ctx; /* the user data (XML parser context) */
4791 int n_ctx;
4792 xmlSAXLocatorPtr loc; /* A SAX Locator */
4793 int n_loc;
4794
4795 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4796 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4797 mem_base = xmlMemBlocks();
4798 ctx = gen_void_ptr(n_ctx, 0);
4799 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4800
4801 xmlSAX2SetDocumentLocator(ctx, loc);
4802 call_tests++;
4803 des_void_ptr(n_ctx, ctx, 0);
4804 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4805 xmlResetLastError();
4806 if (mem_base != xmlMemBlocks()) {
4807 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4808 xmlMemBlocks() - mem_base);
4809 test_ret++;
4810 printf(" %d", n_ctx);
4811 printf(" %d", n_loc);
4812 printf("\n");
4813 }
4814 }
4815 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004817
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004818 return(test_ret);
4819}
4820
4821
4822static int
4823test_xmlSAX2StartDocument(void) {
4824 int test_ret = 0;
4825
4826 int mem_base;
4827 void * ctx; /* the user data (XML parser context) */
4828 int n_ctx;
4829
4830 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4831 mem_base = xmlMemBlocks();
4832 ctx = gen_void_ptr(n_ctx, 0);
4833
4834 xmlSAX2StartDocument(ctx);
4835 call_tests++;
4836 des_void_ptr(n_ctx, ctx, 0);
4837 xmlResetLastError();
4838 if (mem_base != xmlMemBlocks()) {
4839 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4840 xmlMemBlocks() - mem_base);
4841 test_ret++;
4842 printf(" %d", n_ctx);
4843 printf("\n");
4844 }
4845 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004846 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004847
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004848 return(test_ret);
4849}
4850
4851
4852static int
4853test_xmlSAX2StartElement(void) {
4854 int test_ret = 0;
4855
William M. Brack21e4ef22005-01-02 09:53:13 +00004856#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004857#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004858 int mem_base;
4859 void * ctx; /* the user data (XML parser context) */
4860 int n_ctx;
4861 xmlChar * fullname; /* The element name, including namespace prefix */
4862 int n_fullname;
4863 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4864 int n_atts;
4865
4866 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4867 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4868 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4869 mem_base = xmlMemBlocks();
4870 ctx = gen_void_ptr(n_ctx, 0);
4871 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4872 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4873
William M. Brackf13f77f2004-11-12 16:03:48 +00004874 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004875 call_tests++;
4876 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004877 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4878 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004879 xmlResetLastError();
4880 if (mem_base != xmlMemBlocks()) {
4881 printf("Leak of %d blocks found in xmlSAX2StartElement",
4882 xmlMemBlocks() - mem_base);
4883 test_ret++;
4884 printf(" %d", n_ctx);
4885 printf(" %d", n_fullname);
4886 printf(" %d", n_atts);
4887 printf("\n");
4888 }
4889 }
4890 }
4891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004892 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004893#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004894#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004895
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004896 return(test_ret);
4897}
4898
4899
4900static int
4901test_xmlSAX2StartElementNs(void) {
4902 int test_ret = 0;
4903
4904 int mem_base;
4905 void * ctx; /* the user data (XML parser context) */
4906 int n_ctx;
4907 xmlChar * localname; /* the local name of the element */
4908 int n_localname;
4909 xmlChar * prefix; /* the element namespace prefix if available */
4910 int n_prefix;
4911 xmlChar * URI; /* the element namespace name if available */
4912 int n_URI;
4913 int nb_namespaces; /* number of namespace definitions on that node */
4914 int n_nb_namespaces;
4915 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4916 int n_namespaces;
4917 int nb_attributes; /* the number of attributes on that node */
4918 int n_nb_attributes;
4919 int nb_defaulted; /* the number of defaulted attributes. */
4920 int n_nb_defaulted;
4921 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4922 int n_attributes;
4923
4924 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4925 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4926 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4927 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4928 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4929 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4930 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4931 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4932 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4933 mem_base = xmlMemBlocks();
4934 ctx = gen_void_ptr(n_ctx, 0);
4935 localname = gen_const_xmlChar_ptr(n_localname, 1);
4936 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4937 URI = gen_const_xmlChar_ptr(n_URI, 3);
4938 nb_namespaces = gen_int(n_nb_namespaces, 4);
4939 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4940 nb_attributes = gen_int(n_nb_attributes, 6);
4941 nb_defaulted = gen_int(n_nb_defaulted, 7);
4942 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4943
William M. Brackf13f77f2004-11-12 16:03:48 +00004944 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 +00004945 call_tests++;
4946 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004947 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4948 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4949 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004950 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004951 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004952 des_int(n_nb_attributes, nb_attributes, 6);
4953 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004954 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004955 xmlResetLastError();
4956 if (mem_base != xmlMemBlocks()) {
4957 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4958 xmlMemBlocks() - mem_base);
4959 test_ret++;
4960 printf(" %d", n_ctx);
4961 printf(" %d", n_localname);
4962 printf(" %d", n_prefix);
4963 printf(" %d", n_URI);
4964 printf(" %d", n_nb_namespaces);
4965 printf(" %d", n_namespaces);
4966 printf(" %d", n_nb_attributes);
4967 printf(" %d", n_nb_defaulted);
4968 printf(" %d", n_attributes);
4969 printf("\n");
4970 }
4971 }
4972 }
4973 }
4974 }
4975 }
4976 }
4977 }
4978 }
4979 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004980 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004981
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004982 return(test_ret);
4983}
4984
4985
4986static int
4987test_xmlSAX2UnparsedEntityDecl(void) {
4988 int test_ret = 0;
4989
4990 int mem_base;
4991 void * ctx; /* the user data (XML parser context) */
4992 int n_ctx;
4993 xmlChar * name; /* The name of the entity */
4994 int n_name;
4995 xmlChar * publicId; /* The public ID of the entity */
4996 int n_publicId;
4997 xmlChar * systemId; /* The system ID of the entity */
4998 int n_systemId;
4999 xmlChar * notationName; /* the name of the notation */
5000 int n_notationName;
5001
5002 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5003 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5004 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5005 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5006 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5007 mem_base = xmlMemBlocks();
5008 ctx = gen_void_ptr(n_ctx, 0);
5009 name = gen_const_xmlChar_ptr(n_name, 1);
5010 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5011 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5012 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5013
William M. Brackf13f77f2004-11-12 16:03:48 +00005014 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005015 call_tests++;
5016 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005017 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5018 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5019 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5020 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005021 xmlResetLastError();
5022 if (mem_base != xmlMemBlocks()) {
5023 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5024 xmlMemBlocks() - mem_base);
5025 test_ret++;
5026 printf(" %d", n_ctx);
5027 printf(" %d", n_name);
5028 printf(" %d", n_publicId);
5029 printf(" %d", n_systemId);
5030 printf(" %d", n_notationName);
5031 printf("\n");
5032 }
5033 }
5034 }
5035 }
5036 }
5037 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005039
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005040 return(test_ret);
5041}
5042
5043
5044static int
5045test_xmlSAXDefaultVersion(void) {
5046 int test_ret = 0;
5047
William M. Brack21e4ef22005-01-02 09:53:13 +00005048#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005049#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005050 int mem_base;
5051 int ret_val;
5052 int version; /* the version, 1 or 2 */
5053 int n_version;
5054
5055 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5056 mem_base = xmlMemBlocks();
5057 version = gen_int(n_version, 0);
5058
5059 ret_val = xmlSAXDefaultVersion(version);
5060 desret_int(ret_val);
5061 call_tests++;
5062 des_int(n_version, version, 0);
5063 xmlResetLastError();
5064 if (mem_base != xmlMemBlocks()) {
5065 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5066 xmlMemBlocks() - mem_base);
5067 test_ret++;
5068 printf(" %d", n_version);
5069 printf("\n");
5070 }
5071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005072 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005073#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005074#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005075
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005076 return(test_ret);
5077}
5078
5079
5080static int
5081test_xmlSAXVersion(void) {
5082 int test_ret = 0;
5083
5084 int mem_base;
5085 int ret_val;
5086 xmlSAXHandler * hdlr; /* the SAX handler */
5087 int n_hdlr;
5088 int version; /* the version, 1 or 2 */
5089 int n_version;
5090
5091 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5092 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5093 mem_base = xmlMemBlocks();
5094 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5095 version = gen_int(n_version, 1);
5096
5097 ret_val = xmlSAXVersion(hdlr, version);
5098 desret_int(ret_val);
5099 call_tests++;
5100 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5101 des_int(n_version, version, 1);
5102 xmlResetLastError();
5103 if (mem_base != xmlMemBlocks()) {
5104 printf("Leak of %d blocks found in xmlSAXVersion",
5105 xmlMemBlocks() - mem_base);
5106 test_ret++;
5107 printf(" %d", n_hdlr);
5108 printf(" %d", n_version);
5109 printf("\n");
5110 }
5111 }
5112 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005114
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005115 return(test_ret);
5116}
5117
5118static int
5119test_SAX2(void) {
5120 int test_ret = 0;
5121
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005122 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005123 test_ret += test_docbDefaultSAXHandlerInit();
5124 test_ret += test_htmlDefaultSAXHandlerInit();
5125 test_ret += test_xmlDefaultSAXHandlerInit();
5126 test_ret += test_xmlSAX2AttributeDecl();
5127 test_ret += test_xmlSAX2CDataBlock();
5128 test_ret += test_xmlSAX2Characters();
5129 test_ret += test_xmlSAX2Comment();
5130 test_ret += test_xmlSAX2ElementDecl();
5131 test_ret += test_xmlSAX2EndDocument();
5132 test_ret += test_xmlSAX2EndElement();
5133 test_ret += test_xmlSAX2EndElementNs();
5134 test_ret += test_xmlSAX2EntityDecl();
5135 test_ret += test_xmlSAX2ExternalSubset();
5136 test_ret += test_xmlSAX2GetColumnNumber();
5137 test_ret += test_xmlSAX2GetEntity();
5138 test_ret += test_xmlSAX2GetLineNumber();
5139 test_ret += test_xmlSAX2GetParameterEntity();
5140 test_ret += test_xmlSAX2GetPublicId();
5141 test_ret += test_xmlSAX2GetSystemId();
5142 test_ret += test_xmlSAX2HasExternalSubset();
5143 test_ret += test_xmlSAX2HasInternalSubset();
5144 test_ret += test_xmlSAX2IgnorableWhitespace();
5145 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5146 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5147 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5148 test_ret += test_xmlSAX2InternalSubset();
5149 test_ret += test_xmlSAX2IsStandalone();
5150 test_ret += test_xmlSAX2NotationDecl();
5151 test_ret += test_xmlSAX2ProcessingInstruction();
5152 test_ret += test_xmlSAX2Reference();
5153 test_ret += test_xmlSAX2ResolveEntity();
5154 test_ret += test_xmlSAX2SetDocumentLocator();
5155 test_ret += test_xmlSAX2StartDocument();
5156 test_ret += test_xmlSAX2StartElement();
5157 test_ret += test_xmlSAX2StartElementNs();
5158 test_ret += test_xmlSAX2UnparsedEntityDecl();
5159 test_ret += test_xmlSAXDefaultVersion();
5160 test_ret += test_xmlSAXVersion();
5161
5162 if (test_ret != 0)
5163 printf("Module SAX2: %d errors\n", test_ret);
5164 return(test_ret);
5165}
5166
Daniel Veillarda82b1822004-11-08 16:24:57 +00005167static int
5168test_xmlC14NDocDumpMemory(void) {
5169 int test_ret = 0;
5170
William M. Brack21e4ef22005-01-02 09:53:13 +00005171#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005172 int mem_base;
5173 int ret_val;
5174 xmlDocPtr doc; /* the XML document for canonization */
5175 int n_doc;
5176 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5177 int n_nodes;
5178 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5179 int n_exclusive;
5180 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) */
5181 int n_inclusive_ns_prefixes;
5182 int with_comments; /* include comments in the result (!=0) or not (==0) */
5183 int n_with_comments;
5184 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 */
5185 int n_doc_txt_ptr;
5186
5187 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5188 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5189 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5190 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5191 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5192 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5193 mem_base = xmlMemBlocks();
5194 doc = gen_xmlDocPtr(n_doc, 0);
5195 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5196 exclusive = gen_int(n_exclusive, 2);
5197 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5198 with_comments = gen_int(n_with_comments, 4);
5199 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5200
5201 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5202 desret_int(ret_val);
5203 call_tests++;
5204 des_xmlDocPtr(n_doc, doc, 0);
5205 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5206 des_int(n_exclusive, exclusive, 2);
5207 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5208 des_int(n_with_comments, with_comments, 4);
5209 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5210 xmlResetLastError();
5211 if (mem_base != xmlMemBlocks()) {
5212 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5213 xmlMemBlocks() - mem_base);
5214 test_ret++;
5215 printf(" %d", n_doc);
5216 printf(" %d", n_nodes);
5217 printf(" %d", n_exclusive);
5218 printf(" %d", n_inclusive_ns_prefixes);
5219 printf(" %d", n_with_comments);
5220 printf(" %d", n_doc_txt_ptr);
5221 printf("\n");
5222 }
5223 }
5224 }
5225 }
5226 }
5227 }
5228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005229 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005230#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005231
Daniel Veillarda82b1822004-11-08 16:24:57 +00005232 return(test_ret);
5233}
5234
5235
5236static int
5237test_xmlC14NDocSave(void) {
5238 int test_ret = 0;
5239
William M. Brack21e4ef22005-01-02 09:53:13 +00005240#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005241 int mem_base;
5242 int ret_val;
5243 xmlDocPtr doc; /* the XML document for canonization */
5244 int n_doc;
5245 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5246 int n_nodes;
5247 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5248 int n_exclusive;
5249 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) */
5250 int n_inclusive_ns_prefixes;
5251 int with_comments; /* include comments in the result (!=0) or not (==0) */
5252 int n_with_comments;
5253 const char * filename; /* the filename to store canonical XML image */
5254 int n_filename;
5255 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5256 int n_compression;
5257
5258 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5259 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5260 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5261 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5262 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5263 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5264 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5265 mem_base = xmlMemBlocks();
5266 doc = gen_xmlDocPtr(n_doc, 0);
5267 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5268 exclusive = gen_int(n_exclusive, 2);
5269 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5270 with_comments = gen_int(n_with_comments, 4);
5271 filename = gen_fileoutput(n_filename, 5);
5272 compression = gen_int(n_compression, 6);
5273
5274 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5275 desret_int(ret_val);
5276 call_tests++;
5277 des_xmlDocPtr(n_doc, doc, 0);
5278 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5279 des_int(n_exclusive, exclusive, 2);
5280 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5281 des_int(n_with_comments, with_comments, 4);
5282 des_fileoutput(n_filename, filename, 5);
5283 des_int(n_compression, compression, 6);
5284 xmlResetLastError();
5285 if (mem_base != xmlMemBlocks()) {
5286 printf("Leak of %d blocks found in xmlC14NDocSave",
5287 xmlMemBlocks() - mem_base);
5288 test_ret++;
5289 printf(" %d", n_doc);
5290 printf(" %d", n_nodes);
5291 printf(" %d", n_exclusive);
5292 printf(" %d", n_inclusive_ns_prefixes);
5293 printf(" %d", n_with_comments);
5294 printf(" %d", n_filename);
5295 printf(" %d", n_compression);
5296 printf("\n");
5297 }
5298 }
5299 }
5300 }
5301 }
5302 }
5303 }
5304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005305 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005306#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005307
Daniel Veillarda82b1822004-11-08 16:24:57 +00005308 return(test_ret);
5309}
5310
5311
5312static int
5313test_xmlC14NDocSaveTo(void) {
5314 int test_ret = 0;
5315
William M. Brack21e4ef22005-01-02 09:53:13 +00005316#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005317 int mem_base;
5318 int ret_val;
5319 xmlDocPtr doc; /* the XML document for canonization */
5320 int n_doc;
5321 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5322 int n_nodes;
5323 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5324 int n_exclusive;
5325 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) */
5326 int n_inclusive_ns_prefixes;
5327 int with_comments; /* include comments in the result (!=0) or not (==0) */
5328 int n_with_comments;
5329 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5330 int n_buf;
5331
5332 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5333 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5334 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5335 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5336 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5337 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5338 mem_base = xmlMemBlocks();
5339 doc = gen_xmlDocPtr(n_doc, 0);
5340 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5341 exclusive = gen_int(n_exclusive, 2);
5342 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5343 with_comments = gen_int(n_with_comments, 4);
5344 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5345
5346 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5347 desret_int(ret_val);
5348 call_tests++;
5349 des_xmlDocPtr(n_doc, doc, 0);
5350 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5351 des_int(n_exclusive, exclusive, 2);
5352 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5353 des_int(n_with_comments, with_comments, 4);
5354 des_xmlOutputBufferPtr(n_buf, buf, 5);
5355 xmlResetLastError();
5356 if (mem_base != xmlMemBlocks()) {
5357 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5358 xmlMemBlocks() - mem_base);
5359 test_ret++;
5360 printf(" %d", n_doc);
5361 printf(" %d", n_nodes);
5362 printf(" %d", n_exclusive);
5363 printf(" %d", n_inclusive_ns_prefixes);
5364 printf(" %d", n_with_comments);
5365 printf(" %d", n_buf);
5366 printf("\n");
5367 }
5368 }
5369 }
5370 }
5371 }
5372 }
5373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005374 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005375#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005376
Daniel Veillarda82b1822004-11-08 16:24:57 +00005377 return(test_ret);
5378}
5379
5380
5381static int
5382test_xmlC14NExecute(void) {
5383 int test_ret = 0;
5384
5385
5386 /* missing type support */
5387 return(test_ret);
5388}
5389
5390static int
5391test_c14n(void) {
5392 int test_ret = 0;
5393
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005394 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005395 test_ret += test_xmlC14NDocDumpMemory();
5396 test_ret += test_xmlC14NDocSave();
5397 test_ret += test_xmlC14NDocSaveTo();
5398 test_ret += test_xmlC14NExecute();
5399
5400 if (test_ret != 0)
5401 printf("Module c14n: %d errors\n", test_ret);
5402 return(test_ret);
5403}
Daniel Veillarda521d282004-11-09 14:59:59 +00005404#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005405
Daniel Veillardce682bc2004-11-05 17:22:25 +00005406#define gen_nb_xmlCatalogPtr 1
5407static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5408 return(NULL);
5409}
5410static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5411}
Daniel Veillarda521d282004-11-09 14:59:59 +00005412#endif
5413
Daniel Veillardce682bc2004-11-05 17:22:25 +00005414
Daniel Veillardd93f6252004-11-02 15:53:51 +00005415static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005416test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005418
William M. Brack21e4ef22005-01-02 09:53:13 +00005419#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005420 int mem_base;
5421 int ret_val;
5422 xmlCatalogPtr catal; /* a Catalog */
5423 int n_catal;
5424 xmlChar * type; /* the type of record to add to the catalog */
5425 int n_type;
5426 xmlChar * orig; /* the system, public or prefix to match */
5427 int n_orig;
5428 xmlChar * replace; /* the replacement value for the match */
5429 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430
Daniel Veillardce682bc2004-11-05 17:22:25 +00005431 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5432 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5433 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5434 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5435 mem_base = xmlMemBlocks();
5436 catal = gen_xmlCatalogPtr(n_catal, 0);
5437 type = gen_const_xmlChar_ptr(n_type, 1);
5438 orig = gen_const_xmlChar_ptr(n_orig, 2);
5439 replace = gen_const_xmlChar_ptr(n_replace, 3);
5440
William M. Brackf13f77f2004-11-12 16:03:48 +00005441 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005442 desret_int(ret_val);
5443 call_tests++;
5444 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005445 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5446 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5447 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005448 xmlResetLastError();
5449 if (mem_base != xmlMemBlocks()) {
5450 printf("Leak of %d blocks found in xmlACatalogAdd",
5451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005453 printf(" %d", n_catal);
5454 printf(" %d", n_type);
5455 printf(" %d", n_orig);
5456 printf(" %d", n_replace);
5457 printf("\n");
5458 }
5459 }
5460 }
5461 }
5462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005463 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005464#endif
5465
Daniel Veillard42595322004-11-08 10:52:06 +00005466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005467}
5468
5469
5470static int
5471test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005473
William M. Brack21e4ef22005-01-02 09:53:13 +00005474#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005475 int mem_base;
5476 xmlCatalogPtr catal; /* a Catalog */
5477 int n_catal;
5478 FILE * out; /* the file. */
5479 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005480
Daniel Veillardce682bc2004-11-05 17:22:25 +00005481 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5482 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5483 mem_base = xmlMemBlocks();
5484 catal = gen_xmlCatalogPtr(n_catal, 0);
5485 out = gen_FILE_ptr(n_out, 1);
5486
5487 xmlACatalogDump(catal, out);
5488 call_tests++;
5489 des_xmlCatalogPtr(n_catal, catal, 0);
5490 des_FILE_ptr(n_out, out, 1);
5491 xmlResetLastError();
5492 if (mem_base != xmlMemBlocks()) {
5493 printf("Leak of %d blocks found in xmlACatalogDump",
5494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005495 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005496 printf(" %d", n_catal);
5497 printf(" %d", n_out);
5498 printf("\n");
5499 }
5500 }
5501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005502 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005503#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005504
Daniel Veillard42595322004-11-08 10:52:06 +00005505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005506}
5507
5508
5509static int
5510test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005512
William M. Brack21e4ef22005-01-02 09:53:13 +00005513#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005514 int mem_base;
5515 int ret_val;
5516 xmlCatalogPtr catal; /* a Catalog */
5517 int n_catal;
5518 xmlChar * value; /* the value to remove */
5519 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005520
Daniel Veillardce682bc2004-11-05 17:22:25 +00005521 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5522 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5523 mem_base = xmlMemBlocks();
5524 catal = gen_xmlCatalogPtr(n_catal, 0);
5525 value = gen_const_xmlChar_ptr(n_value, 1);
5526
William M. Brackf13f77f2004-11-12 16:03:48 +00005527 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005528 desret_int(ret_val);
5529 call_tests++;
5530 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005531 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005532 xmlResetLastError();
5533 if (mem_base != xmlMemBlocks()) {
5534 printf("Leak of %d blocks found in xmlACatalogRemove",
5535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005536 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005537 printf(" %d", n_catal);
5538 printf(" %d", n_value);
5539 printf("\n");
5540 }
5541 }
5542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005543 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005544#endif
5545
Daniel Veillard42595322004-11-08 10:52:06 +00005546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005547}
5548
5549
5550static int
5551test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005553
William M. Brack21e4ef22005-01-02 09:53:13 +00005554#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005555 int mem_base;
5556 xmlChar * ret_val;
5557 xmlCatalogPtr catal; /* a Catalog */
5558 int n_catal;
5559 xmlChar * pubID; /* the public ID string */
5560 int n_pubID;
5561 xmlChar * sysID; /* the system ID string */
5562 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005563
Daniel Veillardce682bc2004-11-05 17:22:25 +00005564 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5565 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5566 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5567 mem_base = xmlMemBlocks();
5568 catal = gen_xmlCatalogPtr(n_catal, 0);
5569 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5570 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5571
William M. Brackf13f77f2004-11-12 16:03:48 +00005572 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005573 desret_xmlChar_ptr(ret_val);
5574 call_tests++;
5575 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005576 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5577 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005578 xmlResetLastError();
5579 if (mem_base != xmlMemBlocks()) {
5580 printf("Leak of %d blocks found in xmlACatalogResolve",
5581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005583 printf(" %d", n_catal);
5584 printf(" %d", n_pubID);
5585 printf(" %d", n_sysID);
5586 printf("\n");
5587 }
5588 }
5589 }
5590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005591 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005592#endif
5593
Daniel Veillard42595322004-11-08 10:52:06 +00005594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005595}
5596
5597
5598static int
5599test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005600 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005601
William M. Brack21e4ef22005-01-02 09:53:13 +00005602#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005603 int mem_base;
5604 xmlChar * ret_val;
5605 xmlCatalogPtr catal; /* a Catalog */
5606 int n_catal;
5607 xmlChar * pubID; /* the public ID string */
5608 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005609
Daniel Veillardce682bc2004-11-05 17:22:25 +00005610 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5611 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5612 mem_base = xmlMemBlocks();
5613 catal = gen_xmlCatalogPtr(n_catal, 0);
5614 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5615
William M. Brackf13f77f2004-11-12 16:03:48 +00005616 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005617 desret_xmlChar_ptr(ret_val);
5618 call_tests++;
5619 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005620 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005621 xmlResetLastError();
5622 if (mem_base != xmlMemBlocks()) {
5623 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005625 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005626 printf(" %d", n_catal);
5627 printf(" %d", n_pubID);
5628 printf("\n");
5629 }
5630 }
5631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005632 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005633#endif
5634
Daniel Veillard42595322004-11-08 10:52:06 +00005635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005636}
5637
5638
5639static int
5640test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005642
William M. Brack21e4ef22005-01-02 09:53:13 +00005643#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005644 int mem_base;
5645 xmlChar * ret_val;
5646 xmlCatalogPtr catal; /* a Catalog */
5647 int n_catal;
5648 xmlChar * sysID; /* the system ID string */
5649 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005650
Daniel Veillardce682bc2004-11-05 17:22:25 +00005651 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5652 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5653 mem_base = xmlMemBlocks();
5654 catal = gen_xmlCatalogPtr(n_catal, 0);
5655 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5656
William M. Brackf13f77f2004-11-12 16:03:48 +00005657 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005658 desret_xmlChar_ptr(ret_val);
5659 call_tests++;
5660 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005661 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005662 xmlResetLastError();
5663 if (mem_base != xmlMemBlocks()) {
5664 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005667 printf(" %d", n_catal);
5668 printf(" %d", n_sysID);
5669 printf("\n");
5670 }
5671 }
5672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005673 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005674#endif
5675
Daniel Veillard42595322004-11-08 10:52:06 +00005676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005677}
5678
5679
5680static int
5681test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005683
William M. Brack21e4ef22005-01-02 09:53:13 +00005684#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005685 int mem_base;
5686 xmlChar * ret_val;
5687 xmlCatalogPtr catal; /* a Catalog */
5688 int n_catal;
5689 xmlChar * URI; /* the URI */
5690 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005691
Daniel Veillardce682bc2004-11-05 17:22:25 +00005692 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5693 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5694 mem_base = xmlMemBlocks();
5695 catal = gen_xmlCatalogPtr(n_catal, 0);
5696 URI = gen_const_xmlChar_ptr(n_URI, 1);
5697
William M. Brackf13f77f2004-11-12 16:03:48 +00005698 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005699 desret_xmlChar_ptr(ret_val);
5700 call_tests++;
5701 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005702 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005703 xmlResetLastError();
5704 if (mem_base != xmlMemBlocks()) {
5705 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005707 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005708 printf(" %d", n_catal);
5709 printf(" %d", n_URI);
5710 printf("\n");
5711 }
5712 }
5713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005714 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005715#endif
5716
Daniel Veillard42595322004-11-08 10:52:06 +00005717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005718}
5719
5720
5721static int
5722test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005724
William M. Brack21e4ef22005-01-02 09:53:13 +00005725#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005726 int mem_base;
5727 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005728 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005729 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005730 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005731 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005732 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733 int n_replace;
5734
5735 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5736 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5737 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005739 type = gen_const_xmlChar_ptr(n_type, 0);
5740 orig = gen_const_xmlChar_ptr(n_orig, 1);
5741 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005742
William M. Brackf13f77f2004-11-12 16:03:48 +00005743 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744 desret_int(ret_val);
5745 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005746 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5747 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5748 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005749 xmlResetLastError();
5750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005751 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005754 printf(" %d", n_type);
5755 printf(" %d", n_orig);
5756 printf(" %d", n_replace);
5757 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005758 }
5759 }
5760 }
5761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005762 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005763#endif
5764
Daniel Veillard42595322004-11-08 10:52:06 +00005765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005766}
5767
5768
5769static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005770test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005772
William M. Brack21e4ef22005-01-02 09:53:13 +00005773#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005774
Daniel Veillardd93f6252004-11-02 15:53:51 +00005775
5776 xmlCatalogCleanup();
5777 call_tests++;
5778 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005779 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005780#endif
5781
Daniel Veillard42595322004-11-08 10:52:06 +00005782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005783}
5784
5785
5786static int
5787test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
William M. Brack21e4ef22005-01-02 09:53:13 +00005790#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005791 int ret_val;
5792
5793
5794 ret_val = xmlCatalogConvert();
5795 desret_int(ret_val);
5796 call_tests++;
5797 xmlResetLastError();
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
5806test_xmlCatalogDump(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) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005810 int mem_base;
5811 FILE * out; /* the file. */
5812 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005814 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5815 mem_base = xmlMemBlocks();
5816 out = gen_FILE_ptr(n_out, 0);
5817
5818 xmlCatalogDump(out);
5819 call_tests++;
5820 des_FILE_ptr(n_out, out, 0);
5821 xmlResetLastError();
5822 if (mem_base != xmlMemBlocks()) {
5823 printf("Leak of %d blocks found in xmlCatalogDump",
5824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005825 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005826 printf(" %d", n_out);
5827 printf("\n");
5828 }
5829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005830 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005831#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005832
Daniel Veillard42595322004-11-08 10:52:06 +00005833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005834}
5835
5836
5837static int
5838test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005840
William M. Brack21e4ef22005-01-02 09:53:13 +00005841#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005842 int mem_base;
5843 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844
Daniel Veillard57b25162004-11-06 14:50:18 +00005845 mem_base = xmlMemBlocks();
5846
5847 ret_val = xmlCatalogGetDefaults();
5848 desret_xmlCatalogAllow(ret_val);
5849 call_tests++;
5850 xmlResetLastError();
5851 if (mem_base != xmlMemBlocks()) {
5852 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005854 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005855 printf("\n");
5856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005857 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005858#endif
5859
Daniel Veillard42595322004-11-08 10:52:06 +00005860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005861}
5862
5863
5864static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005865test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005867
William M. Brack21e4ef22005-01-02 09:53:13 +00005868#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005869 int mem_base;
5870 int ret_val;
5871 xmlCatalogPtr catal; /* should this create an SGML catalog */
5872 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005873
Daniel Veillardce682bc2004-11-05 17:22:25 +00005874 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5875 mem_base = xmlMemBlocks();
5876 catal = gen_xmlCatalogPtr(n_catal, 0);
5877
5878 ret_val = xmlCatalogIsEmpty(catal);
5879 desret_int(ret_val);
5880 call_tests++;
5881 des_xmlCatalogPtr(n_catal, catal, 0);
5882 xmlResetLastError();
5883 if (mem_base != xmlMemBlocks()) {
5884 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005886 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005887 printf(" %d", n_catal);
5888 printf("\n");
5889 }
5890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005891 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005892#endif
5893
Daniel Veillard42595322004-11-08 10:52:06 +00005894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005895}
5896
5897
5898static int
5899test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005901
William M. Brack21e4ef22005-01-02 09:53:13 +00005902#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005903 int mem_base;
5904 xmlChar * ret_val;
5905 void * catalogs; /* a document's list of catalogs */
5906 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005907 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005908 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005909 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005910 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005911
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005912 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5913 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5914 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005916 catalogs = gen_void_ptr(n_catalogs, 0);
5917 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5918 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005919
William M. Brackf13f77f2004-11-12 16:03:48 +00005920 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005921 desret_xmlChar_ptr(ret_val);
5922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005923 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005924 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5925 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005926 xmlResetLastError();
5927 if (mem_base != xmlMemBlocks()) {
5928 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005930 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005931 printf(" %d", n_catalogs);
5932 printf(" %d", n_pubID);
5933 printf(" %d", n_sysID);
5934 printf("\n");
5935 }
5936 }
5937 }
5938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005939 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005940#endif
5941
Daniel Veillard42595322004-11-08 10:52:06 +00005942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005943}
5944
5945
5946static int
5947test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005949
William M. Brack21e4ef22005-01-02 09:53:13 +00005950#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005951 int mem_base;
5952 xmlChar * ret_val;
5953 void * catalogs; /* a document's list of catalogs */
5954 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005955 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005956 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005957
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005958 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5959 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005961 catalogs = gen_void_ptr(n_catalogs, 0);
5962 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005963
William M. Brackf13f77f2004-11-12 16:03:48 +00005964 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005965 desret_xmlChar_ptr(ret_val);
5966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005967 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005968 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005969 xmlResetLastError();
5970 if (mem_base != xmlMemBlocks()) {
5971 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005973 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005974 printf(" %d", n_catalogs);
5975 printf(" %d", n_URI);
5976 printf("\n");
5977 }
5978 }
5979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005980 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005981#endif
5982
Daniel Veillard42595322004-11-08 10:52:06 +00005983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005984}
5985
5986
5987static int
5988test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005990
William M. Brack21e4ef22005-01-02 09:53:13 +00005991#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005992 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005993 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994 int n_value;
5995
5996 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005997 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005998
William M. Brackf13f77f2004-11-12 16:03:48 +00005999 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006000 desret_int(ret_val);
6001 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006002 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006003 xmlResetLastError();
6004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006005 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006006#endif
6007
Daniel Veillard42595322004-11-08 10:52:06 +00006008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006009}
6010
6011
6012static int
6013test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006015
William M. Brack21e4ef22005-01-02 09:53:13 +00006016#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006017 int mem_base;
6018 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006019 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006020 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006021 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006022 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006023
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006024 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6025 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006027 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6028 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006029
William M. Brackf13f77f2004-11-12 16:03:48 +00006030 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006031 desret_xmlChar_ptr(ret_val);
6032 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006033 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6034 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006035 xmlResetLastError();
6036 if (mem_base != xmlMemBlocks()) {
6037 printf("Leak of %d blocks found in xmlCatalogResolve",
6038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006039 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006040 printf(" %d", n_pubID);
6041 printf(" %d", n_sysID);
6042 printf("\n");
6043 }
6044 }
6045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006046 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006047#endif
6048
Daniel Veillard42595322004-11-08 10:52:06 +00006049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006050}
6051
6052
6053static int
6054test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006056
William M. Brack21e4ef22005-01-02 09:53:13 +00006057#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006058 int mem_base;
6059 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006060 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006061 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006062
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006063 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006065 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006066
William M. Brackf13f77f2004-11-12 16:03:48 +00006067 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006068 desret_xmlChar_ptr(ret_val);
6069 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006070 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 xmlResetLastError();
6072 if (mem_base != xmlMemBlocks()) {
6073 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
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("\n");
6078 }
6079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006080 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081#endif
6082
Daniel Veillard42595322004-11-08 10:52:06 +00006083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006084}
6085
6086
6087static int
6088test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006090
William M. Brack21e4ef22005-01-02 09:53:13 +00006091#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006092 int mem_base;
6093 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006094 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006095 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006096
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006097 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006099 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006100
William M. Brackf13f77f2004-11-12 16:03:48 +00006101 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006102 desret_xmlChar_ptr(ret_val);
6103 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006104 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006105 xmlResetLastError();
6106 if (mem_base != xmlMemBlocks()) {
6107 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006109 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 printf(" %d", n_sysID);
6111 printf("\n");
6112 }
6113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006114 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115#endif
6116
Daniel Veillard42595322004-11-08 10:52:06 +00006117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006118}
6119
6120
6121static int
6122test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006124
William M. Brack21e4ef22005-01-02 09:53:13 +00006125#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006126 int mem_base;
6127 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006128 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006129 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006130
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006131 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6132 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006133 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006134
William M. Brackf13f77f2004-11-12 16:03:48 +00006135 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006136 desret_xmlChar_ptr(ret_val);
6137 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006138 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006139 xmlResetLastError();
6140 if (mem_base != xmlMemBlocks()) {
6141 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006143 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006144 printf(" %d", n_URI);
6145 printf("\n");
6146 }
6147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006148 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006149#endif
6150
Daniel Veillard42595322004-11-08 10:52:06 +00006151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006152}
6153
6154
6155static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006156test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006158
William M. Brack21e4ef22005-01-02 09:53:13 +00006159#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006160 int mem_base;
6161 xmlCatalogPrefer ret_val;
6162 xmlCatalogPrefer prefer; /* the default preference for delegation */
6163 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006164
Daniel Veillard57b25162004-11-06 14:50:18 +00006165 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6166 mem_base = xmlMemBlocks();
6167 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6168
6169 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6170 desret_xmlCatalogPrefer(ret_val);
6171 call_tests++;
6172 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6173 xmlResetLastError();
6174 if (mem_base != xmlMemBlocks()) {
6175 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006177 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006178 printf(" %d", n_prefer);
6179 printf("\n");
6180 }
6181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006182 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006183#endif
6184
Daniel Veillard42595322004-11-08 10:52:06 +00006185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006186}
6187
6188
6189static int
6190test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006192
William M. Brack21e4ef22005-01-02 09:53:13 +00006193#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006194 int mem_base;
6195 xmlCatalogAllow allow; /* what catalogs should be accepted */
6196 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006197
Daniel Veillard57b25162004-11-06 14:50:18 +00006198 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6199 mem_base = xmlMemBlocks();
6200 allow = gen_xmlCatalogAllow(n_allow, 0);
6201
6202 xmlCatalogSetDefaults(allow);
6203 call_tests++;
6204 des_xmlCatalogAllow(n_allow, allow, 0);
6205 xmlResetLastError();
6206 if (mem_base != xmlMemBlocks()) {
6207 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006209 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006210 printf(" %d", n_allow);
6211 printf("\n");
6212 }
6213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006214 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006215#endif
6216
Daniel Veillard42595322004-11-08 10:52:06 +00006217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006218}
6219
6220
6221static int
6222test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006224
William M. Brack21e4ef22005-01-02 09:53:13 +00006225#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006226 int mem_base;
6227 int ret_val;
6228 xmlCatalogPtr catal; /* the catalog */
6229 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006230
Daniel Veillardce682bc2004-11-05 17:22:25 +00006231 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6232 mem_base = xmlMemBlocks();
6233 catal = gen_xmlCatalogPtr(n_catal, 0);
6234
6235 ret_val = xmlConvertSGMLCatalog(catal);
6236 desret_int(ret_val);
6237 call_tests++;
6238 des_xmlCatalogPtr(n_catal, catal, 0);
6239 xmlResetLastError();
6240 if (mem_base != xmlMemBlocks()) {
6241 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006243 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006244 printf(" %d", n_catal);
6245 printf("\n");
6246 }
6247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006248 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006249#endif
6250
Daniel Veillard42595322004-11-08 10:52:06 +00006251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006252}
6253
6254
6255static int
6256test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006258
William M. Brack21e4ef22005-01-02 09:53:13 +00006259#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006260 int mem_base;
6261
6262 mem_base = xmlMemBlocks();
6263
6264 xmlInitializeCatalog();
6265 call_tests++;
6266 xmlResetLastError();
6267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006268 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006271 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006273 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006274#endif
6275
Daniel Veillard42595322004-11-08 10:52:06 +00006276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006277}
6278
6279
6280static int
6281test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006283
6284
6285 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287}
6288
6289
6290static int
6291test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006293
William M. Brack21e4ef22005-01-02 09:53:13 +00006294#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006295 int ret_val;
6296 const char * filename; /* a file path */
6297 int n_filename;
6298
6299 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006300 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006301
6302 ret_val = xmlLoadCatalog(filename);
6303 desret_int(ret_val);
6304 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006305 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006306 xmlResetLastError();
6307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006308 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006309#endif
6310
Daniel Veillard42595322004-11-08 10:52:06 +00006311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006312}
6313
6314
6315static int
6316test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006318
William M. Brack21e4ef22005-01-02 09:53:13 +00006319#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006320 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321 int n_pathss;
6322
6323 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006324 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006325
William M. Brackf13f77f2004-11-12 16:03:48 +00006326 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006327 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006328 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006329 xmlResetLastError();
6330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006331 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006332#endif
6333
Daniel Veillard42595322004-11-08 10:52:06 +00006334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006335}
6336
6337
6338static int
6339test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006341
6342
6343 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006345}
6346
6347
6348static int
6349test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006351
6352
6353 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355}
6356
6357
6358static int
6359test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006361
William M. Brack21e4ef22005-01-02 09:53:13 +00006362#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006363 int mem_base;
6364 xmlDocPtr ret_val;
6365 const char * filename; /* the filename */
6366 int n_filename;
6367
6368 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006370 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006371
6372 ret_val = xmlParseCatalogFile(filename);
6373 desret_xmlDocPtr(ret_val);
6374 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006375 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006376 xmlResetLastError();
6377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006378 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006381 printf(" %d", n_filename);
6382 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006383 }
6384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006385 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006386#endif
6387
Daniel Veillard42595322004-11-08 10:52:06 +00006388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006389}
6390
6391static int
6392test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006395 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006396 test_ret += test_xmlACatalogAdd();
6397 test_ret += test_xmlACatalogDump();
6398 test_ret += test_xmlACatalogRemove();
6399 test_ret += test_xmlACatalogResolve();
6400 test_ret += test_xmlACatalogResolvePublic();
6401 test_ret += test_xmlACatalogResolveSystem();
6402 test_ret += test_xmlACatalogResolveURI();
6403 test_ret += test_xmlCatalogAdd();
6404 test_ret += test_xmlCatalogCleanup();
6405 test_ret += test_xmlCatalogConvert();
6406 test_ret += test_xmlCatalogDump();
6407 test_ret += test_xmlCatalogGetDefaults();
6408 test_ret += test_xmlCatalogIsEmpty();
6409 test_ret += test_xmlCatalogLocalResolve();
6410 test_ret += test_xmlCatalogLocalResolveURI();
6411 test_ret += test_xmlCatalogRemove();
6412 test_ret += test_xmlCatalogResolve();
6413 test_ret += test_xmlCatalogResolvePublic();
6414 test_ret += test_xmlCatalogResolveSystem();
6415 test_ret += test_xmlCatalogResolveURI();
6416 test_ret += test_xmlCatalogSetDefaultPrefer();
6417 test_ret += test_xmlCatalogSetDefaults();
6418 test_ret += test_xmlConvertSGMLCatalog();
6419 test_ret += test_xmlInitializeCatalog();
6420 test_ret += test_xmlLoadACatalog();
6421 test_ret += test_xmlLoadCatalog();
6422 test_ret += test_xmlLoadCatalogs();
6423 test_ret += test_xmlLoadSGMLSuperCatalog();
6424 test_ret += test_xmlNewCatalog();
6425 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006426
Daniel Veillard42595322004-11-08 10:52:06 +00006427 if (test_ret != 0)
6428 printf("Module catalog: %d errors\n", test_ret);
6429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006430}
6431
Daniel Veillardce682bc2004-11-05 17:22:25 +00006432#define gen_nb_const_xmlChRangeGroupPtr 1
6433static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6434 return(NULL);
6435}
6436static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6437}
6438
Daniel Veillardd93f6252004-11-02 15:53:51 +00006439static int
6440test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006442
Daniel Veillardce682bc2004-11-05 17:22:25 +00006443 int mem_base;
6444 int ret_val;
6445 unsigned int val; /* character to be validated */
6446 int n_val;
6447 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6448 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006449
Daniel Veillardce682bc2004-11-05 17:22:25 +00006450 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6451 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6452 mem_base = xmlMemBlocks();
6453 val = gen_unsigned_int(n_val, 0);
6454 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6455
William M. Brackf13f77f2004-11-12 16:03:48 +00006456 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006457 desret_int(ret_val);
6458 call_tests++;
6459 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006460 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006461 xmlResetLastError();
6462 if (mem_base != xmlMemBlocks()) {
6463 printf("Leak of %d blocks found in xmlCharInRange",
6464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006465 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006466 printf(" %d", n_val);
6467 printf(" %d", n_rptr);
6468 printf("\n");
6469 }
6470 }
6471 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006473
Daniel Veillard42595322004-11-08 10:52:06 +00006474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006475}
6476
6477
6478static int
6479test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006481
Daniel Veillard3d97e662004-11-04 10:49:00 +00006482 int mem_base;
6483 int ret_val;
6484 unsigned int ch; /* character to validate */
6485 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006486
Daniel Veillard3d97e662004-11-04 10:49:00 +00006487 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6488 mem_base = xmlMemBlocks();
6489 ch = gen_unsigned_int(n_ch, 0);
6490
6491 ret_val = xmlIsBaseChar(ch);
6492 desret_int(ret_val);
6493 call_tests++;
6494 des_unsigned_int(n_ch, ch, 0);
6495 xmlResetLastError();
6496 if (mem_base != xmlMemBlocks()) {
6497 printf("Leak of %d blocks found in xmlIsBaseChar",
6498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006499 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006500 printf(" %d", n_ch);
6501 printf("\n");
6502 }
6503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006505
Daniel Veillard42595322004-11-08 10:52:06 +00006506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006507}
6508
6509
6510static int
6511test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006513
Daniel Veillard3d97e662004-11-04 10:49:00 +00006514 int mem_base;
6515 int ret_val;
6516 unsigned int ch; /* character to validate */
6517 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006518
Daniel Veillard3d97e662004-11-04 10:49:00 +00006519 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6520 mem_base = xmlMemBlocks();
6521 ch = gen_unsigned_int(n_ch, 0);
6522
6523 ret_val = xmlIsBlank(ch);
6524 desret_int(ret_val);
6525 call_tests++;
6526 des_unsigned_int(n_ch, ch, 0);
6527 xmlResetLastError();
6528 if (mem_base != xmlMemBlocks()) {
6529 printf("Leak of %d blocks found in xmlIsBlank",
6530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006531 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006532 printf(" %d", n_ch);
6533 printf("\n");
6534 }
6535 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006536 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006537
Daniel Veillard42595322004-11-08 10:52:06 +00006538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006539}
6540
6541
6542static int
6543test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006545
Daniel Veillard3d97e662004-11-04 10:49:00 +00006546 int mem_base;
6547 int ret_val;
6548 unsigned int ch; /* character to validate */
6549 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550
Daniel Veillard3d97e662004-11-04 10:49:00 +00006551 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6552 mem_base = xmlMemBlocks();
6553 ch = gen_unsigned_int(n_ch, 0);
6554
6555 ret_val = xmlIsChar(ch);
6556 desret_int(ret_val);
6557 call_tests++;
6558 des_unsigned_int(n_ch, ch, 0);
6559 xmlResetLastError();
6560 if (mem_base != xmlMemBlocks()) {
6561 printf("Leak of %d blocks found in xmlIsChar",
6562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006563 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006564 printf(" %d", n_ch);
6565 printf("\n");
6566 }
6567 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006569
Daniel Veillard42595322004-11-08 10:52:06 +00006570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006571}
6572
6573
6574static int
6575test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006577
Daniel Veillard3d97e662004-11-04 10:49:00 +00006578 int mem_base;
6579 int ret_val;
6580 unsigned int ch; /* character to validate */
6581 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582
Daniel Veillard3d97e662004-11-04 10:49:00 +00006583 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6584 mem_base = xmlMemBlocks();
6585 ch = gen_unsigned_int(n_ch, 0);
6586
6587 ret_val = xmlIsCombining(ch);
6588 desret_int(ret_val);
6589 call_tests++;
6590 des_unsigned_int(n_ch, ch, 0);
6591 xmlResetLastError();
6592 if (mem_base != xmlMemBlocks()) {
6593 printf("Leak of %d blocks found in xmlIsCombining",
6594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006595 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006596 printf(" %d", n_ch);
6597 printf("\n");
6598 }
6599 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006601
Daniel Veillard42595322004-11-08 10:52:06 +00006602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006603}
6604
6605
6606static int
6607test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006609
Daniel Veillard3d97e662004-11-04 10:49:00 +00006610 int mem_base;
6611 int ret_val;
6612 unsigned int ch; /* character to validate */
6613 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614
Daniel Veillard3d97e662004-11-04 10:49:00 +00006615 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6616 mem_base = xmlMemBlocks();
6617 ch = gen_unsigned_int(n_ch, 0);
6618
6619 ret_val = xmlIsDigit(ch);
6620 desret_int(ret_val);
6621 call_tests++;
6622 des_unsigned_int(n_ch, ch, 0);
6623 xmlResetLastError();
6624 if (mem_base != xmlMemBlocks()) {
6625 printf("Leak of %d blocks found in xmlIsDigit",
6626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006627 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006628 printf(" %d", n_ch);
6629 printf("\n");
6630 }
6631 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006632 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006633
Daniel Veillard42595322004-11-08 10:52:06 +00006634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006635}
6636
6637
6638static int
6639test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006641
Daniel Veillard3d97e662004-11-04 10:49:00 +00006642 int mem_base;
6643 int ret_val;
6644 unsigned int ch; /* character to validate */
6645 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006646
Daniel Veillard3d97e662004-11-04 10:49:00 +00006647 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6648 mem_base = xmlMemBlocks();
6649 ch = gen_unsigned_int(n_ch, 0);
6650
6651 ret_val = xmlIsExtender(ch);
6652 desret_int(ret_val);
6653 call_tests++;
6654 des_unsigned_int(n_ch, ch, 0);
6655 xmlResetLastError();
6656 if (mem_base != xmlMemBlocks()) {
6657 printf("Leak of %d blocks found in xmlIsExtender",
6658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006659 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006660 printf(" %d", n_ch);
6661 printf("\n");
6662 }
6663 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006664 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006665
Daniel Veillard42595322004-11-08 10:52:06 +00006666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006667}
6668
6669
6670static int
6671test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006673
Daniel Veillard3d97e662004-11-04 10:49:00 +00006674 int mem_base;
6675 int ret_val;
6676 unsigned int ch; /* character to validate */
6677 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006678
Daniel Veillard3d97e662004-11-04 10:49:00 +00006679 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6680 mem_base = xmlMemBlocks();
6681 ch = gen_unsigned_int(n_ch, 0);
6682
6683 ret_val = xmlIsIdeographic(ch);
6684 desret_int(ret_val);
6685 call_tests++;
6686 des_unsigned_int(n_ch, ch, 0);
6687 xmlResetLastError();
6688 if (mem_base != xmlMemBlocks()) {
6689 printf("Leak of %d blocks found in xmlIsIdeographic",
6690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006691 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006692 printf(" %d", n_ch);
6693 printf("\n");
6694 }
6695 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006696 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006697
Daniel Veillard42595322004-11-08 10:52:06 +00006698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006699}
6700
6701
6702static int
6703test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006705
Daniel Veillard3d97e662004-11-04 10:49:00 +00006706 int mem_base;
6707 int ret_val;
6708 unsigned int ch; /* character to validate */
6709 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006710
Daniel Veillard3d97e662004-11-04 10:49:00 +00006711 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6712 mem_base = xmlMemBlocks();
6713 ch = gen_unsigned_int(n_ch, 0);
6714
6715 ret_val = xmlIsPubidChar(ch);
6716 desret_int(ret_val);
6717 call_tests++;
6718 des_unsigned_int(n_ch, ch, 0);
6719 xmlResetLastError();
6720 if (mem_base != xmlMemBlocks()) {
6721 printf("Leak of %d blocks found in xmlIsPubidChar",
6722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006723 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006724 printf(" %d", n_ch);
6725 printf("\n");
6726 }
6727 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006728 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006729
Daniel Veillard42595322004-11-08 10:52:06 +00006730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006731}
6732
6733static int
6734test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006736
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006737 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006738 test_ret += test_xmlCharInRange();
6739 test_ret += test_xmlIsBaseChar();
6740 test_ret += test_xmlIsBlank();
6741 test_ret += test_xmlIsChar();
6742 test_ret += test_xmlIsCombining();
6743 test_ret += test_xmlIsDigit();
6744 test_ret += test_xmlIsExtender();
6745 test_ret += test_xmlIsIdeographic();
6746 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006747
Daniel Veillard42595322004-11-08 10:52:06 +00006748 if (test_ret != 0)
6749 printf("Module chvalid: %d errors\n", test_ret);
6750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006751}
6752
6753static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006754test_xmlBoolToText(void) {
6755 int test_ret = 0;
6756
William M. Brack21e4ef22005-01-02 09:53:13 +00006757#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006758 int mem_base;
6759 const char * ret_val;
6760 int boolval; /* a bool to turn into text */
6761 int n_boolval;
6762
6763 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6764 mem_base = xmlMemBlocks();
6765 boolval = gen_int(n_boolval, 0);
6766
6767 ret_val = xmlBoolToText(boolval);
6768 desret_const_char_ptr(ret_val);
6769 call_tests++;
6770 des_int(n_boolval, boolval, 0);
6771 xmlResetLastError();
6772 if (mem_base != xmlMemBlocks()) {
6773 printf("Leak of %d blocks found in xmlBoolToText",
6774 xmlMemBlocks() - mem_base);
6775 test_ret++;
6776 printf(" %d", n_boolval);
6777 printf("\n");
6778 }
6779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006780 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006781#endif
6782
Daniel Veillarda82b1822004-11-08 16:24:57 +00006783 return(test_ret);
6784}
6785
6786
6787static int
6788test_xmlDebugCheckDocument(void) {
6789 int test_ret = 0;
6790
William M. Brack21e4ef22005-01-02 09:53:13 +00006791#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006792 int mem_base;
6793 int ret_val;
6794 FILE * output; /* the FILE * for the output */
6795 int n_output;
6796 xmlDocPtr doc; /* the document */
6797 int n_doc;
6798
6799 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6800 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6801 mem_base = xmlMemBlocks();
6802 output = gen_debug_FILE_ptr(n_output, 0);
6803 doc = gen_xmlDocPtr(n_doc, 1);
6804
6805 ret_val = xmlDebugCheckDocument(output, doc);
6806 desret_int(ret_val);
6807 call_tests++;
6808 des_debug_FILE_ptr(n_output, output, 0);
6809 des_xmlDocPtr(n_doc, doc, 1);
6810 xmlResetLastError();
6811 if (mem_base != xmlMemBlocks()) {
6812 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6813 xmlMemBlocks() - mem_base);
6814 test_ret++;
6815 printf(" %d", n_output);
6816 printf(" %d", n_doc);
6817 printf("\n");
6818 }
6819 }
6820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006821 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006822#endif
6823
Daniel Veillarda82b1822004-11-08 16:24:57 +00006824 return(test_ret);
6825}
6826
6827
6828static int
6829test_xmlDebugDumpAttr(void) {
6830 int test_ret = 0;
6831
William M. Brack21e4ef22005-01-02 09:53:13 +00006832#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006833 int mem_base;
6834 FILE * output; /* the FILE * for the output */
6835 int n_output;
6836 xmlAttrPtr attr; /* the attribute */
6837 int n_attr;
6838 int depth; /* the indentation level. */
6839 int n_depth;
6840
6841 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6842 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6843 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6844 mem_base = xmlMemBlocks();
6845 output = gen_debug_FILE_ptr(n_output, 0);
6846 attr = gen_xmlAttrPtr(n_attr, 1);
6847 depth = gen_int(n_depth, 2);
6848
6849 xmlDebugDumpAttr(output, attr, depth);
6850 call_tests++;
6851 des_debug_FILE_ptr(n_output, output, 0);
6852 des_xmlAttrPtr(n_attr, attr, 1);
6853 des_int(n_depth, depth, 2);
6854 xmlResetLastError();
6855 if (mem_base != xmlMemBlocks()) {
6856 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6857 xmlMemBlocks() - mem_base);
6858 test_ret++;
6859 printf(" %d", n_output);
6860 printf(" %d", n_attr);
6861 printf(" %d", n_depth);
6862 printf("\n");
6863 }
6864 }
6865 }
6866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006867 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006868#endif
6869
Daniel Veillarda82b1822004-11-08 16:24:57 +00006870 return(test_ret);
6871}
6872
6873
6874static int
6875test_xmlDebugDumpAttrList(void) {
6876 int test_ret = 0;
6877
William M. Brack21e4ef22005-01-02 09:53:13 +00006878#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006879 int mem_base;
6880 FILE * output; /* the FILE * for the output */
6881 int n_output;
6882 xmlAttrPtr attr; /* the attribute list */
6883 int n_attr;
6884 int depth; /* the indentation level. */
6885 int n_depth;
6886
6887 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6888 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6889 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6890 mem_base = xmlMemBlocks();
6891 output = gen_debug_FILE_ptr(n_output, 0);
6892 attr = gen_xmlAttrPtr(n_attr, 1);
6893 depth = gen_int(n_depth, 2);
6894
6895 xmlDebugDumpAttrList(output, attr, depth);
6896 call_tests++;
6897 des_debug_FILE_ptr(n_output, output, 0);
6898 des_xmlAttrPtr(n_attr, attr, 1);
6899 des_int(n_depth, depth, 2);
6900 xmlResetLastError();
6901 if (mem_base != xmlMemBlocks()) {
6902 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6903 xmlMemBlocks() - mem_base);
6904 test_ret++;
6905 printf(" %d", n_output);
6906 printf(" %d", n_attr);
6907 printf(" %d", n_depth);
6908 printf("\n");
6909 }
6910 }
6911 }
6912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006913 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006914#endif
6915
Daniel Veillarda82b1822004-11-08 16:24:57 +00006916 return(test_ret);
6917}
6918
6919
6920static int
6921test_xmlDebugDumpDTD(void) {
6922 int test_ret = 0;
6923
William M. Brack21e4ef22005-01-02 09:53:13 +00006924#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006925 int mem_base;
6926 FILE * output; /* the FILE * for the output */
6927 int n_output;
6928 xmlDtdPtr dtd; /* the DTD */
6929 int n_dtd;
6930
6931 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6932 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6933 mem_base = xmlMemBlocks();
6934 output = gen_debug_FILE_ptr(n_output, 0);
6935 dtd = gen_xmlDtdPtr(n_dtd, 1);
6936
6937 xmlDebugDumpDTD(output, dtd);
6938 call_tests++;
6939 des_debug_FILE_ptr(n_output, output, 0);
6940 des_xmlDtdPtr(n_dtd, dtd, 1);
6941 xmlResetLastError();
6942 if (mem_base != xmlMemBlocks()) {
6943 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6944 xmlMemBlocks() - mem_base);
6945 test_ret++;
6946 printf(" %d", n_output);
6947 printf(" %d", n_dtd);
6948 printf("\n");
6949 }
6950 }
6951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006952 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006953#endif
6954
Daniel Veillarda82b1822004-11-08 16:24:57 +00006955 return(test_ret);
6956}
6957
6958
6959static int
6960test_xmlDebugDumpDocument(void) {
6961 int test_ret = 0;
6962
William M. Brack21e4ef22005-01-02 09:53:13 +00006963#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006964 int mem_base;
6965 FILE * output; /* the FILE * for the output */
6966 int n_output;
6967 xmlDocPtr doc; /* the document */
6968 int n_doc;
6969
6970 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6971 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6972 mem_base = xmlMemBlocks();
6973 output = gen_debug_FILE_ptr(n_output, 0);
6974 doc = gen_xmlDocPtr(n_doc, 1);
6975
6976 xmlDebugDumpDocument(output, doc);
6977 call_tests++;
6978 des_debug_FILE_ptr(n_output, output, 0);
6979 des_xmlDocPtr(n_doc, doc, 1);
6980 xmlResetLastError();
6981 if (mem_base != xmlMemBlocks()) {
6982 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6983 xmlMemBlocks() - mem_base);
6984 test_ret++;
6985 printf(" %d", n_output);
6986 printf(" %d", n_doc);
6987 printf("\n");
6988 }
6989 }
6990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006991 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006992#endif
6993
Daniel Veillarda82b1822004-11-08 16:24:57 +00006994 return(test_ret);
6995}
6996
6997
6998static int
6999test_xmlDebugDumpDocumentHead(void) {
7000 int test_ret = 0;
7001
William M. Brack21e4ef22005-01-02 09:53:13 +00007002#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007003 int mem_base;
7004 FILE * output; /* the FILE * for the output */
7005 int n_output;
7006 xmlDocPtr doc; /* the document */
7007 int n_doc;
7008
7009 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7010 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7011 mem_base = xmlMemBlocks();
7012 output = gen_debug_FILE_ptr(n_output, 0);
7013 doc = gen_xmlDocPtr(n_doc, 1);
7014
7015 xmlDebugDumpDocumentHead(output, doc);
7016 call_tests++;
7017 des_debug_FILE_ptr(n_output, output, 0);
7018 des_xmlDocPtr(n_doc, doc, 1);
7019 xmlResetLastError();
7020 if (mem_base != xmlMemBlocks()) {
7021 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7022 xmlMemBlocks() - mem_base);
7023 test_ret++;
7024 printf(" %d", n_output);
7025 printf(" %d", n_doc);
7026 printf("\n");
7027 }
7028 }
7029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007030 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007031#endif
7032
Daniel Veillarda82b1822004-11-08 16:24:57 +00007033 return(test_ret);
7034}
7035
7036
7037static int
7038test_xmlDebugDumpEntities(void) {
7039 int test_ret = 0;
7040
William M. Brack21e4ef22005-01-02 09:53:13 +00007041#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007042 int mem_base;
7043 FILE * output; /* the FILE * for the output */
7044 int n_output;
7045 xmlDocPtr doc; /* the document */
7046 int n_doc;
7047
7048 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7049 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7050 mem_base = xmlMemBlocks();
7051 output = gen_debug_FILE_ptr(n_output, 0);
7052 doc = gen_xmlDocPtr(n_doc, 1);
7053
7054 xmlDebugDumpEntities(output, doc);
7055 call_tests++;
7056 des_debug_FILE_ptr(n_output, output, 0);
7057 des_xmlDocPtr(n_doc, doc, 1);
7058 xmlResetLastError();
7059 if (mem_base != xmlMemBlocks()) {
7060 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7061 xmlMemBlocks() - mem_base);
7062 test_ret++;
7063 printf(" %d", n_output);
7064 printf(" %d", n_doc);
7065 printf("\n");
7066 }
7067 }
7068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007069 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007070#endif
7071
Daniel Veillarda82b1822004-11-08 16:24:57 +00007072 return(test_ret);
7073}
7074
7075
7076static int
7077test_xmlDebugDumpNode(void) {
7078 int test_ret = 0;
7079
William M. Brack21e4ef22005-01-02 09:53:13 +00007080#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007081 int mem_base;
7082 FILE * output; /* the FILE * for the output */
7083 int n_output;
7084 xmlNodePtr node; /* the node */
7085 int n_node;
7086 int depth; /* the indentation level. */
7087 int n_depth;
7088
7089 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7090 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7091 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7092 mem_base = xmlMemBlocks();
7093 output = gen_debug_FILE_ptr(n_output, 0);
7094 node = gen_xmlNodePtr(n_node, 1);
7095 depth = gen_int(n_depth, 2);
7096
7097 xmlDebugDumpNode(output, node, depth);
7098 call_tests++;
7099 des_debug_FILE_ptr(n_output, output, 0);
7100 des_xmlNodePtr(n_node, node, 1);
7101 des_int(n_depth, depth, 2);
7102 xmlResetLastError();
7103 if (mem_base != xmlMemBlocks()) {
7104 printf("Leak of %d blocks found in xmlDebugDumpNode",
7105 xmlMemBlocks() - mem_base);
7106 test_ret++;
7107 printf(" %d", n_output);
7108 printf(" %d", n_node);
7109 printf(" %d", n_depth);
7110 printf("\n");
7111 }
7112 }
7113 }
7114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007115 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007116#endif
7117
Daniel Veillarda82b1822004-11-08 16:24:57 +00007118 return(test_ret);
7119}
7120
7121
7122static int
7123test_xmlDebugDumpNodeList(void) {
7124 int test_ret = 0;
7125
William M. Brack21e4ef22005-01-02 09:53:13 +00007126#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007127 int mem_base;
7128 FILE * output; /* the FILE * for the output */
7129 int n_output;
7130 xmlNodePtr node; /* the node list */
7131 int n_node;
7132 int depth; /* the indentation level. */
7133 int n_depth;
7134
7135 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7136 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7137 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7138 mem_base = xmlMemBlocks();
7139 output = gen_debug_FILE_ptr(n_output, 0);
7140 node = gen_xmlNodePtr(n_node, 1);
7141 depth = gen_int(n_depth, 2);
7142
7143 xmlDebugDumpNodeList(output, node, depth);
7144 call_tests++;
7145 des_debug_FILE_ptr(n_output, output, 0);
7146 des_xmlNodePtr(n_node, node, 1);
7147 des_int(n_depth, depth, 2);
7148 xmlResetLastError();
7149 if (mem_base != xmlMemBlocks()) {
7150 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7151 xmlMemBlocks() - mem_base);
7152 test_ret++;
7153 printf(" %d", n_output);
7154 printf(" %d", n_node);
7155 printf(" %d", n_depth);
7156 printf("\n");
7157 }
7158 }
7159 }
7160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007161 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007162#endif
7163
Daniel Veillarda82b1822004-11-08 16:24:57 +00007164 return(test_ret);
7165}
7166
7167
7168static int
7169test_xmlDebugDumpOneNode(void) {
7170 int test_ret = 0;
7171
William M. Brack21e4ef22005-01-02 09:53:13 +00007172#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007173 int mem_base;
7174 FILE * output; /* the FILE * for the output */
7175 int n_output;
7176 xmlNodePtr node; /* the node */
7177 int n_node;
7178 int depth; /* the indentation level. */
7179 int n_depth;
7180
7181 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7182 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7183 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7184 mem_base = xmlMemBlocks();
7185 output = gen_debug_FILE_ptr(n_output, 0);
7186 node = gen_xmlNodePtr(n_node, 1);
7187 depth = gen_int(n_depth, 2);
7188
7189 xmlDebugDumpOneNode(output, node, depth);
7190 call_tests++;
7191 des_debug_FILE_ptr(n_output, output, 0);
7192 des_xmlNodePtr(n_node, node, 1);
7193 des_int(n_depth, depth, 2);
7194 xmlResetLastError();
7195 if (mem_base != xmlMemBlocks()) {
7196 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7197 xmlMemBlocks() - mem_base);
7198 test_ret++;
7199 printf(" %d", n_output);
7200 printf(" %d", n_node);
7201 printf(" %d", n_depth);
7202 printf("\n");
7203 }
7204 }
7205 }
7206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007207 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007208#endif
7209
Daniel Veillarda82b1822004-11-08 16:24:57 +00007210 return(test_ret);
7211}
7212
7213
7214static int
7215test_xmlDebugDumpString(void) {
7216 int test_ret = 0;
7217
William M. Brack21e4ef22005-01-02 09:53:13 +00007218#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007219 int mem_base;
7220 FILE * output; /* the FILE * for the output */
7221 int n_output;
7222 xmlChar * str; /* the string */
7223 int n_str;
7224
7225 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7226 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7227 mem_base = xmlMemBlocks();
7228 output = gen_debug_FILE_ptr(n_output, 0);
7229 str = gen_const_xmlChar_ptr(n_str, 1);
7230
William M. Brackf13f77f2004-11-12 16:03:48 +00007231 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007232 call_tests++;
7233 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007234 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007235 xmlResetLastError();
7236 if (mem_base != xmlMemBlocks()) {
7237 printf("Leak of %d blocks found in xmlDebugDumpString",
7238 xmlMemBlocks() - mem_base);
7239 test_ret++;
7240 printf(" %d", n_output);
7241 printf(" %d", n_str);
7242 printf("\n");
7243 }
7244 }
7245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007246 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007247#endif
7248
Daniel Veillarda82b1822004-11-08 16:24:57 +00007249 return(test_ret);
7250}
7251
7252
7253static int
7254test_xmlLsCountNode(void) {
7255 int test_ret = 0;
7256
William M. Brack21e4ef22005-01-02 09:53:13 +00007257#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007258 int mem_base;
7259 int ret_val;
7260 xmlNodePtr node; /* the node to count */
7261 int n_node;
7262
7263 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7264 mem_base = xmlMemBlocks();
7265 node = gen_xmlNodePtr(n_node, 0);
7266
7267 ret_val = xmlLsCountNode(node);
7268 desret_int(ret_val);
7269 call_tests++;
7270 des_xmlNodePtr(n_node, node, 0);
7271 xmlResetLastError();
7272 if (mem_base != xmlMemBlocks()) {
7273 printf("Leak of %d blocks found in xmlLsCountNode",
7274 xmlMemBlocks() - mem_base);
7275 test_ret++;
7276 printf(" %d", n_node);
7277 printf("\n");
7278 }
7279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007280 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007281#endif
7282
Daniel Veillarda82b1822004-11-08 16:24:57 +00007283 return(test_ret);
7284}
7285
7286
7287static int
7288test_xmlLsOneNode(void) {
7289 int test_ret = 0;
7290
William M. Brack21e4ef22005-01-02 09:53:13 +00007291#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007292 int mem_base;
7293 FILE * output; /* the FILE * for the output */
7294 int n_output;
7295 xmlNodePtr node; /* the node to dump */
7296 int n_node;
7297
7298 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7299 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7300 mem_base = xmlMemBlocks();
7301 output = gen_debug_FILE_ptr(n_output, 0);
7302 node = gen_xmlNodePtr(n_node, 1);
7303
7304 xmlLsOneNode(output, node);
7305 call_tests++;
7306 des_debug_FILE_ptr(n_output, output, 0);
7307 des_xmlNodePtr(n_node, node, 1);
7308 xmlResetLastError();
7309 if (mem_base != xmlMemBlocks()) {
7310 printf("Leak of %d blocks found in xmlLsOneNode",
7311 xmlMemBlocks() - mem_base);
7312 test_ret++;
7313 printf(" %d", n_output);
7314 printf(" %d", n_node);
7315 printf("\n");
7316 }
7317 }
7318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007319 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007320#endif
7321
Daniel Veillarda82b1822004-11-08 16:24:57 +00007322 return(test_ret);
7323}
7324
7325
7326#define gen_nb_char_ptr 1
7327static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7328 return(NULL);
7329}
7330static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7331}
7332
7333static int
7334test_xmlShell(void) {
7335 int test_ret = 0;
7336
7337
7338 /* missing type support */
7339 return(test_ret);
7340}
7341
7342
Daniel Veillarda82b1822004-11-08 16:24:57 +00007343static int
7344test_xmlShellBase(void) {
7345 int test_ret = 0;
7346
William M. Brack21e4ef22005-01-02 09:53:13 +00007347#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007348 int mem_base;
7349 int ret_val;
7350 xmlShellCtxtPtr ctxt; /* the shell context */
7351 int n_ctxt;
7352 char * arg; /* unused */
7353 int n_arg;
7354 xmlNodePtr node; /* a node */
7355 int n_node;
7356 xmlNodePtr node2; /* unused */
7357 int n_node2;
7358
7359 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7360 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7361 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7362 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7363 mem_base = xmlMemBlocks();
7364 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7365 arg = gen_char_ptr(n_arg, 1);
7366 node = gen_xmlNodePtr(n_node, 2);
7367 node2 = gen_xmlNodePtr(n_node2, 3);
7368
7369 ret_val = xmlShellBase(ctxt, arg, node, node2);
7370 desret_int(ret_val);
7371 call_tests++;
7372 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7373 des_char_ptr(n_arg, arg, 1);
7374 des_xmlNodePtr(n_node, node, 2);
7375 des_xmlNodePtr(n_node2, node2, 3);
7376 xmlResetLastError();
7377 if (mem_base != xmlMemBlocks()) {
7378 printf("Leak of %d blocks found in xmlShellBase",
7379 xmlMemBlocks() - mem_base);
7380 test_ret++;
7381 printf(" %d", n_ctxt);
7382 printf(" %d", n_arg);
7383 printf(" %d", n_node);
7384 printf(" %d", n_node2);
7385 printf("\n");
7386 }
7387 }
7388 }
7389 }
7390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007391 function_tests++;
7392#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007393
Daniel Veillarda82b1822004-11-08 16:24:57 +00007394 return(test_ret);
7395}
7396
7397
7398static int
7399test_xmlShellCat(void) {
7400 int test_ret = 0;
7401
William M. Brack21e4ef22005-01-02 09:53:13 +00007402#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007403 int mem_base;
7404 int ret_val;
7405 xmlShellCtxtPtr ctxt; /* the shell context */
7406 int n_ctxt;
7407 char * arg; /* unused */
7408 int n_arg;
7409 xmlNodePtr node; /* a node */
7410 int n_node;
7411 xmlNodePtr node2; /* unused */
7412 int n_node2;
7413
7414 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7415 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7416 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7417 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7418 mem_base = xmlMemBlocks();
7419 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7420 arg = gen_char_ptr(n_arg, 1);
7421 node = gen_xmlNodePtr(n_node, 2);
7422 node2 = gen_xmlNodePtr(n_node2, 3);
7423
7424 ret_val = xmlShellCat(ctxt, arg, node, node2);
7425 desret_int(ret_val);
7426 call_tests++;
7427 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7428 des_char_ptr(n_arg, arg, 1);
7429 des_xmlNodePtr(n_node, node, 2);
7430 des_xmlNodePtr(n_node2, node2, 3);
7431 xmlResetLastError();
7432 if (mem_base != xmlMemBlocks()) {
7433 printf("Leak of %d blocks found in xmlShellCat",
7434 xmlMemBlocks() - mem_base);
7435 test_ret++;
7436 printf(" %d", n_ctxt);
7437 printf(" %d", n_arg);
7438 printf(" %d", n_node);
7439 printf(" %d", n_node2);
7440 printf("\n");
7441 }
7442 }
7443 }
7444 }
7445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007446 function_tests++;
7447#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007448
Daniel Veillarda82b1822004-11-08 16:24:57 +00007449 return(test_ret);
7450}
7451
7452
7453static int
7454test_xmlShellDir(void) {
7455 int test_ret = 0;
7456
William M. Brack21e4ef22005-01-02 09:53:13 +00007457#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007458 int mem_base;
7459 int ret_val;
7460 xmlShellCtxtPtr ctxt; /* the shell context */
7461 int n_ctxt;
7462 char * arg; /* unused */
7463 int n_arg;
7464 xmlNodePtr node; /* a node */
7465 int n_node;
7466 xmlNodePtr node2; /* unused */
7467 int n_node2;
7468
7469 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7470 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7471 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7472 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7473 mem_base = xmlMemBlocks();
7474 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7475 arg = gen_char_ptr(n_arg, 1);
7476 node = gen_xmlNodePtr(n_node, 2);
7477 node2 = gen_xmlNodePtr(n_node2, 3);
7478
7479 ret_val = xmlShellDir(ctxt, arg, node, node2);
7480 desret_int(ret_val);
7481 call_tests++;
7482 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7483 des_char_ptr(n_arg, arg, 1);
7484 des_xmlNodePtr(n_node, node, 2);
7485 des_xmlNodePtr(n_node2, node2, 3);
7486 xmlResetLastError();
7487 if (mem_base != xmlMemBlocks()) {
7488 printf("Leak of %d blocks found in xmlShellDir",
7489 xmlMemBlocks() - mem_base);
7490 test_ret++;
7491 printf(" %d", n_ctxt);
7492 printf(" %d", n_arg);
7493 printf(" %d", n_node);
7494 printf(" %d", n_node2);
7495 printf("\n");
7496 }
7497 }
7498 }
7499 }
7500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007501 function_tests++;
7502#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007503
Daniel Veillarda82b1822004-11-08 16:24:57 +00007504 return(test_ret);
7505}
7506
7507
7508static int
7509test_xmlShellDu(void) {
7510 int test_ret = 0;
7511
William M. Brack21e4ef22005-01-02 09:53:13 +00007512#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007513 int mem_base;
7514 int ret_val;
7515 xmlShellCtxtPtr ctxt; /* the shell context */
7516 int n_ctxt;
7517 char * arg; /* unused */
7518 int n_arg;
7519 xmlNodePtr tree; /* a node defining a subtree */
7520 int n_tree;
7521 xmlNodePtr node2; /* unused */
7522 int n_node2;
7523
7524 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7525 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7526 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7527 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7528 mem_base = xmlMemBlocks();
7529 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7530 arg = gen_char_ptr(n_arg, 1);
7531 tree = gen_xmlNodePtr(n_tree, 2);
7532 node2 = gen_xmlNodePtr(n_node2, 3);
7533
7534 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7535 desret_int(ret_val);
7536 call_tests++;
7537 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7538 des_char_ptr(n_arg, arg, 1);
7539 des_xmlNodePtr(n_tree, tree, 2);
7540 des_xmlNodePtr(n_node2, node2, 3);
7541 xmlResetLastError();
7542 if (mem_base != xmlMemBlocks()) {
7543 printf("Leak of %d blocks found in xmlShellDu",
7544 xmlMemBlocks() - mem_base);
7545 test_ret++;
7546 printf(" %d", n_ctxt);
7547 printf(" %d", n_arg);
7548 printf(" %d", n_tree);
7549 printf(" %d", n_node2);
7550 printf("\n");
7551 }
7552 }
7553 }
7554 }
7555 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007556 function_tests++;
7557#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007558
Daniel Veillarda82b1822004-11-08 16:24:57 +00007559 return(test_ret);
7560}
7561
7562
7563static int
7564test_xmlShellList(void) {
7565 int test_ret = 0;
7566
William M. Brack21e4ef22005-01-02 09:53:13 +00007567#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007568 int mem_base;
7569 int ret_val;
7570 xmlShellCtxtPtr ctxt; /* the shell context */
7571 int n_ctxt;
7572 char * arg; /* unused */
7573 int n_arg;
7574 xmlNodePtr node; /* a node */
7575 int n_node;
7576 xmlNodePtr node2; /* unused */
7577 int n_node2;
7578
7579 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7580 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7581 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7582 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7583 mem_base = xmlMemBlocks();
7584 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7585 arg = gen_char_ptr(n_arg, 1);
7586 node = gen_xmlNodePtr(n_node, 2);
7587 node2 = gen_xmlNodePtr(n_node2, 3);
7588
7589 ret_val = xmlShellList(ctxt, arg, node, node2);
7590 desret_int(ret_val);
7591 call_tests++;
7592 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7593 des_char_ptr(n_arg, arg, 1);
7594 des_xmlNodePtr(n_node, node, 2);
7595 des_xmlNodePtr(n_node2, node2, 3);
7596 xmlResetLastError();
7597 if (mem_base != xmlMemBlocks()) {
7598 printf("Leak of %d blocks found in xmlShellList",
7599 xmlMemBlocks() - mem_base);
7600 test_ret++;
7601 printf(" %d", n_ctxt);
7602 printf(" %d", n_arg);
7603 printf(" %d", n_node);
7604 printf(" %d", n_node2);
7605 printf("\n");
7606 }
7607 }
7608 }
7609 }
7610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007611 function_tests++;
7612#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007613
Daniel Veillarda82b1822004-11-08 16:24:57 +00007614 return(test_ret);
7615}
7616
7617
7618static int
7619test_xmlShellLoad(void) {
7620 int test_ret = 0;
7621
William M. Brack21e4ef22005-01-02 09:53:13 +00007622#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007623 int mem_base;
7624 int ret_val;
7625 xmlShellCtxtPtr ctxt; /* the shell context */
7626 int n_ctxt;
7627 char * filename; /* the file name */
7628 int n_filename;
7629 xmlNodePtr node; /* unused */
7630 int n_node;
7631 xmlNodePtr node2; /* unused */
7632 int n_node2;
7633
7634 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7635 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7636 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7637 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7638 mem_base = xmlMemBlocks();
7639 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7640 filename = gen_char_ptr(n_filename, 1);
7641 node = gen_xmlNodePtr(n_node, 2);
7642 node2 = gen_xmlNodePtr(n_node2, 3);
7643
7644 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7645 desret_int(ret_val);
7646 call_tests++;
7647 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7648 des_char_ptr(n_filename, filename, 1);
7649 des_xmlNodePtr(n_node, node, 2);
7650 des_xmlNodePtr(n_node2, node2, 3);
7651 xmlResetLastError();
7652 if (mem_base != xmlMemBlocks()) {
7653 printf("Leak of %d blocks found in xmlShellLoad",
7654 xmlMemBlocks() - mem_base);
7655 test_ret++;
7656 printf(" %d", n_ctxt);
7657 printf(" %d", n_filename);
7658 printf(" %d", n_node);
7659 printf(" %d", n_node2);
7660 printf("\n");
7661 }
7662 }
7663 }
7664 }
7665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007666 function_tests++;
7667#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007668
Daniel Veillarda82b1822004-11-08 16:24:57 +00007669 return(test_ret);
7670}
7671
7672
7673static int
7674test_xmlShellPrintXPathResult(void) {
7675 int test_ret = 0;
7676
William M. Brack21e4ef22005-01-02 09:53:13 +00007677#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007678 int mem_base;
7679 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7680 int n_list;
7681
7682 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7683 mem_base = xmlMemBlocks();
7684 list = gen_xmlXPathObjectPtr(n_list, 0);
7685
7686 xmlShellPrintXPathResult(list);
7687 call_tests++;
7688 des_xmlXPathObjectPtr(n_list, list, 0);
7689 xmlResetLastError();
7690 if (mem_base != xmlMemBlocks()) {
7691 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7692 xmlMemBlocks() - mem_base);
7693 test_ret++;
7694 printf(" %d", n_list);
7695 printf("\n");
7696 }
7697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007698 function_tests++;
7699#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007700
Daniel Veillarda82b1822004-11-08 16:24:57 +00007701 return(test_ret);
7702}
7703
7704
7705static int
7706test_xmlShellPwd(void) {
7707 int test_ret = 0;
7708
William M. Brack21e4ef22005-01-02 09:53:13 +00007709#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007710 int mem_base;
7711 int ret_val;
7712 xmlShellCtxtPtr ctxt; /* the shell context */
7713 int n_ctxt;
7714 char * buffer; /* the output buffer */
7715 int n_buffer;
7716 xmlNodePtr node; /* a node */
7717 int n_node;
7718 xmlNodePtr node2; /* unused */
7719 int n_node2;
7720
7721 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7722 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7723 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7724 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7725 mem_base = xmlMemBlocks();
7726 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7727 buffer = gen_char_ptr(n_buffer, 1);
7728 node = gen_xmlNodePtr(n_node, 2);
7729 node2 = gen_xmlNodePtr(n_node2, 3);
7730
7731 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7732 desret_int(ret_val);
7733 call_tests++;
7734 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7735 des_char_ptr(n_buffer, buffer, 1);
7736 des_xmlNodePtr(n_node, node, 2);
7737 des_xmlNodePtr(n_node2, node2, 3);
7738 xmlResetLastError();
7739 if (mem_base != xmlMemBlocks()) {
7740 printf("Leak of %d blocks found in xmlShellPwd",
7741 xmlMemBlocks() - mem_base);
7742 test_ret++;
7743 printf(" %d", n_ctxt);
7744 printf(" %d", n_buffer);
7745 printf(" %d", n_node);
7746 printf(" %d", n_node2);
7747 printf("\n");
7748 }
7749 }
7750 }
7751 }
7752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007753 function_tests++;
7754#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007755
Daniel Veillarda82b1822004-11-08 16:24:57 +00007756 return(test_ret);
7757}
7758
7759
7760static int
7761test_xmlShellSave(void) {
7762 int test_ret = 0;
7763
William M. Brack21e4ef22005-01-02 09:53:13 +00007764#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007765 int mem_base;
7766 int ret_val;
7767 xmlShellCtxtPtr ctxt; /* the shell context */
7768 int n_ctxt;
7769 char * filename; /* the file name (optional) */
7770 int n_filename;
7771 xmlNodePtr node; /* unused */
7772 int n_node;
7773 xmlNodePtr node2; /* unused */
7774 int n_node2;
7775
7776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7777 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7778 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7779 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7780 mem_base = xmlMemBlocks();
7781 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7782 filename = gen_char_ptr(n_filename, 1);
7783 node = gen_xmlNodePtr(n_node, 2);
7784 node2 = gen_xmlNodePtr(n_node2, 3);
7785
7786 ret_val = xmlShellSave(ctxt, filename, node, node2);
7787 desret_int(ret_val);
7788 call_tests++;
7789 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7790 des_char_ptr(n_filename, filename, 1);
7791 des_xmlNodePtr(n_node, node, 2);
7792 des_xmlNodePtr(n_node2, node2, 3);
7793 xmlResetLastError();
7794 if (mem_base != xmlMemBlocks()) {
7795 printf("Leak of %d blocks found in xmlShellSave",
7796 xmlMemBlocks() - mem_base);
7797 test_ret++;
7798 printf(" %d", n_ctxt);
7799 printf(" %d", n_filename);
7800 printf(" %d", n_node);
7801 printf(" %d", n_node2);
7802 printf("\n");
7803 }
7804 }
7805 }
7806 }
7807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007808 function_tests++;
7809#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007810
Daniel Veillarda82b1822004-11-08 16:24:57 +00007811 return(test_ret);
7812}
7813
7814
7815static int
7816test_xmlShellValidate(void) {
7817 int test_ret = 0;
7818
William M. Brack21e4ef22005-01-02 09:53:13 +00007819#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007820 int mem_base;
7821 int ret_val;
7822 xmlShellCtxtPtr ctxt; /* the shell context */
7823 int n_ctxt;
7824 char * dtd; /* the DTD URI (optional) */
7825 int n_dtd;
7826 xmlNodePtr node; /* unused */
7827 int n_node;
7828 xmlNodePtr node2; /* unused */
7829 int n_node2;
7830
7831 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7832 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7833 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7834 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7835 mem_base = xmlMemBlocks();
7836 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7837 dtd = gen_char_ptr(n_dtd, 1);
7838 node = gen_xmlNodePtr(n_node, 2);
7839 node2 = gen_xmlNodePtr(n_node2, 3);
7840
7841 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7842 desret_int(ret_val);
7843 call_tests++;
7844 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7845 des_char_ptr(n_dtd, dtd, 1);
7846 des_xmlNodePtr(n_node, node, 2);
7847 des_xmlNodePtr(n_node2, node2, 3);
7848 xmlResetLastError();
7849 if (mem_base != xmlMemBlocks()) {
7850 printf("Leak of %d blocks found in xmlShellValidate",
7851 xmlMemBlocks() - mem_base);
7852 test_ret++;
7853 printf(" %d", n_ctxt);
7854 printf(" %d", n_dtd);
7855 printf(" %d", n_node);
7856 printf(" %d", n_node2);
7857 printf("\n");
7858 }
7859 }
7860 }
7861 }
7862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007863 function_tests++;
7864#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007865
Daniel Veillarda82b1822004-11-08 16:24:57 +00007866 return(test_ret);
7867}
7868
7869
7870static int
7871test_xmlShellWrite(void) {
7872 int test_ret = 0;
7873
William M. Brack21e4ef22005-01-02 09:53:13 +00007874#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007875 int mem_base;
7876 int ret_val;
7877 xmlShellCtxtPtr ctxt; /* the shell context */
7878 int n_ctxt;
7879 char * filename; /* the file name */
7880 int n_filename;
7881 xmlNodePtr node; /* a node in the tree */
7882 int n_node;
7883 xmlNodePtr node2; /* unused */
7884 int n_node2;
7885
7886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7887 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7888 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7889 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7890 mem_base = xmlMemBlocks();
7891 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7892 filename = gen_char_ptr(n_filename, 1);
7893 node = gen_xmlNodePtr(n_node, 2);
7894 node2 = gen_xmlNodePtr(n_node2, 3);
7895
7896 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7897 desret_int(ret_val);
7898 call_tests++;
7899 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7900 des_char_ptr(n_filename, filename, 1);
7901 des_xmlNodePtr(n_node, node, 2);
7902 des_xmlNodePtr(n_node2, node2, 3);
7903 xmlResetLastError();
7904 if (mem_base != xmlMemBlocks()) {
7905 printf("Leak of %d blocks found in xmlShellWrite",
7906 xmlMemBlocks() - mem_base);
7907 test_ret++;
7908 printf(" %d", n_ctxt);
7909 printf(" %d", n_filename);
7910 printf(" %d", n_node);
7911 printf(" %d", n_node2);
7912 printf("\n");
7913 }
7914 }
7915 }
7916 }
7917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007918 function_tests++;
7919#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007920
Daniel Veillarda82b1822004-11-08 16:24:57 +00007921 return(test_ret);
7922}
7923
7924static int
7925test_debugXML(void) {
7926 int test_ret = 0;
7927
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007928 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007929 test_ret += test_xmlBoolToText();
7930 test_ret += test_xmlDebugCheckDocument();
7931 test_ret += test_xmlDebugDumpAttr();
7932 test_ret += test_xmlDebugDumpAttrList();
7933 test_ret += test_xmlDebugDumpDTD();
7934 test_ret += test_xmlDebugDumpDocument();
7935 test_ret += test_xmlDebugDumpDocumentHead();
7936 test_ret += test_xmlDebugDumpEntities();
7937 test_ret += test_xmlDebugDumpNode();
7938 test_ret += test_xmlDebugDumpNodeList();
7939 test_ret += test_xmlDebugDumpOneNode();
7940 test_ret += test_xmlDebugDumpString();
7941 test_ret += test_xmlLsCountNode();
7942 test_ret += test_xmlLsOneNode();
7943 test_ret += test_xmlShell();
7944 test_ret += test_xmlShellBase();
7945 test_ret += test_xmlShellCat();
7946 test_ret += test_xmlShellDir();
7947 test_ret += test_xmlShellDu();
7948 test_ret += test_xmlShellList();
7949 test_ret += test_xmlShellLoad();
7950 test_ret += test_xmlShellPrintXPathResult();
7951 test_ret += test_xmlShellPwd();
7952 test_ret += test_xmlShellSave();
7953 test_ret += test_xmlShellValidate();
7954 test_ret += test_xmlShellWrite();
7955
7956 if (test_ret != 0)
7957 printf("Module debugXML: %d errors\n", test_ret);
7958 return(test_ret);
7959}
7960
7961static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007962test_xmlDictCleanup(void) {
7963 int test_ret = 0;
7964
7965 int mem_base;
7966
7967 mem_base = xmlMemBlocks();
7968
7969 xmlDictCleanup();
7970 call_tests++;
7971 xmlResetLastError();
7972 if (mem_base != xmlMemBlocks()) {
7973 printf("Leak of %d blocks found in xmlDictCleanup",
7974 xmlMemBlocks() - mem_base);
7975 test_ret++;
7976 printf("\n");
7977 }
7978 function_tests++;
7979
7980 return(test_ret);
7981}
7982
7983
7984static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007985test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007987
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007988 int mem_base;
7989 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007990
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007991 mem_base = xmlMemBlocks();
7992
7993 ret_val = xmlDictCreate();
7994 desret_xmlDictPtr(ret_val);
7995 call_tests++;
7996 xmlResetLastError();
7997 if (mem_base != xmlMemBlocks()) {
7998 printf("Leak of %d blocks found in xmlDictCreate",
7999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008000 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008001 printf("\n");
8002 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008004
Daniel Veillard42595322004-11-08 10:52:06 +00008005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008006}
8007
8008
8009static int
8010test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008012
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008013 int mem_base;
8014 xmlDictPtr ret_val;
8015 xmlDictPtr sub; /* an existing dictionnary */
8016 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008017
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008018 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8019 mem_base = xmlMemBlocks();
8020 sub = gen_xmlDictPtr(n_sub, 0);
8021
8022 ret_val = xmlDictCreateSub(sub);
8023 desret_xmlDictPtr(ret_val);
8024 call_tests++;
8025 des_xmlDictPtr(n_sub, sub, 0);
8026 xmlResetLastError();
8027 if (mem_base != xmlMemBlocks()) {
8028 printf("Leak of %d blocks found in xmlDictCreateSub",
8029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008030 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008031 printf(" %d", n_sub);
8032 printf("\n");
8033 }
8034 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008035 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008036
Daniel Veillard42595322004-11-08 10:52:06 +00008037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008038}
8039
8040
8041static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008042test_xmlDictExists(void) {
8043 int test_ret = 0;
8044
8045 int mem_base;
8046 const xmlChar * ret_val;
8047 xmlDictPtr dict; /* the dictionnary */
8048 int n_dict;
8049 xmlChar * name; /* the name of the userdata */
8050 int n_name;
8051 int len; /* the length of the name, if -1 it is recomputed */
8052 int n_len;
8053
8054 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8055 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8056 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8057 mem_base = xmlMemBlocks();
8058 dict = gen_xmlDictPtr(n_dict, 0);
8059 name = gen_const_xmlChar_ptr(n_name, 1);
8060 len = gen_int(n_len, 2);
8061
8062 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8063 desret_const_xmlChar_ptr(ret_val);
8064 call_tests++;
8065 des_xmlDictPtr(n_dict, dict, 0);
8066 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8067 des_int(n_len, len, 2);
8068 xmlResetLastError();
8069 if (mem_base != xmlMemBlocks()) {
8070 printf("Leak of %d blocks found in xmlDictExists",
8071 xmlMemBlocks() - mem_base);
8072 test_ret++;
8073 printf(" %d", n_dict);
8074 printf(" %d", n_name);
8075 printf(" %d", n_len);
8076 printf("\n");
8077 }
8078 }
8079 }
8080 }
8081 function_tests++;
8082
8083 return(test_ret);
8084}
8085
8086
8087static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008088test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008090
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008091 int mem_base;
8092 const xmlChar * ret_val;
8093 xmlDictPtr dict; /* the dictionnary */
8094 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008095 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008096 int n_name;
8097 int len; /* the length of the name, if -1 it is recomputed */
8098 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008099
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008100 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8101 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8102 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8103 mem_base = xmlMemBlocks();
8104 dict = gen_xmlDictPtr(n_dict, 0);
8105 name = gen_const_xmlChar_ptr(n_name, 1);
8106 len = gen_int(n_len, 2);
8107
William M. Brackf13f77f2004-11-12 16:03:48 +00008108 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008109 desret_const_xmlChar_ptr(ret_val);
8110 call_tests++;
8111 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008112 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008113 des_int(n_len, len, 2);
8114 xmlResetLastError();
8115 if (mem_base != xmlMemBlocks()) {
8116 printf("Leak of %d blocks found in xmlDictLookup",
8117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008118 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008119 printf(" %d", n_dict);
8120 printf(" %d", n_name);
8121 printf(" %d", n_len);
8122 printf("\n");
8123 }
8124 }
8125 }
8126 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008127 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008128
Daniel Veillard42595322004-11-08 10:52:06 +00008129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008130}
8131
8132
8133static int
8134test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008136
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008137 int mem_base;
8138 int ret_val;
8139 xmlDictPtr dict; /* the dictionnary */
8140 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008141 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008142 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008143
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008144 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8145 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8146 mem_base = xmlMemBlocks();
8147 dict = gen_xmlDictPtr(n_dict, 0);
8148 str = gen_const_xmlChar_ptr(n_str, 1);
8149
William M. Brackf13f77f2004-11-12 16:03:48 +00008150 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008151 desret_int(ret_val);
8152 call_tests++;
8153 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008154 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 xmlResetLastError();
8156 if (mem_base != xmlMemBlocks()) {
8157 printf("Leak of %d blocks found in xmlDictOwns",
8158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008160 printf(" %d", n_dict);
8161 printf(" %d", n_str);
8162 printf("\n");
8163 }
8164 }
8165 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008166 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008167
Daniel Veillard42595322004-11-08 10:52:06 +00008168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008169}
8170
8171
8172static int
8173test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008175
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008176 int mem_base;
8177 const xmlChar * ret_val;
8178 xmlDictPtr dict; /* the dictionnary */
8179 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008180 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008181 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008182 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008184
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008185 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8186 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8188 mem_base = xmlMemBlocks();
8189 dict = gen_xmlDictPtr(n_dict, 0);
8190 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8191 name = gen_const_xmlChar_ptr(n_name, 2);
8192
William M. Brackf13f77f2004-11-12 16:03:48 +00008193 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008194 desret_const_xmlChar_ptr(ret_val);
8195 call_tests++;
8196 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008197 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008199 xmlResetLastError();
8200 if (mem_base != xmlMemBlocks()) {
8201 printf("Leak of %d blocks found in xmlDictQLookup",
8202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008203 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008204 printf(" %d", n_dict);
8205 printf(" %d", n_prefix);
8206 printf(" %d", n_name);
8207 printf("\n");
8208 }
8209 }
8210 }
8211 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008212 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008213
Daniel Veillard42595322004-11-08 10:52:06 +00008214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008215}
8216
8217
8218static int
8219test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008221
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008222 int mem_base;
8223 int ret_val;
8224 xmlDictPtr dict; /* the dictionnary */
8225 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008226
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008227 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8228 mem_base = xmlMemBlocks();
8229 dict = gen_xmlDictPtr(n_dict, 0);
8230
8231 ret_val = xmlDictReference(dict);
8232 xmlDictFree(dict);
8233 desret_int(ret_val);
8234 call_tests++;
8235 des_xmlDictPtr(n_dict, dict, 0);
8236 xmlResetLastError();
8237 if (mem_base != xmlMemBlocks()) {
8238 printf("Leak of %d blocks found in xmlDictReference",
8239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008240 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008241 printf(" %d", n_dict);
8242 printf("\n");
8243 }
8244 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008246
Daniel Veillard42595322004-11-08 10:52:06 +00008247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008248}
8249
8250
8251static int
8252test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008254
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008255 int mem_base;
8256 int ret_val;
8257 xmlDictPtr dict; /* the dictionnary */
8258 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008259
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008260 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8261 mem_base = xmlMemBlocks();
8262 dict = gen_xmlDictPtr(n_dict, 0);
8263
8264 ret_val = xmlDictSize(dict);
8265 desret_int(ret_val);
8266 call_tests++;
8267 des_xmlDictPtr(n_dict, dict, 0);
8268 xmlResetLastError();
8269 if (mem_base != xmlMemBlocks()) {
8270 printf("Leak of %d blocks found in xmlDictSize",
8271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008272 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008273 printf(" %d", n_dict);
8274 printf("\n");
8275 }
8276 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008278
Daniel Veillard42595322004-11-08 10:52:06 +00008279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008280}
8281
8282static int
8283test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008285
Daniel Veillard2ae13382005-01-25 23:45:06 +00008286 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8287 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008288 test_ret += test_xmlDictCreate();
8289 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008290 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008291 test_ret += test_xmlDictLookup();
8292 test_ret += test_xmlDictOwns();
8293 test_ret += test_xmlDictQLookup();
8294 test_ret += test_xmlDictReference();
8295 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008296
Daniel Veillard42595322004-11-08 10:52:06 +00008297 if (test_ret != 0)
8298 printf("Module dict: %d errors\n", test_ret);
8299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008300}
8301
8302static int
8303test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008305
William M. Brack21e4ef22005-01-02 09:53:13 +00008306#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008307#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008308 int mem_base;
8309 int ret_val;
8310 unsigned char * out; /* a pointer to an array of bytes to store the result */
8311 int n_out;
8312 int * outlen; /* the length of @out */
8313 int n_outlen;
8314 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8315 int n_in;
8316 int * inlen; /* the length of @in */
8317 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008318
Daniel Veillardce682bc2004-11-05 17:22:25 +00008319 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8320 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8321 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8322 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8323 mem_base = xmlMemBlocks();
8324 out = gen_unsigned_char_ptr(n_out, 0);
8325 outlen = gen_int_ptr(n_outlen, 1);
8326 in = gen_const_unsigned_char_ptr(n_in, 2);
8327 inlen = gen_int_ptr(n_inlen, 3);
8328
William M. Brackf13f77f2004-11-12 16:03:48 +00008329 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008330 desret_int(ret_val);
8331 call_tests++;
8332 des_unsigned_char_ptr(n_out, out, 0);
8333 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008334 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008335 des_int_ptr(n_inlen, inlen, 3);
8336 xmlResetLastError();
8337 if (mem_base != xmlMemBlocks()) {
8338 printf("Leak of %d blocks found in UTF8Toisolat1",
8339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008340 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008341 printf(" %d", n_out);
8342 printf(" %d", n_outlen);
8343 printf(" %d", n_in);
8344 printf(" %d", n_inlen);
8345 printf("\n");
8346 }
8347 }
8348 }
8349 }
8350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008351 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008352#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008353#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008354
Daniel Veillard42595322004-11-08 10:52:06 +00008355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008356}
8357
8358
8359static int
8360test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008362
Daniel Veillardce682bc2004-11-05 17:22:25 +00008363 int mem_base;
8364 int ret_val;
8365 unsigned char * out; /* a pointer to an array of bytes to store the result */
8366 int n_out;
8367 int * outlen; /* the length of @out */
8368 int n_outlen;
8369 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8370 int n_in;
8371 int * inlen; /* the length of @in */
8372 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373
Daniel Veillardce682bc2004-11-05 17:22:25 +00008374 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8375 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8376 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8377 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8378 mem_base = xmlMemBlocks();
8379 out = gen_unsigned_char_ptr(n_out, 0);
8380 outlen = gen_int_ptr(n_outlen, 1);
8381 in = gen_const_unsigned_char_ptr(n_in, 2);
8382 inlen = gen_int_ptr(n_inlen, 3);
8383
William M. Brackf13f77f2004-11-12 16:03:48 +00008384 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008385 desret_int(ret_val);
8386 call_tests++;
8387 des_unsigned_char_ptr(n_out, out, 0);
8388 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008389 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008390 des_int_ptr(n_inlen, inlen, 3);
8391 xmlResetLastError();
8392 if (mem_base != xmlMemBlocks()) {
8393 printf("Leak of %d blocks found in isolat1ToUTF8",
8394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008395 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008396 printf(" %d", n_out);
8397 printf(" %d", n_outlen);
8398 printf(" %d", n_in);
8399 printf(" %d", n_inlen);
8400 printf("\n");
8401 }
8402 }
8403 }
8404 }
8405 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008407
Daniel Veillard42595322004-11-08 10:52:06 +00008408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008409}
8410
8411
8412static int
8413test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008415
8416 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008417 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008418 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008419 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008420 int n_alias;
8421
8422 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8423 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008424 name = gen_const_char_ptr(n_name, 0);
8425 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008426
William M. Brackf13f77f2004-11-12 16:03:48 +00008427 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008428 desret_int(ret_val);
8429 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008430 des_const_char_ptr(n_name, (const char *)name, 0);
8431 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008432 xmlResetLastError();
8433 }
8434 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008435 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008436
Daniel Veillard42595322004-11-08 10:52:06 +00008437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008438}
8439
8440
Daniel Veillardce682bc2004-11-05 17:22:25 +00008441#define gen_nb_xmlCharEncodingHandler_ptr 1
8442static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8443 return(NULL);
8444}
8445static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8446}
8447
Daniel Veillardd93f6252004-11-02 15:53:51 +00008448static int
8449test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008451
Daniel Veillardce682bc2004-11-05 17:22:25 +00008452 int mem_base;
8453 int ret_val;
8454 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8455 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008456
Daniel Veillardce682bc2004-11-05 17:22:25 +00008457 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8458 mem_base = xmlMemBlocks();
8459 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8460
8461 ret_val = xmlCharEncCloseFunc(handler);
8462 desret_int(ret_val);
8463 call_tests++;
8464 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8465 xmlResetLastError();
8466 if (mem_base != xmlMemBlocks()) {
8467 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008470 printf(" %d", n_handler);
8471 printf("\n");
8472 }
8473 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008474 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008475
Daniel Veillard42595322004-11-08 10:52:06 +00008476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008477}
8478
8479
8480static int
8481test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008483
Daniel Veillardce682bc2004-11-05 17:22:25 +00008484 int mem_base;
8485 int ret_val;
8486 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8487 int n_handler;
8488 xmlBufferPtr out; /* an xmlBuffer for the output. */
8489 int n_out;
8490 xmlBufferPtr in; /* an xmlBuffer for the input */
8491 int n_in;
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 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8495 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8496 mem_base = xmlMemBlocks();
8497 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8498 out = gen_xmlBufferPtr(n_out, 1);
8499 in = gen_xmlBufferPtr(n_in, 2);
8500
8501 ret_val = xmlCharEncFirstLine(handler, out, in);
8502 desret_int(ret_val);
8503 call_tests++;
8504 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8505 des_xmlBufferPtr(n_out, out, 1);
8506 des_xmlBufferPtr(n_in, in, 2);
8507 xmlResetLastError();
8508 if (mem_base != xmlMemBlocks()) {
8509 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008511 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008512 printf(" %d", n_handler);
8513 printf(" %d", n_out);
8514 printf(" %d", n_in);
8515 printf("\n");
8516 }
8517 }
8518 }
8519 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008521
Daniel Veillard42595322004-11-08 10:52:06 +00008522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008523}
8524
8525
8526static int
8527test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008529
Daniel Veillardce682bc2004-11-05 17:22:25 +00008530 int mem_base;
8531 int ret_val;
8532 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8533 int n_handler;
8534 xmlBufferPtr out; /* an xmlBuffer for the output. */
8535 int n_out;
8536 xmlBufferPtr in; /* an xmlBuffer for the input */
8537 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008538
Daniel Veillardce682bc2004-11-05 17:22:25 +00008539 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8540 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8541 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8542 mem_base = xmlMemBlocks();
8543 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8544 out = gen_xmlBufferPtr(n_out, 1);
8545 in = gen_xmlBufferPtr(n_in, 2);
8546
8547 ret_val = xmlCharEncInFunc(handler, out, in);
8548 desret_int(ret_val);
8549 call_tests++;
8550 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8551 des_xmlBufferPtr(n_out, out, 1);
8552 des_xmlBufferPtr(n_in, in, 2);
8553 xmlResetLastError();
8554 if (mem_base != xmlMemBlocks()) {
8555 printf("Leak of %d blocks found in xmlCharEncInFunc",
8556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008557 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008558 printf(" %d", n_handler);
8559 printf(" %d", n_out);
8560 printf(" %d", n_in);
8561 printf("\n");
8562 }
8563 }
8564 }
8565 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008566 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008567
Daniel Veillard42595322004-11-08 10:52:06 +00008568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008569}
8570
8571
8572static int
8573test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008575
Daniel Veillardce682bc2004-11-05 17:22:25 +00008576 int mem_base;
8577 int ret_val;
8578 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8579 int n_handler;
8580 xmlBufferPtr out; /* an xmlBuffer for the output. */
8581 int n_out;
8582 xmlBufferPtr in; /* an xmlBuffer for the input */
8583 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584
Daniel Veillardce682bc2004-11-05 17:22:25 +00008585 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8586 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8587 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8588 mem_base = xmlMemBlocks();
8589 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8590 out = gen_xmlBufferPtr(n_out, 1);
8591 in = gen_xmlBufferPtr(n_in, 2);
8592
8593 ret_val = xmlCharEncOutFunc(handler, out, in);
8594 desret_int(ret_val);
8595 call_tests++;
8596 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8597 des_xmlBufferPtr(n_out, out, 1);
8598 des_xmlBufferPtr(n_in, in, 2);
8599 xmlResetLastError();
8600 if (mem_base != xmlMemBlocks()) {
8601 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008603 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008604 printf(" %d", n_handler);
8605 printf(" %d", n_out);
8606 printf(" %d", n_in);
8607 printf("\n");
8608 }
8609 }
8610 }
8611 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008612 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008613
Daniel Veillard42595322004-11-08 10:52:06 +00008614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615}
8616
8617
8618static int
8619test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008621
8622
8623
8624 xmlCleanupCharEncodingHandlers();
8625 call_tests++;
8626 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008628
Daniel Veillard42595322004-11-08 10:52:06 +00008629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008630}
8631
8632
8633static int
8634test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008636
8637 int mem_base;
8638
8639 mem_base = xmlMemBlocks();
8640
8641 xmlCleanupEncodingAliases();
8642 call_tests++;
8643 xmlResetLastError();
8644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008645 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008648 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008649 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008651
Daniel Veillard42595322004-11-08 10:52:06 +00008652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008653}
8654
8655
8656static int
8657test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008659
8660 int mem_base;
8661 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008662 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008663 int n_alias;
8664
8665 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008667 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008668
William M. Brackf13f77f2004-11-12 16:03:48 +00008669 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008670 desret_int(ret_val);
8671 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008672 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008673 xmlResetLastError();
8674 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008675 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008677 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008678 printf(" %d", n_alias);
8679 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008680 }
8681 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008683
Daniel Veillard42595322004-11-08 10:52:06 +00008684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685}
8686
8687
8688static int
8689test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008691
Daniel Veillardce682bc2004-11-05 17:22:25 +00008692 int mem_base;
8693 xmlCharEncoding ret_val;
8694 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). */
8695 int n_in;
8696 int len; /* pointer to the length of the buffer */
8697 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008698
Daniel Veillardce682bc2004-11-05 17:22:25 +00008699 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8700 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8701 mem_base = xmlMemBlocks();
8702 in = gen_const_unsigned_char_ptr(n_in, 0);
8703 len = gen_int(n_len, 1);
8704
William M. Brackf13f77f2004-11-12 16:03:48 +00008705 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008706 desret_xmlCharEncoding(ret_val);
8707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008708 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008709 des_int(n_len, len, 1);
8710 xmlResetLastError();
8711 if (mem_base != xmlMemBlocks()) {
8712 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008714 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008715 printf(" %d", n_in);
8716 printf(" %d", n_len);
8717 printf("\n");
8718 }
8719 }
8720 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008722
Daniel Veillard42595322004-11-08 10:52:06 +00008723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008724}
8725
8726
8727static int
8728test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008730
8731
8732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734}
8735
8736
8737static int
8738test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008740
8741
8742 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008744}
8745
8746
8747static int
8748test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008750
Daniel Veillard3d97e662004-11-04 10:49:00 +00008751 int mem_base;
8752 const char * ret_val;
8753 xmlCharEncoding enc; /* the encoding */
8754 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755
Daniel Veillard3d97e662004-11-04 10:49:00 +00008756 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8757 mem_base = xmlMemBlocks();
8758 enc = gen_xmlCharEncoding(n_enc, 0);
8759
8760 ret_val = xmlGetCharEncodingName(enc);
8761 desret_const_char_ptr(ret_val);
8762 call_tests++;
8763 des_xmlCharEncoding(n_enc, enc, 0);
8764 xmlResetLastError();
8765 if (mem_base != xmlMemBlocks()) {
8766 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008768 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008769 printf(" %d", n_enc);
8770 printf("\n");
8771 }
8772 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008773 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008774
Daniel Veillard42595322004-11-08 10:52:06 +00008775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008776}
8777
8778
8779static int
8780test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008782
8783 int mem_base;
8784 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008785 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008786 int n_alias;
8787
8788 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008790 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791
William M. Brackf13f77f2004-11-12 16:03:48 +00008792 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008793 desret_const_char_ptr(ret_val);
8794 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008795 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008796 xmlResetLastError();
8797 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008798 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008800 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008801 printf(" %d", n_alias);
8802 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008803 }
8804 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008806
Daniel Veillard42595322004-11-08 10:52:06 +00008807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808}
8809
8810
8811static int
8812test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008814
8815
8816
8817 xmlInitCharEncodingHandlers();
8818 call_tests++;
8819 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008820 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008821
Daniel Veillard42595322004-11-08 10:52:06 +00008822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823}
8824
8825
8826static int
8827test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829
8830
8831 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008833}
8834
8835
8836static int
8837test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008839
Daniel Veillard3d97e662004-11-04 10:49:00 +00008840 int mem_base;
8841 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008842 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008843 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844
Daniel Veillard3d97e662004-11-04 10:49:00 +00008845 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8846 mem_base = xmlMemBlocks();
8847 name = gen_const_char_ptr(n_name, 0);
8848
William M. Brackf13f77f2004-11-12 16:03:48 +00008849 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008850 desret_xmlCharEncoding(ret_val);
8851 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008852 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008853 xmlResetLastError();
8854 if (mem_base != xmlMemBlocks()) {
8855 printf("Leak of %d blocks found in xmlParseCharEncoding",
8856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008857 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008858 printf(" %d", n_name);
8859 printf("\n");
8860 }
8861 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008862 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008863
Daniel Veillard42595322004-11-08 10:52:06 +00008864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008865}
8866
8867
Daniel Veillardce682bc2004-11-05 17:22:25 +00008868#define gen_nb_xmlCharEncodingHandlerPtr 1
8869static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8870 return(NULL);
8871}
8872static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8873}
8874
Daniel Veillardd93f6252004-11-02 15:53:51 +00008875static int
8876test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008878
Daniel Veillardce682bc2004-11-05 17:22:25 +00008879 int mem_base;
8880 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8881 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008882
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8884 mem_base = xmlMemBlocks();
8885 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8886
8887 xmlRegisterCharEncodingHandler(handler);
8888 call_tests++;
8889 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8890 xmlResetLastError();
8891 if (mem_base != xmlMemBlocks()) {
8892 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008894 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008895 printf(" %d", n_handler);
8896 printf("\n");
8897 }
8898 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008900
Daniel Veillard42595322004-11-08 10:52:06 +00008901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008902}
8903
8904static int
8905test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008908 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008909 test_ret += test_UTF8Toisolat1();
8910 test_ret += test_isolat1ToUTF8();
8911 test_ret += test_xmlAddEncodingAlias();
8912 test_ret += test_xmlCharEncCloseFunc();
8913 test_ret += test_xmlCharEncFirstLine();
8914 test_ret += test_xmlCharEncInFunc();
8915 test_ret += test_xmlCharEncOutFunc();
8916 test_ret += test_xmlCleanupCharEncodingHandlers();
8917 test_ret += test_xmlCleanupEncodingAliases();
8918 test_ret += test_xmlDelEncodingAlias();
8919 test_ret += test_xmlDetectCharEncoding();
8920 test_ret += test_xmlFindCharEncodingHandler();
8921 test_ret += test_xmlGetCharEncodingHandler();
8922 test_ret += test_xmlGetCharEncodingName();
8923 test_ret += test_xmlGetEncodingAlias();
8924 test_ret += test_xmlInitCharEncodingHandlers();
8925 test_ret += test_xmlNewCharEncodingHandler();
8926 test_ret += test_xmlParseCharEncoding();
8927 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008928
Daniel Veillard42595322004-11-08 10:52:06 +00008929 if (test_ret != 0)
8930 printf("Module encoding: %d errors\n", test_ret);
8931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008932}
8933
8934static int
8935test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008937
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008938 int mem_base;
8939 xmlEntityPtr ret_val;
8940 xmlDocPtr doc; /* the document */
8941 int n_doc;
8942 xmlChar * name; /* the entity name */
8943 int n_name;
8944 int type; /* the entity type XML_xxx_yyy_ENTITY */
8945 int n_type;
8946 xmlChar * ExternalID; /* the entity external ID if available */
8947 int n_ExternalID;
8948 xmlChar * SystemID; /* the entity system ID if available */
8949 int n_SystemID;
8950 xmlChar * content; /* the entity content */
8951 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008953 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8954 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8955 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8956 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8957 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8958 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8959 mem_base = xmlMemBlocks();
8960 doc = gen_xmlDocPtr(n_doc, 0);
8961 name = gen_const_xmlChar_ptr(n_name, 1);
8962 type = gen_int(n_type, 2);
8963 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8964 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8965 content = gen_const_xmlChar_ptr(n_content, 5);
8966
William M. Brackf13f77f2004-11-12 16:03:48 +00008967 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008968 desret_xmlEntityPtr(ret_val);
8969 call_tests++;
8970 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008971 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008972 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008973 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8974 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8975 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008976 xmlResetLastError();
8977 if (mem_base != xmlMemBlocks()) {
8978 printf("Leak of %d blocks found in xmlAddDocEntity",
8979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008980 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008981 printf(" %d", n_doc);
8982 printf(" %d", n_name);
8983 printf(" %d", n_type);
8984 printf(" %d", n_ExternalID);
8985 printf(" %d", n_SystemID);
8986 printf(" %d", n_content);
8987 printf("\n");
8988 }
8989 }
8990 }
8991 }
8992 }
8993 }
8994 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008996
Daniel Veillard42595322004-11-08 10:52:06 +00008997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008998}
8999
9000
9001static int
9002test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009004
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009005 int mem_base;
9006 xmlEntityPtr ret_val;
9007 xmlDocPtr doc; /* the document */
9008 int n_doc;
9009 xmlChar * name; /* the entity name */
9010 int n_name;
9011 int type; /* the entity type XML_xxx_yyy_ENTITY */
9012 int n_type;
9013 xmlChar * ExternalID; /* the entity external ID if available */
9014 int n_ExternalID;
9015 xmlChar * SystemID; /* the entity system ID if available */
9016 int n_SystemID;
9017 xmlChar * content; /* the entity content */
9018 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009020 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9022 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9023 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9024 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9025 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9026 mem_base = xmlMemBlocks();
9027 doc = gen_xmlDocPtr(n_doc, 0);
9028 name = gen_const_xmlChar_ptr(n_name, 1);
9029 type = gen_int(n_type, 2);
9030 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9031 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9032 content = gen_const_xmlChar_ptr(n_content, 5);
9033
William M. Brackf13f77f2004-11-12 16:03:48 +00009034 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009035 desret_xmlEntityPtr(ret_val);
9036 call_tests++;
9037 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009038 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009039 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009040 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9041 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9042 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009043 xmlResetLastError();
9044 if (mem_base != xmlMemBlocks()) {
9045 printf("Leak of %d blocks found in xmlAddDtdEntity",
9046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009047 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009048 printf(" %d", n_doc);
9049 printf(" %d", n_name);
9050 printf(" %d", n_type);
9051 printf(" %d", n_ExternalID);
9052 printf(" %d", n_SystemID);
9053 printf(" %d", n_content);
9054 printf("\n");
9055 }
9056 }
9057 }
9058 }
9059 }
9060 }
9061 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009062 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009063
Daniel Veillard42595322004-11-08 10:52:06 +00009064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009065}
9066
9067
9068static int
9069test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009071
William M. Brack21e4ef22005-01-02 09:53:13 +00009072#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009073#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009074 int mem_base;
9075
9076 mem_base = xmlMemBlocks();
9077
9078 xmlCleanupPredefinedEntities();
9079 call_tests++;
9080 xmlResetLastError();
9081 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009082 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009084 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009085 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009087 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009088#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009089#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009090
Daniel Veillard42595322004-11-08 10:52:06 +00009091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009092}
9093
9094
Daniel Veillardce682bc2004-11-05 17:22:25 +00009095#define gen_nb_xmlEntitiesTablePtr 1
9096static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9097 return(NULL);
9098}
9099static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9100}
9101
Daniel Veillardd93f6252004-11-02 15:53:51 +00009102static int
9103test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009105
9106
9107 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009109}
9110
9111
9112static int
9113test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009115
9116
9117 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009119}
9120
9121
9122static int
9123test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009125
William M. Brack21e4ef22005-01-02 09:53:13 +00009126#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009127 int mem_base;
9128 xmlBufferPtr buf; /* An XML buffer. */
9129 int n_buf;
9130 xmlEntitiesTablePtr table; /* An entity table */
9131 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009132
Daniel Veillardce682bc2004-11-05 17:22:25 +00009133 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9134 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9135 mem_base = xmlMemBlocks();
9136 buf = gen_xmlBufferPtr(n_buf, 0);
9137 table = gen_xmlEntitiesTablePtr(n_table, 1);
9138
9139 xmlDumpEntitiesTable(buf, table);
9140 call_tests++;
9141 des_xmlBufferPtr(n_buf, buf, 0);
9142 des_xmlEntitiesTablePtr(n_table, table, 1);
9143 xmlResetLastError();
9144 if (mem_base != xmlMemBlocks()) {
9145 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009147 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009148 printf(" %d", n_buf);
9149 printf(" %d", n_table);
9150 printf("\n");
9151 }
9152 }
9153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009154 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009155#endif
9156
Daniel Veillard42595322004-11-08 10:52:06 +00009157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009158}
9159
9160
Daniel Veillardce682bc2004-11-05 17:22:25 +00009161#define gen_nb_xmlEntityPtr 1
9162static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9163 return(NULL);
9164}
9165static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9166}
9167
Daniel Veillardd93f6252004-11-02 15:53:51 +00009168static int
9169test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009171
William M. Brack21e4ef22005-01-02 09:53:13 +00009172#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009173 int mem_base;
9174 xmlBufferPtr buf; /* An XML buffer. */
9175 int n_buf;
9176 xmlEntityPtr ent; /* An entity table */
9177 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009178
Daniel Veillardce682bc2004-11-05 17:22:25 +00009179 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9180 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9181 mem_base = xmlMemBlocks();
9182 buf = gen_xmlBufferPtr(n_buf, 0);
9183 ent = gen_xmlEntityPtr(n_ent, 1);
9184
9185 xmlDumpEntityDecl(buf, ent);
9186 call_tests++;
9187 des_xmlBufferPtr(n_buf, buf, 0);
9188 des_xmlEntityPtr(n_ent, ent, 1);
9189 xmlResetLastError();
9190 if (mem_base != xmlMemBlocks()) {
9191 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009193 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 printf(" %d", n_buf);
9195 printf(" %d", n_ent);
9196 printf("\n");
9197 }
9198 }
9199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009200 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009201#endif
9202
Daniel Veillard42595322004-11-08 10:52:06 +00009203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009204}
9205
9206
9207static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009208test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009210
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009211 int mem_base;
9212 xmlChar * ret_val;
9213 xmlDocPtr doc; /* the document containing the string */
9214 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009215 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009216 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009217
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009218 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9219 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009221 doc = gen_xmlDocPtr(n_doc, 0);
9222 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009223
William M. Brackf13f77f2004-11-12 16:03:48 +00009224 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009225 desret_xmlChar_ptr(ret_val);
9226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009227 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009228 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009229 xmlResetLastError();
9230 if (mem_base != xmlMemBlocks()) {
9231 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009233 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009234 printf(" %d", n_doc);
9235 printf(" %d", n_input);
9236 printf("\n");
9237 }
9238 }
9239 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009241
Daniel Veillard42595322004-11-08 10:52:06 +00009242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243}
9244
9245
9246static int
9247test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009249
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009250 int mem_base;
9251 xmlChar * ret_val;
9252 xmlDocPtr doc; /* the document containing the string */
9253 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009254 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009255 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009256
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009257 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9258 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009260 doc = gen_xmlDocPtr(n_doc, 0);
9261 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009262
William M. Brackf13f77f2004-11-12 16:03:48 +00009263 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009264 desret_xmlChar_ptr(ret_val);
9265 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009266 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009267 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009268 xmlResetLastError();
9269 if (mem_base != xmlMemBlocks()) {
9270 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009272 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009273 printf(" %d", n_doc);
9274 printf(" %d", n_input);
9275 printf("\n");
9276 }
9277 }
9278 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009279 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009280
Daniel Veillard42595322004-11-08 10:52:06 +00009281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009282}
9283
9284
9285static int
9286test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009288
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009289 int mem_base;
9290 xmlEntityPtr ret_val;
9291 xmlDocPtr doc; /* the document referencing the entity */
9292 int n_doc;
9293 xmlChar * name; /* the entity name */
9294 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009295
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9297 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9298 mem_base = xmlMemBlocks();
9299 doc = gen_xmlDocPtr(n_doc, 0);
9300 name = gen_const_xmlChar_ptr(n_name, 1);
9301
William M. Brackf13f77f2004-11-12 16:03:48 +00009302 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009303 desret_xmlEntityPtr(ret_val);
9304 call_tests++;
9305 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009306 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009307 xmlResetLastError();
9308 if (mem_base != xmlMemBlocks()) {
9309 printf("Leak of %d blocks found in xmlGetDocEntity",
9310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009311 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009312 printf(" %d", n_doc);
9313 printf(" %d", n_name);
9314 printf("\n");
9315 }
9316 }
9317 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009318 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009319
Daniel Veillard42595322004-11-08 10:52:06 +00009320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009321}
9322
9323
9324static int
9325test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009327
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009328 int mem_base;
9329 xmlEntityPtr ret_val;
9330 xmlDocPtr doc; /* the document referencing the entity */
9331 int n_doc;
9332 xmlChar * name; /* the entity name */
9333 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009334
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009335 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9336 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9337 mem_base = xmlMemBlocks();
9338 doc = gen_xmlDocPtr(n_doc, 0);
9339 name = gen_const_xmlChar_ptr(n_name, 1);
9340
William M. Brackf13f77f2004-11-12 16:03:48 +00009341 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009342 desret_xmlEntityPtr(ret_val);
9343 call_tests++;
9344 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009345 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009346 xmlResetLastError();
9347 if (mem_base != xmlMemBlocks()) {
9348 printf("Leak of %d blocks found in xmlGetDtdEntity",
9349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009350 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009351 printf(" %d", n_doc);
9352 printf(" %d", n_name);
9353 printf("\n");
9354 }
9355 }
9356 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009358
Daniel Veillard42595322004-11-08 10:52:06 +00009359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009360}
9361
9362
9363static int
9364test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009366
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009367 int mem_base;
9368 xmlEntityPtr ret_val;
9369 xmlDocPtr doc; /* the document referencing the entity */
9370 int n_doc;
9371 xmlChar * name; /* the entity name */
9372 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009373
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009374 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9375 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9376 mem_base = xmlMemBlocks();
9377 doc = gen_xmlDocPtr(n_doc, 0);
9378 name = gen_const_xmlChar_ptr(n_name, 1);
9379
William M. Brackf13f77f2004-11-12 16:03:48 +00009380 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009381 desret_xmlEntityPtr(ret_val);
9382 call_tests++;
9383 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009384 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009385 xmlResetLastError();
9386 if (mem_base != xmlMemBlocks()) {
9387 printf("Leak of %d blocks found in xmlGetParameterEntity",
9388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009389 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009390 printf(" %d", n_doc);
9391 printf(" %d", n_name);
9392 printf("\n");
9393 }
9394 }
9395 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009397
Daniel Veillard42595322004-11-08 10:52:06 +00009398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009399}
9400
9401
9402static int
9403test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009405
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009406 int mem_base;
9407 xmlEntityPtr ret_val;
9408 xmlChar * name; /* the entity name */
9409 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009410
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009411 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9412 mem_base = xmlMemBlocks();
9413 name = gen_const_xmlChar_ptr(n_name, 0);
9414
William M. Brackf13f77f2004-11-12 16:03:48 +00009415 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009416 desret_xmlEntityPtr(ret_val);
9417 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009418 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009419 xmlResetLastError();
9420 if (mem_base != xmlMemBlocks()) {
9421 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009423 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009424 printf(" %d", n_name);
9425 printf("\n");
9426 }
9427 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009429
Daniel Veillard42595322004-11-08 10:52:06 +00009430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431}
9432
9433
9434static int
9435test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009437
William M. Brack21e4ef22005-01-02 09:53:13 +00009438#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009439#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009440 int mem_base;
9441
9442 mem_base = xmlMemBlocks();
9443
9444 xmlInitializePredefinedEntities();
9445 call_tests++;
9446 xmlResetLastError();
9447 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009448 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009450 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009451 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009453 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009454#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009455#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009456
Daniel Veillard42595322004-11-08 10:52:06 +00009457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009458}
9459
9460static int
9461test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009463
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009464 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009465 test_ret += test_xmlAddDocEntity();
9466 test_ret += test_xmlAddDtdEntity();
9467 test_ret += test_xmlCleanupPredefinedEntities();
9468 test_ret += test_xmlCopyEntitiesTable();
9469 test_ret += test_xmlCreateEntitiesTable();
9470 test_ret += test_xmlDumpEntitiesTable();
9471 test_ret += test_xmlDumpEntityDecl();
9472 test_ret += test_xmlEncodeEntitiesReentrant();
9473 test_ret += test_xmlEncodeSpecialChars();
9474 test_ret += test_xmlGetDocEntity();
9475 test_ret += test_xmlGetDtdEntity();
9476 test_ret += test_xmlGetParameterEntity();
9477 test_ret += test_xmlGetPredefinedEntity();
9478 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009479
Daniel Veillard42595322004-11-08 10:52:06 +00009480 if (test_ret != 0)
9481 printf("Module entities: %d errors\n", test_ret);
9482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483}
9484
9485static int
9486test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009488
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009489 int mem_base;
9490 int ret_val;
9491 xmlHashTablePtr table; /* the hash table */
9492 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009493 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009494 int n_name;
9495 void * userdata; /* a pointer to the userdata */
9496 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009497
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009498 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9499 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9500 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9501 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009502 table = gen_xmlHashTablePtr(n_table, 0);
9503 name = gen_const_xmlChar_ptr(n_name, 1);
9504 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009505
William M. Brackf13f77f2004-11-12 16:03:48 +00009506 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009507 desret_int(ret_val);
9508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009509 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009510 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009511 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009512 xmlResetLastError();
9513 if (mem_base != xmlMemBlocks()) {
9514 printf("Leak of %d blocks found in xmlHashAddEntry",
9515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009517 printf(" %d", n_table);
9518 printf(" %d", n_name);
9519 printf(" %d", n_userdata);
9520 printf("\n");
9521 }
9522 }
9523 }
9524 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009525 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009526
Daniel Veillard42595322004-11-08 10:52:06 +00009527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009528}
9529
9530
9531static int
9532test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009534
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009535 int mem_base;
9536 int ret_val;
9537 xmlHashTablePtr table; /* the hash table */
9538 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009539 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009540 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009541 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009542 int n_name2;
9543 void * userdata; /* a pointer to the userdata */
9544 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009545
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009546 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9548 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9549 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009551 table = gen_xmlHashTablePtr(n_table, 0);
9552 name = gen_const_xmlChar_ptr(n_name, 1);
9553 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9554 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009555
William M. Brackf13f77f2004-11-12 16:03:48 +00009556 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009557 desret_int(ret_val);
9558 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009559 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009560 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9561 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009562 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009563 xmlResetLastError();
9564 if (mem_base != xmlMemBlocks()) {
9565 printf("Leak of %d blocks found in xmlHashAddEntry2",
9566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009567 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009568 printf(" %d", n_table);
9569 printf(" %d", n_name);
9570 printf(" %d", n_name2);
9571 printf(" %d", n_userdata);
9572 printf("\n");
9573 }
9574 }
9575 }
9576 }
9577 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009578 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009579
Daniel Veillard42595322004-11-08 10:52:06 +00009580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009581}
9582
9583
9584static int
9585test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009587
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009588 int mem_base;
9589 int ret_val;
9590 xmlHashTablePtr table; /* the hash table */
9591 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009592 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009593 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009594 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009595 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009596 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009597 int n_name3;
9598 void * userdata; /* a pointer to the userdata */
9599 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009600
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009601 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9602 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9603 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9604 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9605 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9606 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009607 table = gen_xmlHashTablePtr(n_table, 0);
9608 name = gen_const_xmlChar_ptr(n_name, 1);
9609 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9610 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9611 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612
William M. Brackf13f77f2004-11-12 16:03:48 +00009613 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009614 desret_int(ret_val);
9615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009616 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009617 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9618 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9619 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009620 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009621 xmlResetLastError();
9622 if (mem_base != xmlMemBlocks()) {
9623 printf("Leak of %d blocks found in xmlHashAddEntry3",
9624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009625 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009626 printf(" %d", n_table);
9627 printf(" %d", n_name);
9628 printf(" %d", n_name2);
9629 printf(" %d", n_name3);
9630 printf(" %d", n_userdata);
9631 printf("\n");
9632 }
9633 }
9634 }
9635 }
9636 }
9637 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009638 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009639
Daniel Veillard42595322004-11-08 10:52:06 +00009640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009641}
9642
9643
9644static int
9645test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009647
9648
9649 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009651}
9652
9653
9654static int
9655test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009657
9658
9659 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009661}
9662
9663
9664static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009665test_xmlHashCreateDict(void) {
9666 int test_ret = 0;
9667
9668
9669 /* missing type support */
9670 return(test_ret);
9671}
9672
9673
9674static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009675test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009677
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009678 int mem_base;
9679 void * ret_val;
9680 xmlHashTablePtr table; /* the hash table */
9681 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009682 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009683 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009684
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009685 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9686 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009688 table = gen_xmlHashTablePtr(n_table, 0);
9689 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009690
William M. Brackf13f77f2004-11-12 16:03:48 +00009691 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009692 desret_void_ptr(ret_val);
9693 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009694 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009695 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009696 xmlResetLastError();
9697 if (mem_base != xmlMemBlocks()) {
9698 printf("Leak of %d blocks found in xmlHashLookup",
9699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009700 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009701 printf(" %d", n_table);
9702 printf(" %d", n_name);
9703 printf("\n");
9704 }
9705 }
9706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009708
Daniel Veillard42595322004-11-08 10:52:06 +00009709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009710}
9711
9712
9713static int
9714test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009716
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009717 int mem_base;
9718 void * ret_val;
9719 xmlHashTablePtr table; /* the hash table */
9720 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009721 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009722 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009723 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009724 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009725
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009726 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9727 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9728 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9729 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009730 table = gen_xmlHashTablePtr(n_table, 0);
9731 name = gen_const_xmlChar_ptr(n_name, 1);
9732 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009733
William M. Brackf13f77f2004-11-12 16:03:48 +00009734 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009735 desret_void_ptr(ret_val);
9736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009737 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009738 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9739 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009740 xmlResetLastError();
9741 if (mem_base != xmlMemBlocks()) {
9742 printf("Leak of %d blocks found in xmlHashLookup2",
9743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009744 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009745 printf(" %d", n_table);
9746 printf(" %d", n_name);
9747 printf(" %d", n_name2);
9748 printf("\n");
9749 }
9750 }
9751 }
9752 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009753 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009754
Daniel Veillard42595322004-11-08 10:52:06 +00009755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009756}
9757
9758
9759static int
9760test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009762
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009763 int mem_base;
9764 void * ret_val;
9765 xmlHashTablePtr table; /* the hash table */
9766 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009767 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009768 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009769 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009771 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009772 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009773
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009774 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9775 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9776 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9777 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009779 table = gen_xmlHashTablePtr(n_table, 0);
9780 name = gen_const_xmlChar_ptr(n_name, 1);
9781 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9782 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009783
William M. Brackf13f77f2004-11-12 16:03:48 +00009784 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009785 desret_void_ptr(ret_val);
9786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009787 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009788 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9789 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9790 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009791 xmlResetLastError();
9792 if (mem_base != xmlMemBlocks()) {
9793 printf("Leak of %d blocks found in xmlHashLookup3",
9794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009795 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009796 printf(" %d", n_table);
9797 printf(" %d", n_name);
9798 printf(" %d", n_name2);
9799 printf(" %d", n_name3);
9800 printf("\n");
9801 }
9802 }
9803 }
9804 }
9805 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009806 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009807
Daniel Veillard42595322004-11-08 10:52:06 +00009808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009809}
9810
9811
9812static int
9813test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009815
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009816 int mem_base;
9817 void * ret_val;
9818 xmlHashTablePtr table; /* the hash table */
9819 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009820 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009821 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009822 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009823 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009824
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009825 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9826 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9827 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009829 table = gen_xmlHashTablePtr(n_table, 0);
9830 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9831 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009832
William M. Brackf13f77f2004-11-12 16:03:48 +00009833 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009834 desret_void_ptr(ret_val);
9835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009836 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009837 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9838 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009839 xmlResetLastError();
9840 if (mem_base != xmlMemBlocks()) {
9841 printf("Leak of %d blocks found in xmlHashQLookup",
9842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009843 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009844 printf(" %d", n_table);
9845 printf(" %d", n_prefix);
9846 printf(" %d", n_name);
9847 printf("\n");
9848 }
9849 }
9850 }
9851 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009852 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009853
Daniel Veillard42595322004-11-08 10:52:06 +00009854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009855}
9856
9857
9858static int
9859test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009861
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009862 int mem_base;
9863 void * ret_val;
9864 xmlHashTablePtr table; /* the hash table */
9865 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009866 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009868 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009869 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009870 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009871 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009872 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009873 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009874
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009875 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9876 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9877 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9878 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9879 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009881 table = gen_xmlHashTablePtr(n_table, 0);
9882 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9883 name = gen_const_xmlChar_ptr(n_name, 2);
9884 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9885 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886
William M. Brackf13f77f2004-11-12 16:03:48 +00009887 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 desret_void_ptr(ret_val);
9889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009890 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009891 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9892 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9893 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9894 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009895 xmlResetLastError();
9896 if (mem_base != xmlMemBlocks()) {
9897 printf("Leak of %d blocks found in xmlHashQLookup2",
9898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009900 printf(" %d", n_table);
9901 printf(" %d", n_prefix);
9902 printf(" %d", n_name);
9903 printf(" %d", n_prefix2);
9904 printf(" %d", n_name2);
9905 printf("\n");
9906 }
9907 }
9908 }
9909 }
9910 }
9911 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009912 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009913
Daniel Veillard42595322004-11-08 10:52:06 +00009914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009915}
9916
9917
9918static int
9919test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009921
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009922 int mem_base;
9923 void * ret_val;
9924 xmlHashTablePtr table; /* the hash table */
9925 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009926 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009927 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009928 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009929 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009930 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009931 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009932 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009933 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009934 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009935 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009936 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009937 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009938
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009939 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9940 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9941 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9942 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9943 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9944 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9945 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009947 table = gen_xmlHashTablePtr(n_table, 0);
9948 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9949 name = gen_const_xmlChar_ptr(n_name, 2);
9950 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9951 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9952 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9953 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009954
William M. Brackf13f77f2004-11-12 16:03:48 +00009955 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 +00009956 desret_void_ptr(ret_val);
9957 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009958 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009959 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9961 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9962 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9963 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9964 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009965 xmlResetLastError();
9966 if (mem_base != xmlMemBlocks()) {
9967 printf("Leak of %d blocks found in xmlHashQLookup3",
9968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009969 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009970 printf(" %d", n_table);
9971 printf(" %d", n_prefix);
9972 printf(" %d", n_name);
9973 printf(" %d", n_prefix2);
9974 printf(" %d", n_name2);
9975 printf(" %d", n_prefix3);
9976 printf(" %d", n_name3);
9977 printf("\n");
9978 }
9979 }
9980 }
9981 }
9982 }
9983 }
9984 }
9985 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009986 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009987
Daniel Veillard42595322004-11-08 10:52:06 +00009988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009989}
9990
9991
9992static int
9993test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009995
Daniel Veillard42595322004-11-08 10:52:06 +00009996 int mem_base;
9997 int ret_val;
9998 xmlHashTablePtr table; /* the hash table */
9999 int n_table;
10000 xmlChar * name; /* the name of the userdata */
10001 int n_name;
10002 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10003 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010004
Daniel Veillard42595322004-11-08 10:52:06 +000010005 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10006 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10007 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10008 mem_base = xmlMemBlocks();
10009 table = gen_xmlHashTablePtr(n_table, 0);
10010 name = gen_const_xmlChar_ptr(n_name, 1);
10011 f = gen_xmlHashDeallocator(n_f, 2);
10012
William M. Brackf13f77f2004-11-12 16:03:48 +000010013 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010014 desret_int(ret_val);
10015 call_tests++;
10016 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010017 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010018 des_xmlHashDeallocator(n_f, f, 2);
10019 xmlResetLastError();
10020 if (mem_base != xmlMemBlocks()) {
10021 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10022 xmlMemBlocks() - mem_base);
10023 test_ret++;
10024 printf(" %d", n_table);
10025 printf(" %d", n_name);
10026 printf(" %d", n_f);
10027 printf("\n");
10028 }
10029 }
10030 }
10031 }
Daniel Veillard42595322004-11-08 10:52:06 +000010032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010033
Daniel Veillard42595322004-11-08 10:52:06 +000010034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010035}
10036
10037
10038static int
10039test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010041
Daniel Veillard42595322004-11-08 10:52:06 +000010042 int mem_base;
10043 int ret_val;
10044 xmlHashTablePtr table; /* the hash table */
10045 int n_table;
10046 xmlChar * name; /* the name of the userdata */
10047 int n_name;
10048 xmlChar * name2; /* a second name of the userdata */
10049 int n_name2;
10050 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10051 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010052
Daniel Veillard42595322004-11-08 10:52:06 +000010053 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10055 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10056 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10057 mem_base = xmlMemBlocks();
10058 table = gen_xmlHashTablePtr(n_table, 0);
10059 name = gen_const_xmlChar_ptr(n_name, 1);
10060 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10061 f = gen_xmlHashDeallocator(n_f, 3);
10062
William M. Brackf13f77f2004-11-12 16:03:48 +000010063 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010064 desret_int(ret_val);
10065 call_tests++;
10066 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010067 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10068 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010069 des_xmlHashDeallocator(n_f, f, 3);
10070 xmlResetLastError();
10071 if (mem_base != xmlMemBlocks()) {
10072 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10073 xmlMemBlocks() - mem_base);
10074 test_ret++;
10075 printf(" %d", n_table);
10076 printf(" %d", n_name);
10077 printf(" %d", n_name2);
10078 printf(" %d", n_f);
10079 printf("\n");
10080 }
10081 }
10082 }
10083 }
10084 }
Daniel Veillard42595322004-11-08 10:52:06 +000010085 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010086
Daniel Veillard42595322004-11-08 10:52:06 +000010087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010088}
10089
10090
10091static int
10092test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010094
Daniel Veillard42595322004-11-08 10:52:06 +000010095 int mem_base;
10096 int ret_val;
10097 xmlHashTablePtr table; /* the hash table */
10098 int n_table;
10099 xmlChar * name; /* the name of the userdata */
10100 int n_name;
10101 xmlChar * name2; /* a second name of the userdata */
10102 int n_name2;
10103 xmlChar * name3; /* a third name of the userdata */
10104 int n_name3;
10105 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10106 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010107
Daniel Veillard42595322004-11-08 10:52:06 +000010108 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10109 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10110 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10111 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10112 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10113 mem_base = xmlMemBlocks();
10114 table = gen_xmlHashTablePtr(n_table, 0);
10115 name = gen_const_xmlChar_ptr(n_name, 1);
10116 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10117 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10118 f = gen_xmlHashDeallocator(n_f, 4);
10119
William M. Brackf13f77f2004-11-12 16:03:48 +000010120 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010121 desret_int(ret_val);
10122 call_tests++;
10123 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010124 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10125 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10126 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010127 des_xmlHashDeallocator(n_f, f, 4);
10128 xmlResetLastError();
10129 if (mem_base != xmlMemBlocks()) {
10130 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10131 xmlMemBlocks() - mem_base);
10132 test_ret++;
10133 printf(" %d", n_table);
10134 printf(" %d", n_name);
10135 printf(" %d", n_name2);
10136 printf(" %d", n_name3);
10137 printf(" %d", n_f);
10138 printf("\n");
10139 }
10140 }
10141 }
10142 }
10143 }
10144 }
Daniel Veillard42595322004-11-08 10:52:06 +000010145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010146
Daniel Veillard42595322004-11-08 10:52:06 +000010147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010148}
10149
10150
10151static int
10152test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010154
10155
10156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010158}
10159
10160
10161static int
10162test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010164
10165
10166 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010168}
10169
10170
10171static int
10172test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010174
10175
10176 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178}
10179
10180
10181static int
10182test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010184
10185
10186 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010188}
10189
10190
10191static int
10192test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010194
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010195 int mem_base;
10196 int ret_val;
10197 xmlHashTablePtr table; /* the hash table */
10198 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010200 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010202 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010203
10204 ret_val = xmlHashSize(table);
10205 desret_int(ret_val);
10206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010207 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010208 xmlResetLastError();
10209 if (mem_base != xmlMemBlocks()) {
10210 printf("Leak of %d blocks found in xmlHashSize",
10211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010212 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010213 printf(" %d", n_table);
10214 printf("\n");
10215 }
10216 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010218
Daniel Veillard42595322004-11-08 10:52:06 +000010219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010220}
10221
10222
10223static int
10224test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010226
Daniel Veillard42595322004-11-08 10:52:06 +000010227 int mem_base;
10228 int ret_val;
10229 xmlHashTablePtr table; /* the hash table */
10230 int n_table;
10231 xmlChar * name; /* the name of the userdata */
10232 int n_name;
10233 void * userdata; /* a pointer to the userdata */
10234 int n_userdata;
10235 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10236 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010237
Daniel Veillard42595322004-11-08 10:52:06 +000010238 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10239 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10240 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10241 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10242 mem_base = xmlMemBlocks();
10243 table = gen_xmlHashTablePtr(n_table, 0);
10244 name = gen_const_xmlChar_ptr(n_name, 1);
10245 userdata = gen_userdata(n_userdata, 2);
10246 f = gen_xmlHashDeallocator(n_f, 3);
10247
William M. Brackf13f77f2004-11-12 16:03:48 +000010248 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010249 desret_int(ret_val);
10250 call_tests++;
10251 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010252 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010253 des_userdata(n_userdata, userdata, 2);
10254 des_xmlHashDeallocator(n_f, f, 3);
10255 xmlResetLastError();
10256 if (mem_base != xmlMemBlocks()) {
10257 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10258 xmlMemBlocks() - mem_base);
10259 test_ret++;
10260 printf(" %d", n_table);
10261 printf(" %d", n_name);
10262 printf(" %d", n_userdata);
10263 printf(" %d", n_f);
10264 printf("\n");
10265 }
10266 }
10267 }
10268 }
10269 }
Daniel Veillard42595322004-11-08 10:52:06 +000010270 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010271
Daniel Veillard42595322004-11-08 10:52:06 +000010272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010273}
10274
10275
10276static int
10277test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010279
Daniel Veillard42595322004-11-08 10:52:06 +000010280 int mem_base;
10281 int ret_val;
10282 xmlHashTablePtr table; /* the hash table */
10283 int n_table;
10284 xmlChar * name; /* the name of the userdata */
10285 int n_name;
10286 xmlChar * name2; /* a second name of the userdata */
10287 int n_name2;
10288 void * userdata; /* a pointer to the userdata */
10289 int n_userdata;
10290 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10291 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010292
Daniel Veillard42595322004-11-08 10:52:06 +000010293 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10294 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10295 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10296 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10297 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10298 mem_base = xmlMemBlocks();
10299 table = gen_xmlHashTablePtr(n_table, 0);
10300 name = gen_const_xmlChar_ptr(n_name, 1);
10301 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10302 userdata = gen_userdata(n_userdata, 3);
10303 f = gen_xmlHashDeallocator(n_f, 4);
10304
William M. Brackf13f77f2004-11-12 16:03:48 +000010305 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010306 desret_int(ret_val);
10307 call_tests++;
10308 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010309 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10310 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010311 des_userdata(n_userdata, userdata, 3);
10312 des_xmlHashDeallocator(n_f, f, 4);
10313 xmlResetLastError();
10314 if (mem_base != xmlMemBlocks()) {
10315 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10316 xmlMemBlocks() - mem_base);
10317 test_ret++;
10318 printf(" %d", n_table);
10319 printf(" %d", n_name);
10320 printf(" %d", n_name2);
10321 printf(" %d", n_userdata);
10322 printf(" %d", n_f);
10323 printf("\n");
10324 }
10325 }
10326 }
10327 }
10328 }
10329 }
Daniel Veillard42595322004-11-08 10:52:06 +000010330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010331
Daniel Veillard42595322004-11-08 10:52:06 +000010332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010333}
10334
10335
10336static int
10337test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010339
Daniel Veillard42595322004-11-08 10:52:06 +000010340 int mem_base;
10341 int ret_val;
10342 xmlHashTablePtr table; /* the hash table */
10343 int n_table;
10344 xmlChar * name; /* the name of the userdata */
10345 int n_name;
10346 xmlChar * name2; /* a second name of the userdata */
10347 int n_name2;
10348 xmlChar * name3; /* a third name of the userdata */
10349 int n_name3;
10350 void * userdata; /* a pointer to the userdata */
10351 int n_userdata;
10352 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10353 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010354
Daniel Veillard42595322004-11-08 10:52:06 +000010355 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10356 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10357 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10358 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10359 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10360 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10361 mem_base = xmlMemBlocks();
10362 table = gen_xmlHashTablePtr(n_table, 0);
10363 name = gen_const_xmlChar_ptr(n_name, 1);
10364 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10365 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10366 userdata = gen_userdata(n_userdata, 4);
10367 f = gen_xmlHashDeallocator(n_f, 5);
10368
William M. Brackf13f77f2004-11-12 16:03:48 +000010369 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010370 desret_int(ret_val);
10371 call_tests++;
10372 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010373 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10374 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10375 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010376 des_userdata(n_userdata, userdata, 4);
10377 des_xmlHashDeallocator(n_f, f, 5);
10378 xmlResetLastError();
10379 if (mem_base != xmlMemBlocks()) {
10380 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10381 xmlMemBlocks() - mem_base);
10382 test_ret++;
10383 printf(" %d", n_table);
10384 printf(" %d", n_name);
10385 printf(" %d", n_name2);
10386 printf(" %d", n_name3);
10387 printf(" %d", n_userdata);
10388 printf(" %d", n_f);
10389 printf("\n");
10390 }
10391 }
10392 }
10393 }
10394 }
10395 }
10396 }
Daniel Veillard42595322004-11-08 10:52:06 +000010397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010398
Daniel Veillard42595322004-11-08 10:52:06 +000010399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010400}
10401
10402static int
10403test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010405
Daniel Veillard2ae13382005-01-25 23:45:06 +000010406 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010407 test_ret += test_xmlHashAddEntry();
10408 test_ret += test_xmlHashAddEntry2();
10409 test_ret += test_xmlHashAddEntry3();
10410 test_ret += test_xmlHashCopy();
10411 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010412 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010413 test_ret += test_xmlHashLookup();
10414 test_ret += test_xmlHashLookup2();
10415 test_ret += test_xmlHashLookup3();
10416 test_ret += test_xmlHashQLookup();
10417 test_ret += test_xmlHashQLookup2();
10418 test_ret += test_xmlHashQLookup3();
10419 test_ret += test_xmlHashRemoveEntry();
10420 test_ret += test_xmlHashRemoveEntry2();
10421 test_ret += test_xmlHashRemoveEntry3();
10422 test_ret += test_xmlHashScan();
10423 test_ret += test_xmlHashScan3();
10424 test_ret += test_xmlHashScanFull();
10425 test_ret += test_xmlHashScanFull3();
10426 test_ret += test_xmlHashSize();
10427 test_ret += test_xmlHashUpdateEntry();
10428 test_ret += test_xmlHashUpdateEntry2();
10429 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010430
Daniel Veillard42595322004-11-08 10:52:06 +000010431 if (test_ret != 0)
10432 printf("Module hash: %d errors\n", test_ret);
10433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010434}
10435
Daniel Veillardce682bc2004-11-05 17:22:25 +000010436#define gen_nb_xmlLinkPtr 1
10437static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10438 return(NULL);
10439}
10440static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10441}
10442
Daniel Veillardd93f6252004-11-02 15:53:51 +000010443static int
10444test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010446
Daniel Veillardce682bc2004-11-05 17:22:25 +000010447 int mem_base;
10448 void * ret_val;
10449 xmlLinkPtr lk; /* a link */
10450 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451
Daniel Veillardce682bc2004-11-05 17:22:25 +000010452 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10453 mem_base = xmlMemBlocks();
10454 lk = gen_xmlLinkPtr(n_lk, 0);
10455
10456 ret_val = xmlLinkGetData(lk);
10457 desret_void_ptr(ret_val);
10458 call_tests++;
10459 des_xmlLinkPtr(n_lk, lk, 0);
10460 xmlResetLastError();
10461 if (mem_base != xmlMemBlocks()) {
10462 printf("Leak of %d blocks found in xmlLinkGetData",
10463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010464 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010465 printf(" %d", n_lk);
10466 printf("\n");
10467 }
10468 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010470
Daniel Veillard42595322004-11-08 10:52:06 +000010471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010472}
10473
10474
10475static int
10476test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010478
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010479 int mem_base;
10480 int ret_val;
10481 xmlListPtr l; /* a list */
10482 int n_l;
10483 void * data; /* the data */
10484 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010485
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010486 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10487 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010489 l = gen_xmlListPtr(n_l, 0);
10490 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010491
10492 ret_val = xmlListAppend(l, data);
10493 desret_int(ret_val);
10494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010495 des_xmlListPtr(n_l, l, 0);
10496 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010497 xmlResetLastError();
10498 if (mem_base != xmlMemBlocks()) {
10499 printf("Leak of %d blocks found in xmlListAppend",
10500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010501 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010502 printf(" %d", n_l);
10503 printf(" %d", n_data);
10504 printf("\n");
10505 }
10506 }
10507 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010509
Daniel Veillard42595322004-11-08 10:52:06 +000010510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010511}
10512
10513
10514static int
10515test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010517
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010518 int mem_base;
10519 xmlListPtr l; /* a list */
10520 int n_l;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010524 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010525
10526 xmlListClear(l);
10527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010528 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010529 xmlResetLastError();
10530 if (mem_base != xmlMemBlocks()) {
10531 printf("Leak of %d blocks found in xmlListClear",
10532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010533 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010534 printf(" %d", n_l);
10535 printf("\n");
10536 }
10537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010539
Daniel Veillard42595322004-11-08 10:52:06 +000010540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010541}
10542
10543
Daniel Veillardce682bc2004-11-05 17:22:25 +000010544#define gen_nb_const_xmlListPtr 1
10545static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10546 return(NULL);
10547}
10548static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10549}
10550
Daniel Veillardd93f6252004-11-02 15:53:51 +000010551static int
10552test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010554
Daniel Veillardce682bc2004-11-05 17:22:25 +000010555 int mem_base;
10556 int ret_val;
10557 xmlListPtr cur; /* the new list */
10558 int n_cur;
10559 xmlListPtr old; /* the old list */
10560 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010561
Daniel Veillardce682bc2004-11-05 17:22:25 +000010562 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10563 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10564 mem_base = xmlMemBlocks();
10565 cur = gen_xmlListPtr(n_cur, 0);
10566 old = gen_const_xmlListPtr(n_old, 1);
10567
William M. Brackf13f77f2004-11-12 16:03:48 +000010568 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010569 desret_int(ret_val);
10570 call_tests++;
10571 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010572 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010573 xmlResetLastError();
10574 if (mem_base != xmlMemBlocks()) {
10575 printf("Leak of %d blocks found in xmlListCopy",
10576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010577 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010578 printf(" %d", n_cur);
10579 printf(" %d", n_old);
10580 printf("\n");
10581 }
10582 }
10583 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010584 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010585
Daniel Veillard42595322004-11-08 10:52:06 +000010586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010587}
10588
10589
10590static int
10591test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010593
10594
10595 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010597}
10598
10599
10600static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010601test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010603
10604
10605 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010607}
10608
10609
10610static int
10611test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010613
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010614 int mem_base;
10615 int ret_val;
10616 xmlListPtr l; /* a list */
10617 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010619 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010621 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010622
10623 ret_val = xmlListEmpty(l);
10624 desret_int(ret_val);
10625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010626 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010627 xmlResetLastError();
10628 if (mem_base != xmlMemBlocks()) {
10629 printf("Leak of %d blocks found in xmlListEmpty",
10630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010631 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010632 printf(" %d", n_l);
10633 printf("\n");
10634 }
10635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010637
Daniel Veillard42595322004-11-08 10:52:06 +000010638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010639}
10640
10641
10642static int
10643test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010645
10646
10647 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010649}
10650
10651
10652static int
10653test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010655
10656
10657 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010659}
10660
10661
10662static int
10663test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010665
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010666 int mem_base;
10667 int ret_val;
10668 xmlListPtr l; /* a list */
10669 int n_l;
10670 void * data; /* the data */
10671 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010672
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010673 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10674 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010676 l = gen_xmlListPtr(n_l, 0);
10677 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010678
10679 ret_val = xmlListInsert(l, data);
10680 desret_int(ret_val);
10681 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010682 des_xmlListPtr(n_l, l, 0);
10683 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010684 xmlResetLastError();
10685 if (mem_base != xmlMemBlocks()) {
10686 printf("Leak of %d blocks found in xmlListInsert",
10687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010688 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010689 printf(" %d", n_l);
10690 printf(" %d", n_data);
10691 printf("\n");
10692 }
10693 }
10694 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010696
Daniel Veillard42595322004-11-08 10:52:06 +000010697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010698}
10699
10700
10701static int
10702test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010704
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010705 int mem_base;
10706 xmlListPtr l1; /* the original list */
10707 int n_l1;
10708 xmlListPtr l2; /* the new list */
10709 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010710
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010711 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10712 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10713 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010714 l1 = gen_xmlListPtr(n_l1, 0);
10715 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010716
10717 xmlListMerge(l1, l2);
10718 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010719 des_xmlListPtr(n_l1, l1, 0);
10720 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010721 xmlResetLastError();
10722 if (mem_base != xmlMemBlocks()) {
10723 printf("Leak of %d blocks found in xmlListMerge",
10724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010725 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010726 printf(" %d", n_l1);
10727 printf(" %d", n_l2);
10728 printf("\n");
10729 }
10730 }
10731 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010733
Daniel Veillard42595322004-11-08 10:52:06 +000010734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010735}
10736
10737
10738static int
10739test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010741
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010742 int mem_base;
10743 xmlListPtr l; /* a list */
10744 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010745
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010746 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10747 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010748 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010749
10750 xmlListPopBack(l);
10751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010752 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010753 xmlResetLastError();
10754 if (mem_base != xmlMemBlocks()) {
10755 printf("Leak of %d blocks found in xmlListPopBack",
10756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010757 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010758 printf(" %d", n_l);
10759 printf("\n");
10760 }
10761 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010762 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010763
Daniel Veillard42595322004-11-08 10:52:06 +000010764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010765}
10766
10767
10768static int
10769test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010771
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010772 int mem_base;
10773 xmlListPtr l; /* a list */
10774 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010775
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010776 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10777 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010778 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010779
10780 xmlListPopFront(l);
10781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010782 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010783 xmlResetLastError();
10784 if (mem_base != xmlMemBlocks()) {
10785 printf("Leak of %d blocks found in xmlListPopFront",
10786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010787 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010788 printf(" %d", n_l);
10789 printf("\n");
10790 }
10791 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010793
Daniel Veillard42595322004-11-08 10:52:06 +000010794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010795}
10796
10797
10798static int
10799test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010801
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010802 int mem_base;
10803 int ret_val;
10804 xmlListPtr l; /* a list */
10805 int n_l;
10806 void * data; /* new data */
10807 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010808
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010809 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10810 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10811 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010812 l = gen_xmlListPtr(n_l, 0);
10813 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010814
10815 ret_val = xmlListPushBack(l, data);
10816 desret_int(ret_val);
10817 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010818 des_xmlListPtr(n_l, l, 0);
10819 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010820 xmlResetLastError();
10821 if (mem_base != xmlMemBlocks()) {
10822 printf("Leak of %d blocks found in xmlListPushBack",
10823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010824 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010825 printf(" %d", n_l);
10826 printf(" %d", n_data);
10827 printf("\n");
10828 }
10829 }
10830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010832
Daniel Veillard42595322004-11-08 10:52:06 +000010833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010834}
10835
10836
10837static int
10838test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010840
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010841 int mem_base;
10842 int ret_val;
10843 xmlListPtr l; /* a list */
10844 int n_l;
10845 void * data; /* new data */
10846 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010847
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010848 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10849 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010851 l = gen_xmlListPtr(n_l, 0);
10852 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010853
10854 ret_val = xmlListPushFront(l, data);
10855 desret_int(ret_val);
10856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010857 des_xmlListPtr(n_l, l, 0);
10858 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010859 xmlResetLastError();
10860 if (mem_base != xmlMemBlocks()) {
10861 printf("Leak of %d blocks found in xmlListPushFront",
10862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010863 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010864 printf(" %d", n_l);
10865 printf(" %d", n_data);
10866 printf("\n");
10867 }
10868 }
10869 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010870 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010871
Daniel Veillard42595322004-11-08 10:52:06 +000010872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010873}
10874
10875
10876static int
10877test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010879
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010880 int mem_base;
10881 int ret_val;
10882 xmlListPtr l; /* a list */
10883 int n_l;
10884 void * data; /* list data */
10885 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010886
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010887 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10888 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10889 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010890 l = gen_xmlListPtr(n_l, 0);
10891 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010892
10893 ret_val = xmlListRemoveAll(l, data);
10894 desret_int(ret_val);
10895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010896 des_xmlListPtr(n_l, l, 0);
10897 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010898 xmlResetLastError();
10899 if (mem_base != xmlMemBlocks()) {
10900 printf("Leak of %d blocks found in xmlListRemoveAll",
10901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010902 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010903 printf(" %d", n_l);
10904 printf(" %d", n_data);
10905 printf("\n");
10906 }
10907 }
10908 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010909 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010910
Daniel Veillard42595322004-11-08 10:52:06 +000010911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010912}
10913
10914
10915static int
10916test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010918
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010919 int mem_base;
10920 int ret_val;
10921 xmlListPtr l; /* a list */
10922 int n_l;
10923 void * data; /* list data */
10924 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010925
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010926 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10927 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10928 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010929 l = gen_xmlListPtr(n_l, 0);
10930 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010931
10932 ret_val = xmlListRemoveFirst(l, data);
10933 desret_int(ret_val);
10934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010935 des_xmlListPtr(n_l, l, 0);
10936 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010937 xmlResetLastError();
10938 if (mem_base != xmlMemBlocks()) {
10939 printf("Leak of %d blocks found in xmlListRemoveFirst",
10940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010941 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010942 printf(" %d", n_l);
10943 printf(" %d", n_data);
10944 printf("\n");
10945 }
10946 }
10947 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010948 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010949
Daniel Veillard42595322004-11-08 10:52:06 +000010950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010951}
10952
10953
10954static int
10955test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010957
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010958 int mem_base;
10959 int ret_val;
10960 xmlListPtr l; /* a list */
10961 int n_l;
10962 void * data; /* list data */
10963 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010964
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010965 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10966 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010968 l = gen_xmlListPtr(n_l, 0);
10969 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010970
10971 ret_val = xmlListRemoveLast(l, data);
10972 desret_int(ret_val);
10973 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010974 des_xmlListPtr(n_l, l, 0);
10975 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010976 xmlResetLastError();
10977 if (mem_base != xmlMemBlocks()) {
10978 printf("Leak of %d blocks found in xmlListRemoveLast",
10979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010980 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010981 printf(" %d", n_l);
10982 printf(" %d", n_data);
10983 printf("\n");
10984 }
10985 }
10986 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010987 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010988
Daniel Veillard42595322004-11-08 10:52:06 +000010989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010990}
10991
10992
10993static int
10994test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010996
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010997 int mem_base;
10998 xmlListPtr l; /* a list */
10999 int n_l;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011003 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011004
11005 xmlListReverse(l);
11006 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011007 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011008 xmlResetLastError();
11009 if (mem_base != xmlMemBlocks()) {
11010 printf("Leak of %d blocks found in xmlListReverse",
11011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011012 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011013 printf(" %d", n_l);
11014 printf("\n");
11015 }
11016 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011018
Daniel Veillard42595322004-11-08 10:52:06 +000011019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011020}
11021
11022
11023static int
11024test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011026
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011027 int mem_base;
11028 void * ret_val;
11029 xmlListPtr l; /* a list */
11030 int n_l;
11031 void * data; /* a search value */
11032 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011033
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011034 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11035 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11036 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011037 l = gen_xmlListPtr(n_l, 0);
11038 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011039
11040 ret_val = xmlListReverseSearch(l, data);
11041 desret_void_ptr(ret_val);
11042 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011043 des_xmlListPtr(n_l, l, 0);
11044 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011045 xmlResetLastError();
11046 if (mem_base != xmlMemBlocks()) {
11047 printf("Leak of %d blocks found in xmlListReverseSearch",
11048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011049 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011050 printf(" %d", n_l);
11051 printf(" %d", n_data);
11052 printf("\n");
11053 }
11054 }
11055 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011056 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011057
Daniel Veillard42595322004-11-08 10:52:06 +000011058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011059}
11060
11061
11062static int
11063test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011065
11066
11067 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011069}
11070
11071
11072static int
11073test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011075
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011076 int mem_base;
11077 void * ret_val;
11078 xmlListPtr l; /* a list */
11079 int n_l;
11080 void * data; /* a search value */
11081 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011082
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011083 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11084 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11085 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011086 l = gen_xmlListPtr(n_l, 0);
11087 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011088
11089 ret_val = xmlListSearch(l, data);
11090 desret_void_ptr(ret_val);
11091 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011092 des_xmlListPtr(n_l, l, 0);
11093 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011094 xmlResetLastError();
11095 if (mem_base != xmlMemBlocks()) {
11096 printf("Leak of %d blocks found in xmlListSearch",
11097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011098 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011099 printf(" %d", n_l);
11100 printf(" %d", n_data);
11101 printf("\n");
11102 }
11103 }
11104 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011106
Daniel Veillard42595322004-11-08 10:52:06 +000011107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011108}
11109
11110
11111static int
11112test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011114
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011115 int mem_base;
11116 int ret_val;
11117 xmlListPtr l; /* a list */
11118 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011119
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011120 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011122 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011123
11124 ret_val = xmlListSize(l);
11125 desret_int(ret_val);
11126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011127 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011128 xmlResetLastError();
11129 if (mem_base != xmlMemBlocks()) {
11130 printf("Leak of %d blocks found in xmlListSize",
11131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011132 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011133 printf(" %d", n_l);
11134 printf("\n");
11135 }
11136 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011138
Daniel Veillard42595322004-11-08 10:52:06 +000011139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011140}
11141
11142
11143static int
11144test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011146
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011147 int mem_base;
11148 xmlListPtr l; /* a list */
11149 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011150
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011151 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011153 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011154
11155 xmlListSort(l);
11156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011157 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011158 xmlResetLastError();
11159 if (mem_base != xmlMemBlocks()) {
11160 printf("Leak of %d blocks found in xmlListSort",
11161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011162 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011163 printf(" %d", n_l);
11164 printf("\n");
11165 }
11166 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011168
Daniel Veillard42595322004-11-08 10:52:06 +000011169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011170}
11171
11172
11173static int
11174test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011176
11177
11178 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011180}
11181
11182static int
11183test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011185
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011186 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011187 test_ret += test_xmlLinkGetData();
11188 test_ret += test_xmlListAppend();
11189 test_ret += test_xmlListClear();
11190 test_ret += test_xmlListCopy();
11191 test_ret += test_xmlListCreate();
11192 test_ret += test_xmlListDup();
11193 test_ret += test_xmlListEmpty();
11194 test_ret += test_xmlListEnd();
11195 test_ret += test_xmlListFront();
11196 test_ret += test_xmlListInsert();
11197 test_ret += test_xmlListMerge();
11198 test_ret += test_xmlListPopBack();
11199 test_ret += test_xmlListPopFront();
11200 test_ret += test_xmlListPushBack();
11201 test_ret += test_xmlListPushFront();
11202 test_ret += test_xmlListRemoveAll();
11203 test_ret += test_xmlListRemoveFirst();
11204 test_ret += test_xmlListRemoveLast();
11205 test_ret += test_xmlListReverse();
11206 test_ret += test_xmlListReverseSearch();
11207 test_ret += test_xmlListReverseWalk();
11208 test_ret += test_xmlListSearch();
11209 test_ret += test_xmlListSize();
11210 test_ret += test_xmlListSort();
11211 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011212
Daniel Veillard42595322004-11-08 10:52:06 +000011213 if (test_ret != 0)
11214 printf("Module list: %d errors\n", test_ret);
11215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011216}
11217
11218static int
11219test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011221
William M. Brack21e4ef22005-01-02 09:53:13 +000011222#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011223 int mem_base;
11224 int ret_val;
11225 void * ctx; /* an FTP context */
11226 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillard27f20102004-11-05 11:50:11 +000011228 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11229 mem_base = xmlMemBlocks();
11230 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11231
11232 ret_val = xmlNanoFTPCheckResponse(ctx);
11233 desret_int(ret_val);
11234 call_tests++;
11235 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11236 xmlResetLastError();
11237 if (mem_base != xmlMemBlocks()) {
11238 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011240 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011241 printf(" %d", n_ctx);
11242 printf("\n");
11243 }
11244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011245 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011246#endif
11247
Daniel Veillard42595322004-11-08 10:52:06 +000011248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011249}
11250
11251
11252static int
11253test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011255
William M. Brack21e4ef22005-01-02 09:53:13 +000011256#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011257 int mem_base;
11258
11259 mem_base = xmlMemBlocks();
11260
11261 xmlNanoFTPCleanup();
11262 call_tests++;
11263 xmlResetLastError();
11264 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011265 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011267 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011268 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011270 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011271#endif
11272
Daniel Veillard42595322004-11-08 10:52:06 +000011273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011274}
11275
11276
11277static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011278test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011280
William M. Brack21e4ef22005-01-02 09:53:13 +000011281#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011282 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011283 int ret_val;
11284 void * ctx; /* an FTP context */
11285 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011286
Daniel Veillard27f20102004-11-05 11:50:11 +000011287 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011288 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011289 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011290
Daniel Veillard27f20102004-11-05 11:50:11 +000011291 ret_val = xmlNanoFTPCloseConnection(ctx);
11292 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011293 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011294 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011295 xmlResetLastError();
11296 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011297 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011299 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011300 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011301 printf("\n");
11302 }
11303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011304 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011305#endif
11306
Daniel Veillard42595322004-11-08 10:52:06 +000011307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011308}
11309
11310
11311static int
11312test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011314
William M. Brack21e4ef22005-01-02 09:53:13 +000011315#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011316 int mem_base;
11317 int ret_val;
11318 void * ctx; /* an FTP context */
11319 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011320 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011321 int n_directory;
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++) {
11324 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11325 mem_base = xmlMemBlocks();
11326 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11327 directory = gen_const_char_ptr(n_directory, 1);
11328
William M. Brackf13f77f2004-11-12 16:03:48 +000011329 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011330 desret_int(ret_val);
11331 call_tests++;
11332 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011333 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011334 xmlResetLastError();
11335 if (mem_base != xmlMemBlocks()) {
11336 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011338 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011339 printf(" %d", n_ctx);
11340 printf(" %d", n_directory);
11341 printf("\n");
11342 }
11343 }
11344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011345 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011346#endif
11347
Daniel Veillard42595322004-11-08 10:52:06 +000011348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011349}
11350
11351
11352static int
11353test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011355
William M. Brack21e4ef22005-01-02 09:53:13 +000011356#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011357 int mem_base;
11358 int ret_val;
11359 void * ctx; /* an FTP context */
11360 int n_ctx;
11361 const char * file; /* a file or directory on the server */
11362 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011363
Daniel Veillard27f20102004-11-05 11:50:11 +000011364 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11365 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11366 mem_base = xmlMemBlocks();
11367 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11368 file = gen_filepath(n_file, 1);
11369
11370 ret_val = xmlNanoFTPDele(ctx, file);
11371 desret_int(ret_val);
11372 call_tests++;
11373 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11374 des_filepath(n_file, file, 1);
11375 xmlResetLastError();
11376 if (mem_base != xmlMemBlocks()) {
11377 printf("Leak of %d blocks found in xmlNanoFTPDele",
11378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011379 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011380 printf(" %d", n_ctx);
11381 printf(" %d", n_file);
11382 printf("\n");
11383 }
11384 }
11385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011386 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011387#endif
11388
Daniel Veillard42595322004-11-08 10:52:06 +000011389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011390}
11391
11392
11393static int
11394test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011396
11397
11398 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011400}
11401
11402
11403static int
11404test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011406
William M. Brack21e4ef22005-01-02 09:53:13 +000011407#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011408 int mem_base;
11409 int ret_val;
11410 void * ctx; /* an FTP context */
11411 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011412
Daniel Veillard27f20102004-11-05 11:50:11 +000011413 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11414 mem_base = xmlMemBlocks();
11415 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11416
11417 ret_val = xmlNanoFTPGetConnection(ctx);
11418 desret_int(ret_val);
11419 call_tests++;
11420 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11421 xmlResetLastError();
11422 if (mem_base != xmlMemBlocks()) {
11423 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011425 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011426 printf(" %d", n_ctx);
11427 printf("\n");
11428 }
11429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011430 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011431#endif
11432
Daniel Veillard42595322004-11-08 10:52:06 +000011433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011434}
11435
11436
11437static int
11438test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011440
William M. Brack21e4ef22005-01-02 09:53:13 +000011441#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011442 int mem_base;
11443 int ret_val;
11444 void * ctx; /* an FTP context */
11445 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011446
Daniel Veillard27f20102004-11-05 11:50:11 +000011447 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11448 mem_base = xmlMemBlocks();
11449 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11450
11451 ret_val = xmlNanoFTPGetResponse(ctx);
11452 desret_int(ret_val);
11453 call_tests++;
11454 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11455 xmlResetLastError();
11456 if (mem_base != xmlMemBlocks()) {
11457 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011459 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011460 printf(" %d", n_ctx);
11461 printf("\n");
11462 }
11463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011464 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011465#endif
11466
Daniel Veillard42595322004-11-08 10:52:06 +000011467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011468}
11469
11470
11471static int
11472test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011474
William M. Brack21e4ef22005-01-02 09:53:13 +000011475#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011476 int mem_base;
11477 int ret_val;
11478 void * ctx; /* an FTP context */
11479 int n_ctx;
11480 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11481 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011482
Daniel Veillard27f20102004-11-05 11:50:11 +000011483 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11484 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11485 mem_base = xmlMemBlocks();
11486 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11487 filename = gen_filepath(n_filename, 1);
11488
11489 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11490 desret_int(ret_val);
11491 call_tests++;
11492 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11493 des_filepath(n_filename, filename, 1);
11494 xmlResetLastError();
11495 if (mem_base != xmlMemBlocks()) {
11496 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011498 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011499 printf(" %d", n_ctx);
11500 printf(" %d", n_filename);
11501 printf("\n");
11502 }
11503 }
11504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011505 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011506#endif
11507
Daniel Veillard42595322004-11-08 10:52:06 +000011508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011509}
11510
11511
11512static int
11513test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011515
William M. Brack21e4ef22005-01-02 09:53:13 +000011516#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011517 int mem_base;
11518
11519 mem_base = xmlMemBlocks();
11520
11521 xmlNanoFTPInit();
11522 call_tests++;
11523 xmlResetLastError();
11524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011525 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011530 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011531#endif
11532
Daniel Veillard42595322004-11-08 10:52:06 +000011533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011534}
11535
11536
11537static int
11538test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011540
11541
11542 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544}
11545
11546
11547static int
11548test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011550
William M. Brack015ccb22005-02-13 08:18:52 +000011551#if defined(LIBXML_FTP_ENABLED)
11552 int mem_base;
11553 void * ret_val;
11554 const char * URL; /* The URL used to initialize the context */
11555 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011556
William M. Brack015ccb22005-02-13 08:18:52 +000011557 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11558 mem_base = xmlMemBlocks();
11559 URL = gen_filepath(n_URL, 0);
11560
11561 ret_val = xmlNanoFTPNewCtxt(URL);
11562 desret_xmlNanoFTPCtxtPtr(ret_val);
11563 call_tests++;
11564 des_filepath(n_URL, URL, 0);
11565 xmlResetLastError();
11566 if (mem_base != xmlMemBlocks()) {
11567 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11568 xmlMemBlocks() - mem_base);
11569 test_ret++;
11570 printf(" %d", n_URL);
11571 printf("\n");
11572 }
11573 }
11574 function_tests++;
11575#endif
11576
Daniel Veillard42595322004-11-08 10:52:06 +000011577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011578}
11579
11580
11581static int
11582test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011584
William M. Brack21e4ef22005-01-02 09:53:13 +000011585#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011586 int mem_base;
11587 void * ret_val;
11588 const char * URL; /* the URL to the resource */
11589 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011590
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011591 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011593 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011594
11595 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011596 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011598 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011599 xmlResetLastError();
11600 if (mem_base != xmlMemBlocks()) {
11601 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011603 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011604 printf(" %d", n_URL);
11605 printf("\n");
11606 }
11607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011608 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011609#endif
11610
Daniel Veillard42595322004-11-08 10:52:06 +000011611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011612}
11613
11614
11615static int
11616test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011618
William M. Brack21e4ef22005-01-02 09:53:13 +000011619#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011620 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011621 int n_host;
11622 int port; /* the proxy port */
11623 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011624 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011625 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011626 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011627 int n_passwd;
11628 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11629 int n_type;
11630
11631 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11632 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11633 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11634 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11635 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011636 host = gen_const_char_ptr(n_host, 0);
11637 port = gen_int(n_port, 1);
11638 user = gen_const_char_ptr(n_user, 2);
11639 passwd = gen_const_char_ptr(n_passwd, 3);
11640 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011641
William M. Brackf13f77f2004-11-12 16:03:48 +000011642 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011643 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011644 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011645 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011646 des_const_char_ptr(n_user, (const char *)user, 2);
11647 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011648 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011649 xmlResetLastError();
11650 }
11651 }
11652 }
11653 }
11654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011655 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011656#endif
11657
Daniel Veillard42595322004-11-08 10:52:06 +000011658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011659}
11660
11661
11662static int
11663test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011665
William M. Brack21e4ef22005-01-02 09:53:13 +000011666#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011667 int mem_base;
11668 int ret_val;
11669 void * ctx; /* an FTP context */
11670 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671
Daniel Veillard27f20102004-11-05 11:50:11 +000011672 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11673 mem_base = xmlMemBlocks();
11674 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11675
11676 ret_val = xmlNanoFTPQuit(ctx);
11677 desret_int(ret_val);
11678 call_tests++;
11679 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11680 xmlResetLastError();
11681 if (mem_base != xmlMemBlocks()) {
11682 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011684 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011685 printf(" %d", n_ctx);
11686 printf("\n");
11687 }
11688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011689 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011690#endif
11691
Daniel Veillard42595322004-11-08 10:52:06 +000011692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011693}
11694
11695
11696static int
11697test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011699
William M. Brack21e4ef22005-01-02 09:53:13 +000011700#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011701 int mem_base;
11702 int ret_val;
11703 void * ctx; /* the FTP context */
11704 int n_ctx;
11705 void * dest; /* a buffer */
11706 int n_dest;
11707 int len; /* the buffer length */
11708 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011709
Daniel Veillard27f20102004-11-05 11:50:11 +000011710 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11711 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11712 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11713 mem_base = xmlMemBlocks();
11714 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11715 dest = gen_void_ptr(n_dest, 1);
11716 len = gen_int(n_len, 2);
11717
11718 ret_val = xmlNanoFTPRead(ctx, dest, len);
11719 desret_int(ret_val);
11720 call_tests++;
11721 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11722 des_void_ptr(n_dest, dest, 1);
11723 des_int(n_len, len, 2);
11724 xmlResetLastError();
11725 if (mem_base != xmlMemBlocks()) {
11726 printf("Leak of %d blocks found in xmlNanoFTPRead",
11727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011728 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011729 printf(" %d", n_ctx);
11730 printf(" %d", n_dest);
11731 printf(" %d", n_len);
11732 printf("\n");
11733 }
11734 }
11735 }
11736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011737 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011738#endif
11739
Daniel Veillard42595322004-11-08 10:52:06 +000011740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011741}
11742
11743
11744static int
11745test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011747
William M. Brack21e4ef22005-01-02 09:53:13 +000011748#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011749 const char * URL; /* The proxy URL used to initialize the proxy context */
11750 int n_URL;
11751
11752 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011753 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011754
11755 xmlNanoFTPScanProxy(URL);
11756 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011757 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011758 xmlResetLastError();
11759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011760 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011761#endif
11762
Daniel Veillard42595322004-11-08 10:52:06 +000011763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764}
11765
11766
11767static int
11768test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011770
William M. Brack21e4ef22005-01-02 09:53:13 +000011771#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011772 int mem_base;
11773 int ret_val;
11774 void * ctx; /* an FTP context */
11775 int n_ctx;
11776 const char * URL; /* The URL used to update the context */
11777 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011778
Daniel Veillard27f20102004-11-05 11:50:11 +000011779 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11780 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11781 mem_base = xmlMemBlocks();
11782 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11783 URL = gen_filepath(n_URL, 1);
11784
11785 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11786 desret_int(ret_val);
11787 call_tests++;
11788 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11789 des_filepath(n_URL, URL, 1);
11790 xmlResetLastError();
11791 if (mem_base != xmlMemBlocks()) {
11792 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011794 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011795 printf(" %d", n_ctx);
11796 printf(" %d", n_URL);
11797 printf("\n");
11798 }
11799 }
11800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011801 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011802#endif
11803
Daniel Veillard42595322004-11-08 10:52:06 +000011804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011805}
11806
11807static int
11808test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011810
William M. Brack015ccb22005-02-13 08:18:52 +000011811 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011812 test_ret += test_xmlNanoFTPCheckResponse();
11813 test_ret += test_xmlNanoFTPCleanup();
11814 test_ret += test_xmlNanoFTPCloseConnection();
11815 test_ret += test_xmlNanoFTPCwd();
11816 test_ret += test_xmlNanoFTPDele();
11817 test_ret += test_xmlNanoFTPGet();
11818 test_ret += test_xmlNanoFTPGetConnection();
11819 test_ret += test_xmlNanoFTPGetResponse();
11820 test_ret += test_xmlNanoFTPGetSocket();
11821 test_ret += test_xmlNanoFTPInit();
11822 test_ret += test_xmlNanoFTPList();
11823 test_ret += test_xmlNanoFTPNewCtxt();
11824 test_ret += test_xmlNanoFTPOpen();
11825 test_ret += test_xmlNanoFTPProxy();
11826 test_ret += test_xmlNanoFTPQuit();
11827 test_ret += test_xmlNanoFTPRead();
11828 test_ret += test_xmlNanoFTPScanProxy();
11829 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011830
Daniel Veillard42595322004-11-08 10:52:06 +000011831 if (test_ret != 0)
11832 printf("Module nanoftp: %d errors\n", test_ret);
11833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011834}
11835
11836static int
11837test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011839
William M. Brack21e4ef22005-01-02 09:53:13 +000011840#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011841 int mem_base;
11842 const char * ret_val;
11843 void * ctx; /* the HTTP context */
11844 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011845
Daniel Veillard27f20102004-11-05 11:50:11 +000011846 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11847 mem_base = xmlMemBlocks();
11848 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11849
11850 ret_val = xmlNanoHTTPAuthHeader(ctx);
11851 desret_const_char_ptr(ret_val);
11852 call_tests++;
11853 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11854 xmlResetLastError();
11855 if (mem_base != xmlMemBlocks()) {
11856 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011858 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011859 printf(" %d", n_ctx);
11860 printf("\n");
11861 }
11862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011863 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011864#endif
11865
Daniel Veillard42595322004-11-08 10:52:06 +000011866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011867}
11868
11869
11870static int
11871test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011873
William M. Brack21e4ef22005-01-02 09:53:13 +000011874#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011875 int mem_base;
11876
11877 mem_base = xmlMemBlocks();
11878
11879 xmlNanoHTTPCleanup();
11880 call_tests++;
11881 xmlResetLastError();
11882 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011883 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011885 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011886 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011888 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011889#endif
11890
Daniel Veillard42595322004-11-08 10:52:06 +000011891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011892}
11893
11894
11895static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011896test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011898
William M. Brack21e4ef22005-01-02 09:53:13 +000011899#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011900 int mem_base;
11901 int ret_val;
11902 void * ctx; /* the HTTP context */
11903 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904
Daniel Veillard27f20102004-11-05 11:50:11 +000011905 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11906 mem_base = xmlMemBlocks();
11907 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11908
11909 ret_val = xmlNanoHTTPContentLength(ctx);
11910 desret_int(ret_val);
11911 call_tests++;
11912 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11913 xmlResetLastError();
11914 if (mem_base != xmlMemBlocks()) {
11915 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011917 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011918 printf(" %d", n_ctx);
11919 printf("\n");
11920 }
11921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011922 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011923#endif
11924
Daniel Veillard42595322004-11-08 10:52:06 +000011925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011926}
11927
11928
11929static int
11930test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011932
William M. Brack21e4ef22005-01-02 09:53:13 +000011933#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011934 int mem_base;
11935 const char * ret_val;
11936 void * ctx; /* the HTTP context */
11937 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011938
Daniel Veillard27f20102004-11-05 11:50:11 +000011939 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11940 mem_base = xmlMemBlocks();
11941 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11942
11943 ret_val = xmlNanoHTTPEncoding(ctx);
11944 desret_const_char_ptr(ret_val);
11945 call_tests++;
11946 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11947 xmlResetLastError();
11948 if (mem_base != xmlMemBlocks()) {
11949 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011951 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011952 printf(" %d", n_ctx);
11953 printf("\n");
11954 }
11955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011956 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011957#endif
11958
Daniel Veillard42595322004-11-08 10:52:06 +000011959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011960}
11961
11962
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011963#define gen_nb_char_ptr_ptr 1
11964static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11965 return(NULL);
11966}
11967static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11968}
11969
Daniel Veillardd93f6252004-11-02 15:53:51 +000011970static int
11971test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011973
William M. Brack21e4ef22005-01-02 09:53:13 +000011974#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011975 int mem_base;
11976 int ret_val;
11977 const char * URL; /* The URL to load */
11978 int n_URL;
11979 const char * filename; /* the filename where the content should be saved */
11980 int n_filename;
11981 char ** contentType; /* if available the Content-Type information will be returned at that location */
11982 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011983
William M. Brack015ccb22005-02-13 08:18:52 +000011984 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
11985 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011986 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11987 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000011988 URL = gen_fileoutput(n_URL, 0);
11989 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 contentType = gen_char_ptr_ptr(n_contentType, 2);
11991
11992 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11993 desret_int(ret_val);
11994 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000011995 des_fileoutput(n_URL, URL, 0);
11996 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011997 des_char_ptr_ptr(n_contentType, contentType, 2);
11998 xmlResetLastError();
11999 if (mem_base != xmlMemBlocks()) {
12000 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012002 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012003 printf(" %d", n_URL);
12004 printf(" %d", n_filename);
12005 printf(" %d", n_contentType);
12006 printf("\n");
12007 }
12008 }
12009 }
12010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012011 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012012#endif
12013
Daniel Veillard42595322004-11-08 10:52:06 +000012014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012015}
12016
12017
12018static int
12019test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012021
William M. Brack21e4ef22005-01-02 09:53:13 +000012022#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012023 int mem_base;
12024
12025 mem_base = xmlMemBlocks();
12026
12027 xmlNanoHTTPInit();
12028 call_tests++;
12029 xmlResetLastError();
12030 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012031 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012033 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012034 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012036 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012037#endif
12038
Daniel Veillard42595322004-11-08 10:52:06 +000012039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012040}
12041
12042
12043static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012044test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012046
William M. Brack21e4ef22005-01-02 09:53:13 +000012047#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012048 int mem_base;
12049 const char * ret_val;
12050 void * ctx; /* the HTTP context */
12051 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012052
Daniel Veillard27f20102004-11-05 11:50:11 +000012053 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12054 mem_base = xmlMemBlocks();
12055 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12056
12057 ret_val = xmlNanoHTTPMimeType(ctx);
12058 desret_const_char_ptr(ret_val);
12059 call_tests++;
12060 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12061 xmlResetLastError();
12062 if (mem_base != xmlMemBlocks()) {
12063 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012065 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012066 printf(" %d", n_ctx);
12067 printf("\n");
12068 }
12069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012070 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012071#endif
12072
Daniel Veillard42595322004-11-08 10:52:06 +000012073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012074}
12075
12076
12077static int
12078test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012080
William M. Brack21e4ef22005-01-02 09:53:13 +000012081#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012082 int mem_base;
12083 void * ret_val;
12084 const char * URL; /* The URL to load */
12085 int n_URL;
12086 char ** contentType; /* if available the Content-Type information will be returned at that location */
12087 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012088
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012089 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12090 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12091 mem_base = xmlMemBlocks();
12092 URL = gen_filepath(n_URL, 0);
12093 contentType = gen_char_ptr_ptr(n_contentType, 1);
12094
12095 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012096 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012097 call_tests++;
12098 des_filepath(n_URL, URL, 0);
12099 des_char_ptr_ptr(n_contentType, contentType, 1);
12100 xmlResetLastError();
12101 if (mem_base != xmlMemBlocks()) {
12102 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012104 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012105 printf(" %d", n_URL);
12106 printf(" %d", n_contentType);
12107 printf("\n");
12108 }
12109 }
12110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012111 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012112#endif
12113
Daniel Veillard42595322004-11-08 10:52:06 +000012114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012115}
12116
12117
12118static int
12119test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012121
William M. Brack21e4ef22005-01-02 09:53:13 +000012122#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012123 int mem_base;
12124 void * ret_val;
12125 const char * URL; /* The URL to load */
12126 int n_URL;
12127 char ** contentType; /* if available the Content-Type information will be returned at that location */
12128 int n_contentType;
12129 char ** redir; /* if available the redirected URL will be returned */
12130 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012131
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012132 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12133 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12134 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12135 mem_base = xmlMemBlocks();
12136 URL = gen_filepath(n_URL, 0);
12137 contentType = gen_char_ptr_ptr(n_contentType, 1);
12138 redir = gen_char_ptr_ptr(n_redir, 2);
12139
12140 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012141 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012142 call_tests++;
12143 des_filepath(n_URL, URL, 0);
12144 des_char_ptr_ptr(n_contentType, contentType, 1);
12145 des_char_ptr_ptr(n_redir, redir, 2);
12146 xmlResetLastError();
12147 if (mem_base != xmlMemBlocks()) {
12148 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012150 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012151 printf(" %d", n_URL);
12152 printf(" %d", n_contentType);
12153 printf(" %d", n_redir);
12154 printf("\n");
12155 }
12156 }
12157 }
12158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012159 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012160#endif
12161
Daniel Veillard42595322004-11-08 10:52:06 +000012162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012163}
12164
12165
12166static int
12167test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012169
William M. Brack21e4ef22005-01-02 09:53:13 +000012170#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012171 int mem_base;
12172 int ret_val;
12173 void * ctx; /* the HTTP context */
12174 int n_ctx;
12175 void * dest; /* a buffer */
12176 int n_dest;
12177 int len; /* the buffer length */
12178 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012179
Daniel Veillard27f20102004-11-05 11:50:11 +000012180 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12181 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12182 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12183 mem_base = xmlMemBlocks();
12184 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12185 dest = gen_void_ptr(n_dest, 1);
12186 len = gen_int(n_len, 2);
12187
12188 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12189 desret_int(ret_val);
12190 call_tests++;
12191 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12192 des_void_ptr(n_dest, dest, 1);
12193 des_int(n_len, len, 2);
12194 xmlResetLastError();
12195 if (mem_base != xmlMemBlocks()) {
12196 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012198 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012199 printf(" %d", n_ctx);
12200 printf(" %d", n_dest);
12201 printf(" %d", n_len);
12202 printf("\n");
12203 }
12204 }
12205 }
12206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012207 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012208#endif
12209
Daniel Veillard42595322004-11-08 10:52:06 +000012210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012211}
12212
12213
12214static int
12215test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012217
12218
12219 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012221}
12222
12223
12224static int
12225test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012227
William M. Brack21e4ef22005-01-02 09:53:13 +000012228#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012229 int mem_base;
12230 int ret_val;
12231 void * ctx; /* the HTTP context */
12232 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012233
Daniel Veillard27f20102004-11-05 11:50:11 +000012234 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12235 mem_base = xmlMemBlocks();
12236 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12237
12238 ret_val = xmlNanoHTTPReturnCode(ctx);
12239 desret_int(ret_val);
12240 call_tests++;
12241 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12242 xmlResetLastError();
12243 if (mem_base != xmlMemBlocks()) {
12244 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012246 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012247 printf(" %d", n_ctx);
12248 printf("\n");
12249 }
12250 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012251 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012252#endif
12253
Daniel Veillard42595322004-11-08 10:52:06 +000012254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012255}
12256
12257
12258static int
12259test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012261
William M. Brack21e4ef22005-01-02 09:53:13 +000012262#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012263 int mem_base;
12264 int ret_val;
12265 void * ctxt; /* the HTTP context */
12266 int n_ctxt;
12267 const char * filename; /* the filename where the content should be saved */
12268 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012269
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012270 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12271 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12272 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012273 ctxt = gen_void_ptr(n_ctxt, 0);
12274 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012275
12276 ret_val = xmlNanoHTTPSave(ctxt, filename);
12277 desret_int(ret_val);
12278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012279 des_void_ptr(n_ctxt, ctxt, 0);
12280 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012281 xmlResetLastError();
12282 if (mem_base != xmlMemBlocks()) {
12283 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012285 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012286 printf(" %d", n_ctxt);
12287 printf(" %d", n_filename);
12288 printf("\n");
12289 }
12290 }
12291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012292 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012293#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012294
Daniel Veillard42595322004-11-08 10:52:06 +000012295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012296}
12297
12298
12299static int
12300test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012302
William M. Brack21e4ef22005-01-02 09:53:13 +000012303#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012304 const char * URL; /* The proxy URL used to initialize the proxy context */
12305 int n_URL;
12306
12307 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012308 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012309
12310 xmlNanoHTTPScanProxy(URL);
12311 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012312 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012313 xmlResetLastError();
12314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012315 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012316#endif
12317
Daniel Veillard42595322004-11-08 10:52:06 +000012318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012319}
12320
12321static int
12322test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
William M. Brack015ccb22005-02-13 08:18:52 +000012325 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012326 test_ret += test_xmlNanoHTTPAuthHeader();
12327 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012328 test_ret += test_xmlNanoHTTPContentLength();
12329 test_ret += test_xmlNanoHTTPEncoding();
12330 test_ret += test_xmlNanoHTTPFetch();
12331 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012332 test_ret += test_xmlNanoHTTPMimeType();
12333 test_ret += test_xmlNanoHTTPOpen();
12334 test_ret += test_xmlNanoHTTPOpenRedir();
12335 test_ret += test_xmlNanoHTTPRead();
12336 test_ret += test_xmlNanoHTTPRedir();
12337 test_ret += test_xmlNanoHTTPReturnCode();
12338 test_ret += test_xmlNanoHTTPSave();
12339 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012340
Daniel Veillard42595322004-11-08 10:52:06 +000012341 if (test_ret != 0)
12342 printf("Module nanohttp: %d errors\n", test_ret);
12343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012344}
12345
12346static int
12347test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012349
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012350 int mem_base;
12351 long ret_val;
12352 xmlParserCtxtPtr ctxt; /* an XML parser context */
12353 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012354
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012355 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12356 mem_base = xmlMemBlocks();
12357 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12358
12359 ret_val = xmlByteConsumed(ctxt);
12360 desret_long(ret_val);
12361 call_tests++;
12362 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12363 xmlResetLastError();
12364 if (mem_base != xmlMemBlocks()) {
12365 printf("Leak of %d blocks found in xmlByteConsumed",
12366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012367 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012368 printf(" %d", n_ctxt);
12369 printf("\n");
12370 }
12371 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012372 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012373
Daniel Veillard42595322004-11-08 10:52:06 +000012374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012375}
12376
12377
12378static int
12379test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012381
Daniel Veillardce682bc2004-11-05 17:22:25 +000012382 int mem_base;
12383 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12384 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012385
Daniel Veillardce682bc2004-11-05 17:22:25 +000012386 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12387 mem_base = xmlMemBlocks();
12388 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12389
12390 xmlClearNodeInfoSeq(seq);
12391 call_tests++;
12392 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12393 xmlResetLastError();
12394 if (mem_base != xmlMemBlocks()) {
12395 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012397 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012398 printf(" %d", n_seq);
12399 printf("\n");
12400 }
12401 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012403
Daniel Veillard42595322004-11-08 10:52:06 +000012404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012405}
12406
12407
12408static int
12409test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012411
12412 int mem_base;
12413 xmlParserCtxtPtr ctxt; /* an XML parser context */
12414 int n_ctxt;
12415
12416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012418 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012419
12420 xmlClearParserCtxt(ctxt);
12421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012422 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012423 xmlResetLastError();
12424 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012425 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012427 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012428 printf(" %d", n_ctxt);
12429 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012430 }
12431 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012433
Daniel Veillard42595322004-11-08 10:52:06 +000012434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012435}
12436
12437
12438static int
12439test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441
Daniel Veillard34099b42004-11-04 17:34:35 +000012442 int mem_base;
12443 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012444 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012445 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012446
Daniel Veillard34099b42004-11-04 17:34:35 +000012447 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12448 mem_base = xmlMemBlocks();
12449 cur = gen_const_xmlChar_ptr(n_cur, 0);
12450
William M. Brackf13f77f2004-11-12 16:03:48 +000012451 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012452 desret_xmlParserCtxtPtr(ret_val);
12453 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012454 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012455 xmlResetLastError();
12456 if (mem_base != xmlMemBlocks()) {
12457 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012459 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012460 printf(" %d", n_cur);
12461 printf("\n");
12462 }
12463 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012464 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012465
Daniel Veillard42595322004-11-08 10:52:06 +000012466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012467}
12468
12469
12470static int
12471test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012473
William M. Brack21e4ef22005-01-02 09:53:13 +000012474#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012475 int mem_base;
12476 xmlParserCtxtPtr ret_val;
12477 xmlSAXHandlerPtr sax; /* a SAX handler */
12478 int n_sax;
12479 void * user_data; /* The user data returned on SAX callbacks */
12480 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012481 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012482 int n_chunk;
12483 int size; /* number of chars in the array */
12484 int n_size;
12485 const char * filename; /* an optional file name or URI */
12486 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012487
Daniel Veillard34099b42004-11-04 17:34:35 +000012488 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12489 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12490 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12491 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012492 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012493 mem_base = xmlMemBlocks();
12494 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12495 user_data = gen_userdata(n_user_data, 1);
12496 chunk = gen_const_char_ptr(n_chunk, 2);
12497 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012498 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012499
William M. Brackf13f77f2004-11-12 16:03:48 +000012500 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012501 desret_xmlParserCtxtPtr(ret_val);
12502 call_tests++;
12503 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12504 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012505 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012506 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012507 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012508 xmlResetLastError();
12509 if (mem_base != xmlMemBlocks()) {
12510 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012512 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012513 printf(" %d", n_sax);
12514 printf(" %d", n_user_data);
12515 printf(" %d", n_chunk);
12516 printf(" %d", n_size);
12517 printf(" %d", n_filename);
12518 printf("\n");
12519 }
12520 }
12521 }
12522 }
12523 }
12524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012525 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012526#endif
12527
Daniel Veillard42595322004-11-08 10:52:06 +000012528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012529}
12530
12531
12532static int
12533test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012535
12536 int mem_base;
12537 xmlDocPtr ret_val;
12538 xmlParserCtxtPtr ctxt; /* an XML parser context */
12539 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012540 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012541 int n_cur;
12542 const char * URL; /* the base URL to use for the document */
12543 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012544 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012545 int n_encoding;
12546 int options; /* a combination of xmlParserOption */
12547 int n_options;
12548
12549 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12550 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12551 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12552 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012553 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012555 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12556 cur = gen_const_xmlChar_ptr(n_cur, 1);
12557 URL = gen_filepath(n_URL, 2);
12558 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012559 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012560
William M. Brackf13f77f2004-11-12 16:03:48 +000012561 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012562 desret_xmlDocPtr(ret_val);
12563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012564 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012565 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012566 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012567 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012568 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012569 xmlResetLastError();
12570 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012571 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012574 printf(" %d", n_ctxt);
12575 printf(" %d", n_cur);
12576 printf(" %d", n_URL);
12577 printf(" %d", n_encoding);
12578 printf(" %d", n_options);
12579 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012580 }
12581 }
12582 }
12583 }
12584 }
12585 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012586 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012587
Daniel Veillard42595322004-11-08 10:52:06 +000012588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012589}
12590
12591
12592static int
12593test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012595
12596 int mem_base;
12597 xmlDocPtr ret_val;
12598 xmlParserCtxtPtr ctxt; /* an XML parser context */
12599 int n_ctxt;
12600 const char * filename; /* a file or URL */
12601 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012602 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012603 int n_encoding;
12604 int options; /* a combination of xmlParserOption */
12605 int n_options;
12606
12607 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12608 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12609 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012610 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012611 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012612 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12613 filename = gen_filepath(n_filename, 1);
12614 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012615 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012616
William M. Brackf13f77f2004-11-12 16:03:48 +000012617 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618 desret_xmlDocPtr(ret_val);
12619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012620 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12621 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012622 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012623 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012624 xmlResetLastError();
12625 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012626 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012628 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012629 printf(" %d", n_ctxt);
12630 printf(" %d", n_filename);
12631 printf(" %d", n_encoding);
12632 printf(" %d", n_options);
12633 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012634 }
12635 }
12636 }
12637 }
12638 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012640
Daniel Veillard42595322004-11-08 10:52:06 +000012641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642}
12643
12644
12645static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012646test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012648
12649 int mem_base;
12650 xmlDocPtr ret_val;
12651 xmlParserCtxtPtr ctxt; /* an XML parser context */
12652 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012653 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012654 int n_buffer;
12655 int size; /* the size of the array */
12656 int n_size;
12657 const char * URL; /* the base URL to use for the document */
12658 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012659 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012660 int n_encoding;
12661 int options; /* a combination of xmlParserOption */
12662 int n_options;
12663
12664 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12665 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12666 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12667 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12668 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012669 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012671 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12672 buffer = gen_const_char_ptr(n_buffer, 1);
12673 size = gen_int(n_size, 2);
12674 URL = gen_filepath(n_URL, 3);
12675 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012676 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012677
William M. Brackf13f77f2004-11-12 16:03:48 +000012678 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012679 desret_xmlDocPtr(ret_val);
12680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012681 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012682 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012683 des_int(n_size, size, 2);
12684 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012685 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012686 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012687 xmlResetLastError();
12688 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012689 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012691 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012692 printf(" %d", n_ctxt);
12693 printf(" %d", n_buffer);
12694 printf(" %d", n_size);
12695 printf(" %d", n_URL);
12696 printf(" %d", n_encoding);
12697 printf(" %d", n_options);
12698 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012699 }
12700 }
12701 }
12702 }
12703 }
12704 }
12705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012707
Daniel Veillard42595322004-11-08 10:52:06 +000012708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012709}
12710
12711
12712static int
12713test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715
12716 int mem_base;
12717 xmlParserCtxtPtr ctxt; /* an XML parser context */
12718 int n_ctxt;
12719
12720 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012722 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012723
12724 xmlCtxtReset(ctxt);
12725 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012726 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012727 xmlResetLastError();
12728 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012729 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012731 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012732 printf(" %d", n_ctxt);
12733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012734 }
12735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012737
Daniel Veillard42595322004-11-08 10:52:06 +000012738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012739}
12740
12741
12742static int
12743test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745
12746 int mem_base;
12747 int ret_val;
12748 xmlParserCtxtPtr ctxt; /* an XML parser context */
12749 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012750 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751 int n_chunk;
12752 int size; /* number of chars in the array */
12753 int n_size;
12754 const char * filename; /* an optional file name or URI */
12755 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012756 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012757 int n_encoding;
12758
12759 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12760 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12761 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12762 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12763 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012765 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12766 chunk = gen_const_char_ptr(n_chunk, 1);
12767 size = gen_int(n_size, 2);
12768 filename = gen_filepath(n_filename, 3);
12769 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770
William M. Brackf13f77f2004-11-12 16:03:48 +000012771 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012772 desret_int(ret_val);
12773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012774 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012775 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012776 des_int(n_size, size, 2);
12777 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012778 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012779 xmlResetLastError();
12780 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012781 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012783 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012784 printf(" %d", n_ctxt);
12785 printf(" %d", n_chunk);
12786 printf(" %d", n_size);
12787 printf(" %d", n_filename);
12788 printf(" %d", n_encoding);
12789 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012790 }
12791 }
12792 }
12793 }
12794 }
12795 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012796 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012797
Daniel Veillard42595322004-11-08 10:52:06 +000012798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012799}
12800
12801
12802static int
12803test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805
12806 int mem_base;
12807 int ret_val;
12808 xmlParserCtxtPtr ctxt; /* an XML parser context */
12809 int n_ctxt;
12810 int options; /* a combination of xmlParserOption */
12811 int n_options;
12812
12813 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012814 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012816 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012817 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012818
12819 ret_val = xmlCtxtUseOptions(ctxt, options);
12820 desret_int(ret_val);
12821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012822 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012823 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012824 xmlResetLastError();
12825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012826 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012829 printf(" %d", n_ctxt);
12830 printf(" %d", n_options);
12831 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012832 }
12833 }
12834 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012836
Daniel Veillard42595322004-11-08 10:52:06 +000012837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012838}
12839
12840
12841static int
12842test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012844
12845
12846 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012848}
12849
12850
12851static int
12852test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012854
William M. Brack21e4ef22005-01-02 09:53:13 +000012855#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012856#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012857 int mem_base;
12858 int ret_val;
12859 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12860 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012861 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012862 int n_name;
12863 void * result; /* location to store the result */
12864 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012865
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012866 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12867 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12868 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012870 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12871 name = gen_const_char_ptr(n_name, 1);
12872 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012873
William M. Brackf13f77f2004-11-12 16:03:48 +000012874 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012875 desret_int(ret_val);
12876 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012877 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012878 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012879 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012880 xmlResetLastError();
12881 if (mem_base != xmlMemBlocks()) {
12882 printf("Leak of %d blocks found in xmlGetFeature",
12883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012884 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012885 printf(" %d", n_ctxt);
12886 printf(" %d", n_name);
12887 printf(" %d", n_result);
12888 printf("\n");
12889 }
12890 }
12891 }
12892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012893 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012894#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012895#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012896
Daniel Veillard42595322004-11-08 10:52:06 +000012897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012898}
12899
12900
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012901#define gen_nb_const_char_ptr_ptr 1
12902static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12903 return(NULL);
12904}
12905static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12906}
12907
Daniel Veillardd93f6252004-11-02 15:53:51 +000012908static int
12909test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012911
William M. Brack21e4ef22005-01-02 09:53:13 +000012912#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012913#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012914 int mem_base;
12915 int ret_val;
12916 int * len; /* the length of the features name array (input/output) */
12917 int n_len;
12918 char ** result; /* an array of string to be filled with the features name. */
12919 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012920
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012921 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12922 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12923 mem_base = xmlMemBlocks();
12924 len = gen_int_ptr(n_len, 0);
12925 result = gen_const_char_ptr_ptr(n_result, 1);
12926
William M. Brackf13f77f2004-11-12 16:03:48 +000012927 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012928 desret_int(ret_val);
12929 call_tests++;
12930 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012931 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012932 xmlResetLastError();
12933 if (mem_base != xmlMemBlocks()) {
12934 printf("Leak of %d blocks found in xmlGetFeaturesList",
12935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012936 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012937 printf(" %d", n_len);
12938 printf(" %d", n_result);
12939 printf("\n");
12940 }
12941 }
12942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012943 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012944#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012945#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012946
Daniel Veillard42595322004-11-08 10:52:06 +000012947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012948}
12949
12950
12951static int
12952test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012954
William M. Brack21e4ef22005-01-02 09:53:13 +000012955#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012956#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012957 int mem_base;
12958 xmlDtdPtr ret_val;
12959 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12960 int n_sax;
12961 xmlParserInputBufferPtr input; /* an Input Buffer */
12962 int n_input;
12963 xmlCharEncoding enc; /* the charset encoding if known */
12964 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012965
Daniel Veillard34099b42004-11-04 17:34:35 +000012966 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12967 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
12968 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
12969 mem_base = xmlMemBlocks();
12970 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12971 input = gen_xmlParserInputBufferPtr(n_input, 1);
12972 enc = gen_xmlCharEncoding(n_enc, 2);
12973
12974 ret_val = xmlIOParseDTD(sax, input, enc);
12975 input = NULL;
12976 desret_xmlDtdPtr(ret_val);
12977 call_tests++;
12978 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12979 des_xmlParserInputBufferPtr(n_input, input, 1);
12980 des_xmlCharEncoding(n_enc, enc, 2);
12981 xmlResetLastError();
12982 if (mem_base != xmlMemBlocks()) {
12983 printf("Leak of %d blocks found in xmlIOParseDTD",
12984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012985 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012986 printf(" %d", n_sax);
12987 printf(" %d", n_input);
12988 printf(" %d", n_enc);
12989 printf("\n");
12990 }
12991 }
12992 }
12993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012994 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012995#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012996#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000012997
Daniel Veillard42595322004-11-08 10:52:06 +000012998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012999}
13000
13001
13002static int
13003test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013005
Daniel Veillardce682bc2004-11-05 17:22:25 +000013006 int mem_base;
13007 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13008 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013009
Daniel Veillardce682bc2004-11-05 17:22:25 +000013010 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13011 mem_base = xmlMemBlocks();
13012 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13013
13014 xmlInitNodeInfoSeq(seq);
13015 call_tests++;
13016 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13017 xmlResetLastError();
13018 if (mem_base != xmlMemBlocks()) {
13019 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013021 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013022 printf(" %d", n_seq);
13023 printf("\n");
13024 }
13025 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013026 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013027
Daniel Veillard42595322004-11-08 10:52:06 +000013028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013029}
13030
13031
13032static int
13033test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013035
13036 int mem_base;
13037
13038 mem_base = xmlMemBlocks();
13039
13040 xmlInitParser();
13041 call_tests++;
13042 xmlResetLastError();
13043 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013044 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013046 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013047 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013048 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013049 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013050
Daniel Veillard42595322004-11-08 10:52:06 +000013051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013052}
13053
13054
13055static int
13056test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013058
13059 int mem_base;
13060 int ret_val;
13061 xmlParserCtxtPtr ctxt; /* an XML parser context */
13062 int n_ctxt;
13063
13064 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13065 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013066 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013067
13068 ret_val = xmlInitParserCtxt(ctxt);
13069 desret_int(ret_val);
13070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013071 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013072 xmlResetLastError();
13073 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013074 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013076 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013077 printf(" %d", n_ctxt);
13078 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013079 }
13080 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013082
Daniel Veillard42595322004-11-08 10:52:06 +000013083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013084}
13085
13086
13087static int
13088test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013090
13091 int mem_base;
13092 int ret_val;
13093 int val; /* int 0 or 1 */
13094 int n_val;
13095
13096 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013098 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099
13100 ret_val = xmlKeepBlanksDefault(val);
13101 desret_int(ret_val);
13102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013103 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013104 xmlResetLastError();
13105 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013106 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013108 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013109 printf(" %d", n_val);
13110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013111 }
13112 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013114
Daniel Veillard42595322004-11-08 10:52:06 +000013115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013116}
13117
13118
13119static int
13120test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013122
13123 int mem_base;
13124 int ret_val;
13125 int val; /* int 0 or 1 */
13126 int n_val;
13127
13128 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13129 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013130 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013131
13132 ret_val = xmlLineNumbersDefault(val);
13133 desret_int(ret_val);
13134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013135 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013136 xmlResetLastError();
13137 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013138 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013140 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013141 printf(" %d", n_val);
13142 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013143 }
13144 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013146
Daniel Veillard42595322004-11-08 10:52:06 +000013147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013148}
13149
13150
13151static int
13152test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154
Daniel Veillard42595322004-11-08 10:52:06 +000013155 int mem_base;
13156 xmlParserInputPtr ret_val;
13157 const char * URL; /* the URL for the entity to load */
13158 int n_URL;
13159 char * ID; /* the Public ID for the entity to load */
13160 int n_ID;
13161 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13162 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013163
Daniel Veillard42595322004-11-08 10:52:06 +000013164 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13165 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13166 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13167 mem_base = xmlMemBlocks();
13168 URL = gen_filepath(n_URL, 0);
13169 ID = gen_const_char_ptr(n_ID, 1);
13170 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13171
William M. Brackf13f77f2004-11-12 16:03:48 +000013172 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013173 desret_xmlParserInputPtr(ret_val);
13174 call_tests++;
13175 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013176 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013177 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13178 xmlResetLastError();
13179 if (mem_base != xmlMemBlocks()) {
13180 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13181 xmlMemBlocks() - mem_base);
13182 test_ret++;
13183 printf(" %d", n_URL);
13184 printf(" %d", n_ID);
13185 printf(" %d", n_ctxt);
13186 printf("\n");
13187 }
13188 }
13189 }
13190 }
Daniel Veillard42595322004-11-08 10:52:06 +000013191 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013192
Daniel Veillard42595322004-11-08 10:52:06 +000013193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013194}
13195
13196
13197static int
13198test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013200
Daniel Veillard42595322004-11-08 10:52:06 +000013201 int mem_base;
13202 xmlParserInputPtr ret_val;
13203 xmlParserCtxtPtr ctxt; /* an XML parser context */
13204 int n_ctxt;
13205 xmlParserInputBufferPtr input; /* an I/O Input */
13206 int n_input;
13207 xmlCharEncoding enc; /* the charset encoding if known */
13208 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209
Daniel Veillard42595322004-11-08 10:52:06 +000013210 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13211 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13212 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13213 mem_base = xmlMemBlocks();
13214 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13215 input = gen_xmlParserInputBufferPtr(n_input, 1);
13216 enc = gen_xmlCharEncoding(n_enc, 2);
13217
13218 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13219 if (ret_val != NULL) input = NULL;
13220 desret_xmlParserInputPtr(ret_val);
13221 call_tests++;
13222 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13223 des_xmlParserInputBufferPtr(n_input, input, 1);
13224 des_xmlCharEncoding(n_enc, enc, 2);
13225 xmlResetLastError();
13226 if (mem_base != xmlMemBlocks()) {
13227 printf("Leak of %d blocks found in xmlNewIOInputStream",
13228 xmlMemBlocks() - mem_base);
13229 test_ret++;
13230 printf(" %d", n_ctxt);
13231 printf(" %d", n_input);
13232 printf(" %d", n_enc);
13233 printf("\n");
13234 }
13235 }
13236 }
13237 }
Daniel Veillard42595322004-11-08 10:52:06 +000013238 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013239
Daniel Veillard42595322004-11-08 10:52:06 +000013240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013241}
13242
13243
13244static int
13245test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013247
Daniel Veillard34099b42004-11-04 17:34:35 +000013248 int mem_base;
13249 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013250
Daniel Veillard34099b42004-11-04 17:34:35 +000013251 mem_base = xmlMemBlocks();
13252
13253 ret_val = xmlNewParserCtxt();
13254 desret_xmlParserCtxtPtr(ret_val);
13255 call_tests++;
13256 xmlResetLastError();
13257 if (mem_base != xmlMemBlocks()) {
13258 printf("Leak of %d blocks found in xmlNewParserCtxt",
13259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013260 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013261 printf("\n");
13262 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013264
Daniel Veillard42595322004-11-08 10:52:06 +000013265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013266}
13267
13268
Daniel Veillardce682bc2004-11-05 17:22:25 +000013269#define gen_nb_xmlNodePtr_ptr 1
13270static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13271 return(NULL);
13272}
13273static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13274}
13275
Daniel Veillardd93f6252004-11-02 15:53:51 +000013276static int
13277test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013279
William M. Brack21e4ef22005-01-02 09:53:13 +000013280#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013281#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013282 int mem_base;
13283 int ret_val;
13284 xmlDocPtr doc; /* the document the chunk pertains to */
13285 int n_doc;
13286 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13287 int n_sax;
13288 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13289 int n_user_data;
13290 int depth; /* Used for loop detection, use 0 */
13291 int n_depth;
13292 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13293 int n_string;
13294 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13295 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013296
Daniel Veillardce682bc2004-11-05 17:22:25 +000013297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13298 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13299 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13300 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13301 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13302 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13303 mem_base = xmlMemBlocks();
13304 doc = gen_xmlDocPtr(n_doc, 0);
13305 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13306 user_data = gen_userdata(n_user_data, 2);
13307 depth = gen_int(n_depth, 3);
13308 string = gen_const_xmlChar_ptr(n_string, 4);
13309 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013310
13311#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013312 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013313#endif
13314
Daniel Veillardce682bc2004-11-05 17:22:25 +000013315
William M. Brackf13f77f2004-11-12 16:03:48 +000013316 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013317 desret_int(ret_val);
13318 call_tests++;
13319 des_xmlDocPtr(n_doc, doc, 0);
13320 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13321 des_userdata(n_user_data, user_data, 2);
13322 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013323 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013324 des_xmlNodePtr_ptr(n_lst, lst, 5);
13325 xmlResetLastError();
13326 if (mem_base != xmlMemBlocks()) {
13327 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013329 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013330 printf(" %d", n_doc);
13331 printf(" %d", n_sax);
13332 printf(" %d", n_user_data);
13333 printf(" %d", n_depth);
13334 printf(" %d", n_string);
13335 printf(" %d", n_lst);
13336 printf("\n");
13337 }
13338 }
13339 }
13340 }
13341 }
13342 }
13343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013344 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013345#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013346#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013347
Daniel Veillard42595322004-11-08 10:52:06 +000013348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013349}
13350
13351
13352static int
13353test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013355
William M. Brack21e4ef22005-01-02 09:53:13 +000013356#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013357#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013358 int mem_base;
13359 int ret_val;
13360 xmlDocPtr doc; /* the document the chunk pertains to */
13361 int n_doc;
13362 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13363 int n_sax;
13364 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13365 int n_user_data;
13366 int depth; /* Used for loop detection, use 0 */
13367 int n_depth;
13368 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13369 int n_string;
13370 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13371 int n_lst;
13372 int recover; /* return nodes even if the data is broken (use 0) */
13373 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013374
Daniel Veillardce682bc2004-11-05 17:22:25 +000013375 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13376 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13377 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13378 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13379 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13380 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13381 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13382 mem_base = xmlMemBlocks();
13383 doc = gen_xmlDocPtr(n_doc, 0);
13384 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13385 user_data = gen_userdata(n_user_data, 2);
13386 depth = gen_int(n_depth, 3);
13387 string = gen_const_xmlChar_ptr(n_string, 4);
13388 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13389 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013390
13391#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013392 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013393#endif
13394
Daniel Veillardce682bc2004-11-05 17:22:25 +000013395
William M. Brackf13f77f2004-11-12 16:03:48 +000013396 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013397 desret_int(ret_val);
13398 call_tests++;
13399 des_xmlDocPtr(n_doc, doc, 0);
13400 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13401 des_userdata(n_user_data, user_data, 2);
13402 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013403 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013404 des_xmlNodePtr_ptr(n_lst, lst, 5);
13405 des_int(n_recover, recover, 6);
13406 xmlResetLastError();
13407 if (mem_base != xmlMemBlocks()) {
13408 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013411 printf(" %d", n_doc);
13412 printf(" %d", n_sax);
13413 printf(" %d", n_user_data);
13414 printf(" %d", n_depth);
13415 printf(" %d", n_string);
13416 printf(" %d", n_lst);
13417 printf(" %d", n_recover);
13418 printf("\n");
13419 }
13420 }
13421 }
13422 }
13423 }
13424 }
13425 }
13426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013427 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013428#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013429#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013430
Daniel Veillard42595322004-11-08 10:52:06 +000013431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013432}
13433
13434
13435static int
13436test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013438
William M. Brack21e4ef22005-01-02 09:53:13 +000013439#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013440 int mem_base;
13441 int ret_val;
13442 xmlParserCtxtPtr ctxt; /* an XML parser context */
13443 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013444 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013445 int n_chunk;
13446 int size; /* the size in byte of the chunk */
13447 int n_size;
13448 int terminate; /* last chunk indicator */
13449 int n_terminate;
13450
13451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13452 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13453 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13454 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013456 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13457 chunk = gen_const_char_ptr(n_chunk, 1);
13458 size = gen_int(n_size, 2);
13459 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460
William M. Brackf13f77f2004-11-12 16:03:48 +000013461 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013462 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013463 desret_int(ret_val);
13464 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013465 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013466 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013467 des_int(n_size, size, 2);
13468 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013469 xmlResetLastError();
13470 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013471 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013473 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013474 printf(" %d", n_ctxt);
13475 printf(" %d", n_chunk);
13476 printf(" %d", n_size);
13477 printf(" %d", n_terminate);
13478 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013479 }
13480 }
13481 }
13482 }
13483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013484 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013485#endif
13486
Daniel Veillard42595322004-11-08 10:52:06 +000013487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013488}
13489
13490
13491static int
13492test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013494
Daniel Veillardce682bc2004-11-05 17:22:25 +000013495 int mem_base;
13496 int ret_val;
13497 xmlParserCtxtPtr ctx; /* the existing parsing context */
13498 int n_ctx;
13499 xmlChar * URL; /* the URL for the entity to load */
13500 int n_URL;
13501 xmlChar * ID; /* the System ID for the entity to load */
13502 int n_ID;
13503 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13504 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013505
Daniel Veillardce682bc2004-11-05 17:22:25 +000013506 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13507 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13508 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13509 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13510 mem_base = xmlMemBlocks();
13511 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13512 URL = gen_const_xmlChar_ptr(n_URL, 1);
13513 ID = gen_const_xmlChar_ptr(n_ID, 2);
13514 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13515
William M. Brackf13f77f2004-11-12 16:03:48 +000013516 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013517 desret_int(ret_val);
13518 call_tests++;
13519 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013520 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13521 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013522 des_xmlNodePtr_ptr(n_lst, lst, 3);
13523 xmlResetLastError();
13524 if (mem_base != xmlMemBlocks()) {
13525 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013527 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013528 printf(" %d", n_ctx);
13529 printf(" %d", n_URL);
13530 printf(" %d", n_ID);
13531 printf(" %d", n_lst);
13532 printf("\n");
13533 }
13534 }
13535 }
13536 }
13537 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013539
Daniel Veillard42595322004-11-08 10:52:06 +000013540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013541}
13542
13543
13544static int
13545test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013547
William M. Brack21e4ef22005-01-02 09:53:13 +000013548#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013549#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013550 int mem_base;
13551 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013552 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013553 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013554 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013555 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013556
Daniel Veillard34099b42004-11-04 17:34:35 +000013557 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13558 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13559 mem_base = xmlMemBlocks();
13560 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13561 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13562
William M. Brackf13f77f2004-11-12 16:03:48 +000013563 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013564 desret_xmlDtdPtr(ret_val);
13565 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013566 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13567 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013568 xmlResetLastError();
13569 if (mem_base != xmlMemBlocks()) {
13570 printf("Leak of %d blocks found in xmlParseDTD",
13571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013572 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013573 printf(" %d", n_ExternalID);
13574 printf(" %d", n_SystemID);
13575 printf("\n");
13576 }
13577 }
13578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013579 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013580#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013581#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013582
Daniel Veillard42595322004-11-08 10:52:06 +000013583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013584}
13585
13586
13587static int
13588test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013590
William M. Brack21e4ef22005-01-02 09:53:13 +000013591#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013592#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013593 int mem_base;
13594 xmlDocPtr ret_val;
13595 xmlChar * cur; /* a pointer to an array of xmlChar */
13596 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013597
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013598 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013600 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013601
13602 ret_val = xmlParseDoc(cur);
13603 desret_xmlDocPtr(ret_val);
13604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013605 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013606 xmlResetLastError();
13607 if (mem_base != xmlMemBlocks()) {
13608 printf("Leak of %d blocks found in xmlParseDoc",
13609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013610 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013611 printf(" %d", n_cur);
13612 printf("\n");
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 Veillard8a32fe42004-11-02 22:10:16 +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_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013626
13627 int mem_base;
13628 int ret_val;
13629 xmlParserCtxtPtr ctxt; /* an XML parser context */
13630 int n_ctxt;
13631
13632 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013634 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013635
13636 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013637 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013638 desret_int(ret_val);
13639 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013640 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641 xmlResetLastError();
13642 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013643 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013645 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013646 printf(" %d", n_ctxt);
13647 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013648 }
13649 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013651
Daniel Veillard42595322004-11-08 10:52:06 +000013652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013653}
13654
13655
13656static int
13657test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013659
William M. Brack21e4ef22005-01-02 09:53:13 +000013660#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013661#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013662 int mem_base;
13663 xmlDocPtr ret_val;
13664 const char * filename; /* the filename */
13665 int n_filename;
13666
13667 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013669 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013670
13671 ret_val = xmlParseEntity(filename);
13672 desret_xmlDocPtr(ret_val);
13673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013674 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013675 xmlResetLastError();
13676 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013677 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013679 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013680 printf(" %d", n_filename);
13681 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013682 }
13683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013684 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013685#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013686#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013695
13696 int mem_base;
13697 int ret_val;
13698 xmlParserCtxtPtr ctxt; /* an XML parser context */
13699 int n_ctxt;
13700
13701 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013703 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013704
13705 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013706 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013707 desret_int(ret_val);
13708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013709 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013710 xmlResetLastError();
13711 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013712 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013714 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013715 printf(" %d", n_ctxt);
13716 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013717 }
13718 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013720
Daniel Veillard42595322004-11-08 10:52:06 +000013721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013722}
13723
13724
13725static int
13726test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013728
William M. Brack21e4ef22005-01-02 09:53:13 +000013729#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013730#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013731 int mem_base;
13732 int ret_val;
13733 xmlDocPtr doc; /* the document the chunk pertains to */
13734 int n_doc;
13735 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13736 int n_sax;
13737 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13738 int n_user_data;
13739 int depth; /* Used for loop detection, use 0 */
13740 int n_depth;
13741 xmlChar * URL; /* the URL for the entity to load */
13742 int n_URL;
13743 xmlChar * ID; /* the System ID for the entity to load */
13744 int n_ID;
13745 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13746 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013747
Daniel Veillardce682bc2004-11-05 17:22:25 +000013748 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13749 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13750 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13751 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13752 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13753 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13754 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13755 mem_base = xmlMemBlocks();
13756 doc = gen_xmlDocPtr(n_doc, 0);
13757 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13758 user_data = gen_userdata(n_user_data, 2);
13759 depth = gen_int(n_depth, 3);
13760 URL = gen_const_xmlChar_ptr(n_URL, 4);
13761 ID = gen_const_xmlChar_ptr(n_ID, 5);
13762 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13763
William M. Brackf13f77f2004-11-12 16:03:48 +000013764 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013765 desret_int(ret_val);
13766 call_tests++;
13767 des_xmlDocPtr(n_doc, doc, 0);
13768 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13769 des_userdata(n_user_data, user_data, 2);
13770 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013771 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13772 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013773 des_xmlNodePtr_ptr(n_lst, lst, 6);
13774 xmlResetLastError();
13775 if (mem_base != xmlMemBlocks()) {
13776 printf("Leak of %d blocks found in xmlParseExternalEntity",
13777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013778 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013779 printf(" %d", n_doc);
13780 printf(" %d", n_sax);
13781 printf(" %d", n_user_data);
13782 printf(" %d", n_depth);
13783 printf(" %d", n_URL);
13784 printf(" %d", n_ID);
13785 printf(" %d", n_lst);
13786 printf("\n");
13787 }
13788 }
13789 }
13790 }
13791 }
13792 }
13793 }
13794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013795 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013796#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013797#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013798
Daniel Veillard42595322004-11-08 10:52:06 +000013799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013800}
13801
13802
13803static int
13804test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013806
William M. Brack21e4ef22005-01-02 09:53:13 +000013807#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013808#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013809 int mem_base;
13810 xmlDocPtr ret_val;
13811 const char * filename; /* the filename */
13812 int n_filename;
13813
13814 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013816 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013817
13818 ret_val = xmlParseFile(filename);
13819 desret_xmlDocPtr(ret_val);
13820 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013821 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822 xmlResetLastError();
13823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013824 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013827 printf(" %d", n_filename);
13828 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013829 }
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 Veillardd93f6252004-11-02 15:53:51 +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_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013842
Daniel Veillard57b25162004-11-06 14:50:18 +000013843 int mem_base;
13844 xmlParserErrors ret_val;
13845 xmlNodePtr node; /* the context node */
13846 int n_node;
13847 char * data; /* the input string */
13848 int n_data;
13849 int datalen; /* the input string length in bytes */
13850 int n_datalen;
13851 int options; /* a combination of xmlParserOption */
13852 int n_options;
13853 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13854 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013855
Daniel Veillard57b25162004-11-06 14:50:18 +000013856 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13857 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13858 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013859 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013860 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13861 mem_base = xmlMemBlocks();
13862 node = gen_xmlNodePtr(n_node, 0);
13863 data = gen_const_char_ptr(n_data, 1);
13864 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013865 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013866 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13867
William M. Brackf13f77f2004-11-12 16:03:48 +000013868 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013869 desret_xmlParserErrors(ret_val);
13870 call_tests++;
13871 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013872 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013873 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013874 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013875 des_xmlNodePtr_ptr(n_lst, lst, 4);
13876 xmlResetLastError();
13877 if (mem_base != xmlMemBlocks()) {
13878 printf("Leak of %d blocks found in xmlParseInNodeContext",
13879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013880 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013881 printf(" %d", n_node);
13882 printf(" %d", n_data);
13883 printf(" %d", n_datalen);
13884 printf(" %d", n_options);
13885 printf(" %d", n_lst);
13886 printf("\n");
13887 }
13888 }
13889 }
13890 }
13891 }
13892 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013893 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013894
Daniel Veillard42595322004-11-08 10:52:06 +000013895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013896}
13897
13898
13899static int
13900test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013902
William M. Brack21e4ef22005-01-02 09:53:13 +000013903#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013904#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013905 int mem_base;
13906 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013907 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013908 int n_buffer;
13909 int size; /* the size of the array */
13910 int n_size;
13911
13912 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13913 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13914 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013915 buffer = gen_const_char_ptr(n_buffer, 0);
13916 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
William M. Brackf13f77f2004-11-12 16:03:48 +000013918 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013919 desret_xmlDocPtr(ret_val);
13920 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013921 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013922 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013923 xmlResetLastError();
13924 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013925 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013927 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013928 printf(" %d", n_buffer);
13929 printf(" %d", n_size);
13930 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013931 }
13932 }
13933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013934 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013935#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013936#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013937
Daniel Veillard42595322004-11-08 10:52:06 +000013938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013939}
13940
13941
Daniel Veillardce682bc2004-11-05 17:22:25 +000013942#define gen_nb_const_xmlParserNodeInfoPtr 1
13943static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13944 return(NULL);
13945}
13946static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13947}
13948
Daniel Veillardd93f6252004-11-02 15:53:51 +000013949static int
13950test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
Daniel Veillardce682bc2004-11-05 17:22:25 +000013953 int mem_base;
13954 xmlParserCtxtPtr ctxt; /* an XML parser context */
13955 int n_ctxt;
13956 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13957 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013958
Daniel Veillardce682bc2004-11-05 17:22:25 +000013959 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13960 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13961 mem_base = xmlMemBlocks();
13962 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13963 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
13964
William M. Brackf13f77f2004-11-12 16:03:48 +000013965 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013966 call_tests++;
13967 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013968 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013969 xmlResetLastError();
13970 if (mem_base != xmlMemBlocks()) {
13971 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
13972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013973 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013974 printf(" %d", n_ctxt);
13975 printf(" %d", n_info);
13976 printf("\n");
13977 }
13978 }
13979 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013980 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013981
Daniel Veillard42595322004-11-08 10:52:06 +000013982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013983}
13984
13985
Daniel Veillardce682bc2004-11-05 17:22:25 +000013986#define gen_nb_const_xmlParserCtxtPtr 1
13987static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13988 return(NULL);
13989}
13990static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13991}
13992
Daniel Veillarda521d282004-11-09 14:59:59 +000013993#define gen_nb_const_xmlNodePtr 1
13994static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13995 return(NULL);
13996}
13997static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13998}
13999
Daniel Veillardd93f6252004-11-02 15:53:51 +000014000static int
14001test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014003
William M. Brack094dd862004-11-14 14:28:34 +000014004 int mem_base;
14005 const xmlParserNodeInfo * ret_val;
14006 xmlParserCtxtPtr ctx; /* an XML parser context */
14007 int n_ctx;
14008 xmlNodePtr node; /* an XML node within the tree */
14009 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014010
William M. Brack094dd862004-11-14 14:28:34 +000014011 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14012 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14013 mem_base = xmlMemBlocks();
14014 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14015 node = gen_const_xmlNodePtr(n_node, 1);
14016
14017 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14018 desret_const_xmlParserNodeInfo_ptr(ret_val);
14019 call_tests++;
14020 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14021 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14022 xmlResetLastError();
14023 if (mem_base != xmlMemBlocks()) {
14024 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14025 xmlMemBlocks() - mem_base);
14026 test_ret++;
14027 printf(" %d", n_ctx);
14028 printf(" %d", n_node);
14029 printf("\n");
14030 }
14031 }
14032 }
14033 function_tests++;
14034
Daniel Veillard42595322004-11-08 10:52:06 +000014035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014036}
14037
14038
Daniel Veillardce682bc2004-11-05 17:22:25 +000014039#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14040static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14041 return(NULL);
14042}
14043static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14044}
14045
Daniel Veillardd93f6252004-11-02 15:53:51 +000014046static int
14047test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014049
William M. Brack094dd862004-11-14 14:28:34 +000014050 int mem_base;
14051 unsigned long ret_val;
14052 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14053 int n_seq;
14054 xmlNodePtr node; /* an XML node pointer */
14055 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014056
William M. Brack094dd862004-11-14 14:28:34 +000014057 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14058 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14059 mem_base = xmlMemBlocks();
14060 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14061 node = gen_const_xmlNodePtr(n_node, 1);
14062
14063 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14064 desret_unsigned_long(ret_val);
14065 call_tests++;
14066 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14067 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14068 xmlResetLastError();
14069 if (mem_base != xmlMemBlocks()) {
14070 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14071 xmlMemBlocks() - mem_base);
14072 test_ret++;
14073 printf(" %d", n_seq);
14074 printf(" %d", n_node);
14075 printf("\n");
14076 }
14077 }
14078 }
14079 function_tests++;
14080
Daniel Veillard42595322004-11-08 10:52:06 +000014081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014082}
14083
14084
Daniel Veillardce682bc2004-11-05 17:22:25 +000014085#define gen_nb_xmlParserInputPtr 1
14086static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14087 return(NULL);
14088}
14089static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14090}
14091
Daniel Veillardd93f6252004-11-02 15:53:51 +000014092static int
14093test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014095
Daniel Veillardce682bc2004-11-05 17:22:25 +000014096 int mem_base;
14097 int ret_val;
14098 xmlParserInputPtr in; /* an XML parser input */
14099 int n_in;
14100 int len; /* an indicative size for the lookahead */
14101 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014102
Daniel Veillardce682bc2004-11-05 17:22:25 +000014103 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14104 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14105 mem_base = xmlMemBlocks();
14106 in = gen_xmlParserInputPtr(n_in, 0);
14107 len = gen_int(n_len, 1);
14108
14109 ret_val = xmlParserInputGrow(in, len);
14110 desret_int(ret_val);
14111 call_tests++;
14112 des_xmlParserInputPtr(n_in, in, 0);
14113 des_int(n_len, len, 1);
14114 xmlResetLastError();
14115 if (mem_base != xmlMemBlocks()) {
14116 printf("Leak of %d blocks found in xmlParserInputGrow",
14117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014118 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014119 printf(" %d", n_in);
14120 printf(" %d", n_len);
14121 printf("\n");
14122 }
14123 }
14124 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014125 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014126
Daniel Veillard42595322004-11-08 10:52:06 +000014127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014128}
14129
14130
14131static int
14132test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014134
Daniel Veillardce682bc2004-11-05 17:22:25 +000014135 int mem_base;
14136 int ret_val;
14137 xmlParserInputPtr in; /* an XML parser input */
14138 int n_in;
14139 int len; /* an indicative size for the lookahead */
14140 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014141
Daniel Veillardce682bc2004-11-05 17:22:25 +000014142 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14143 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14144 mem_base = xmlMemBlocks();
14145 in = gen_xmlParserInputPtr(n_in, 0);
14146 len = gen_int(n_len, 1);
14147
14148 ret_val = xmlParserInputRead(in, len);
14149 desret_int(ret_val);
14150 call_tests++;
14151 des_xmlParserInputPtr(n_in, in, 0);
14152 des_int(n_len, len, 1);
14153 xmlResetLastError();
14154 if (mem_base != xmlMemBlocks()) {
14155 printf("Leak of %d blocks found in xmlParserInputRead",
14156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014157 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014158 printf(" %d", n_in);
14159 printf(" %d", n_len);
14160 printf("\n");
14161 }
14162 }
14163 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014165
Daniel Veillard42595322004-11-08 10:52:06 +000014166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014167}
14168
14169
14170static int
14171test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014173
14174 int mem_base;
14175 int ret_val;
14176 int val; /* int 0 or 1 */
14177 int n_val;
14178
14179 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014181 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182
14183 ret_val = xmlPedanticParserDefault(val);
14184 desret_int(ret_val);
14185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014186 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014187 xmlResetLastError();
14188 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014189 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014192 printf(" %d", n_val);
14193 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014194 }
14195 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014197
Daniel Veillard42595322004-11-08 10:52:06 +000014198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014199}
14200
14201
14202static int
14203test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014205
14206 int mem_base;
14207 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014208 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209 int n_cur;
14210 const char * URL; /* the base URL to use for the document */
14211 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014212 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014213 int n_encoding;
14214 int options; /* a combination of xmlParserOption */
14215 int n_options;
14216
14217 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14218 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14219 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014220 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014222 cur = gen_const_xmlChar_ptr(n_cur, 0);
14223 URL = gen_filepath(n_URL, 1);
14224 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014225 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014226
William M. Brackf13f77f2004-11-12 16:03:48 +000014227 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228 desret_xmlDocPtr(ret_val);
14229 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014230 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014231 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014232 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014233 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014234 xmlResetLastError();
14235 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014236 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014238 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014239 printf(" %d", n_cur);
14240 printf(" %d", n_URL);
14241 printf(" %d", n_encoding);
14242 printf(" %d", n_options);
14243 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014244 }
14245 }
14246 }
14247 }
14248 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014250
Daniel Veillard42595322004-11-08 10:52:06 +000014251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014252}
14253
14254
14255static int
14256test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014258
14259 int mem_base;
14260 xmlDocPtr ret_val;
14261 const char * filename; /* a file or URL */
14262 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014263 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014264 int n_encoding;
14265 int options; /* a combination of xmlParserOption */
14266 int n_options;
14267
14268 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14269 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014270 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014272 filename = gen_filepath(n_filename, 0);
14273 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014274 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014275
William M. Brackf13f77f2004-11-12 16:03:48 +000014276 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014277 desret_xmlDocPtr(ret_val);
14278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014279 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014280 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014281 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014282 xmlResetLastError();
14283 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014284 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014286 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014287 printf(" %d", n_filename);
14288 printf(" %d", n_encoding);
14289 printf(" %d", n_options);
14290 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014291 }
14292 }
14293 }
14294 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014295 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014296
Daniel Veillard42595322004-11-08 10:52:06 +000014297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014298}
14299
14300
14301static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014302test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014304
14305 int mem_base;
14306 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014307 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014308 int n_buffer;
14309 int size; /* the size of the array */
14310 int n_size;
14311 const char * URL; /* the base URL to use for the document */
14312 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014313 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014314 int n_encoding;
14315 int options; /* a combination of xmlParserOption */
14316 int n_options;
14317
14318 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14319 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14320 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14321 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014322 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014324 buffer = gen_const_char_ptr(n_buffer, 0);
14325 size = gen_int(n_size, 1);
14326 URL = gen_filepath(n_URL, 2);
14327 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014328 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329
William M. Brackf13f77f2004-11-12 16:03:48 +000014330 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014331 desret_xmlDocPtr(ret_val);
14332 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014333 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014334 des_int(n_size, size, 1);
14335 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014336 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014337 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338 xmlResetLastError();
14339 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014340 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014342 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014343 printf(" %d", n_buffer);
14344 printf(" %d", n_size);
14345 printf(" %d", n_URL);
14346 printf(" %d", n_encoding);
14347 printf(" %d", n_options);
14348 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014349 }
14350 }
14351 }
14352 }
14353 }
14354 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014355 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014356
Daniel Veillard42595322004-11-08 10:52:06 +000014357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014358}
14359
14360
14361static int
14362test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364
William M. Brack21e4ef22005-01-02 09:53:13 +000014365#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014366#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014367 int mem_base;
14368 xmlDocPtr ret_val;
14369 xmlChar * cur; /* a pointer to an array of xmlChar */
14370 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014371
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014372 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014374 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014375
14376 ret_val = xmlRecoverDoc(cur);
14377 desret_xmlDocPtr(ret_val);
14378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014379 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014380 xmlResetLastError();
14381 if (mem_base != xmlMemBlocks()) {
14382 printf("Leak of %d blocks found in xmlRecoverDoc",
14383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014384 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014385 printf(" %d", n_cur);
14386 printf("\n");
14387 }
14388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014389 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014390#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014391#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +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_xmlRecoverFile(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 Veillardd93f6252004-11-02 15:53:51 +000014403 int mem_base;
14404 xmlDocPtr ret_val;
14405 const char * filename; /* the filename */
14406 int n_filename;
14407
14408 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014410 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014411
14412 ret_val = xmlRecoverFile(filename);
14413 desret_xmlDocPtr(ret_val);
14414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014415 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014416 xmlResetLastError();
14417 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014418 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014420 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014421 printf(" %d", n_filename);
14422 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014423 }
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 Veillardd93f6252004-11-02 15:53:51 +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_xmlRecoverMemory(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;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014441 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014442 int n_buffer;
14443 int size; /* the size of the array */
14444 int n_size;
14445
14446 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14447 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014449 buffer = gen_const_char_ptr(n_buffer, 0);
14450 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014451
William M. Brackf13f77f2004-11-12 16:03:48 +000014452 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014453 desret_xmlDocPtr(ret_val);
14454 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014455 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014456 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014457 xmlResetLastError();
14458 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014459 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014461 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014462 printf(" %d", n_buffer);
14463 printf(" %d", n_size);
14464 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014465 }
14466 }
14467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014468 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014469#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014470#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014471
Daniel Veillard42595322004-11-08 10:52:06 +000014472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014473}
14474
14475
14476static int
14477test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014479
William M. Brack21e4ef22005-01-02 09:53:13 +000014480#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014481#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014482 int mem_base;
14483 xmlDtdPtr ret_val;
14484 xmlSAXHandlerPtr sax; /* the SAX handler block */
14485 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014486 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014487 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014488 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014489 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014490
Daniel Veillard34099b42004-11-04 17:34:35 +000014491 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14492 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14493 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14494 mem_base = xmlMemBlocks();
14495 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14496 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14497 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14498
William M. Brackf13f77f2004-11-12 16:03:48 +000014499 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014500 desret_xmlDtdPtr(ret_val);
14501 call_tests++;
14502 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014503 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14504 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014505 xmlResetLastError();
14506 if (mem_base != xmlMemBlocks()) {
14507 printf("Leak of %d blocks found in xmlSAXParseDTD",
14508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014509 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014510 printf(" %d", n_sax);
14511 printf(" %d", n_ExternalID);
14512 printf(" %d", n_SystemID);
14513 printf("\n");
14514 }
14515 }
14516 }
14517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014518 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014519#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014520#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014521
Daniel Veillard42595322004-11-08 10:52:06 +000014522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014523}
14524
14525
14526static int
14527test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014529
William M. Brack21e4ef22005-01-02 09:53:13 +000014530#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014531#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014532 int mem_base;
14533 xmlDocPtr ret_val;
14534 xmlSAXHandlerPtr sax; /* the SAX handler block */
14535 int n_sax;
14536 xmlChar * cur; /* a pointer to an array of xmlChar */
14537 int n_cur;
14538 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14539 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014540
Daniel Veillard34099b42004-11-04 17:34:35 +000014541 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14542 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14543 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14544 mem_base = xmlMemBlocks();
14545 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14546 cur = gen_xmlChar_ptr(n_cur, 1);
14547 recovery = gen_int(n_recovery, 2);
14548
14549 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14550 desret_xmlDocPtr(ret_val);
14551 call_tests++;
14552 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14553 des_xmlChar_ptr(n_cur, cur, 1);
14554 des_int(n_recovery, recovery, 2);
14555 xmlResetLastError();
14556 if (mem_base != xmlMemBlocks()) {
14557 printf("Leak of %d blocks found in xmlSAXParseDoc",
14558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014559 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014560 printf(" %d", n_sax);
14561 printf(" %d", n_cur);
14562 printf(" %d", n_recovery);
14563 printf("\n");
14564 }
14565 }
14566 }
14567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014568 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014569#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014570#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014571
Daniel Veillard42595322004-11-08 10:52:06 +000014572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573}
14574
14575
14576static int
14577test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014579
William M. Brack21e4ef22005-01-02 09:53:13 +000014580#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014581#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014582 int mem_base;
14583 xmlDocPtr ret_val;
14584 xmlSAXHandlerPtr sax; /* the SAX handler block */
14585 int n_sax;
14586 const char * filename; /* the filename */
14587 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588
Daniel Veillard34099b42004-11-04 17:34:35 +000014589 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14590 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14591 mem_base = xmlMemBlocks();
14592 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14593 filename = gen_filepath(n_filename, 1);
14594
14595 ret_val = xmlSAXParseEntity(sax, filename);
14596 desret_xmlDocPtr(ret_val);
14597 call_tests++;
14598 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14599 des_filepath(n_filename, filename, 1);
14600 xmlResetLastError();
14601 if (mem_base != xmlMemBlocks()) {
14602 printf("Leak of %d blocks found in xmlSAXParseEntity",
14603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014604 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014605 printf(" %d", n_sax);
14606 printf(" %d", n_filename);
14607 printf("\n");
14608 }
14609 }
14610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014611 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014612#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014613#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014614
Daniel Veillard42595322004-11-08 10:52:06 +000014615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014616}
14617
14618
14619static int
14620test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014622
William M. Brack21e4ef22005-01-02 09:53:13 +000014623#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014624#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014625 int mem_base;
14626 xmlDocPtr ret_val;
14627 xmlSAXHandlerPtr sax; /* the SAX handler block */
14628 int n_sax;
14629 const char * filename; /* the filename */
14630 int n_filename;
14631 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14632 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014633
Daniel Veillard34099b42004-11-04 17:34:35 +000014634 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14635 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14636 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14637 mem_base = xmlMemBlocks();
14638 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14639 filename = gen_filepath(n_filename, 1);
14640 recovery = gen_int(n_recovery, 2);
14641
14642 ret_val = xmlSAXParseFile(sax, filename, recovery);
14643 desret_xmlDocPtr(ret_val);
14644 call_tests++;
14645 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14646 des_filepath(n_filename, filename, 1);
14647 des_int(n_recovery, recovery, 2);
14648 xmlResetLastError();
14649 if (mem_base != xmlMemBlocks()) {
14650 printf("Leak of %d blocks found in xmlSAXParseFile",
14651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014652 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014653 printf(" %d", n_sax);
14654 printf(" %d", n_filename);
14655 printf(" %d", n_recovery);
14656 printf("\n");
14657 }
14658 }
14659 }
14660 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014661 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014662#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014663#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014664
Daniel Veillard42595322004-11-08 10:52:06 +000014665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014666}
14667
14668
14669static int
14670test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014672
William M. Brack21e4ef22005-01-02 09:53:13 +000014673#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014674#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014675 int mem_base;
14676 xmlDocPtr ret_val;
14677 xmlSAXHandlerPtr sax; /* the SAX handler block */
14678 int n_sax;
14679 const char * filename; /* the filename */
14680 int n_filename;
14681 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14682 int n_recovery;
14683 void * data; /* the userdata */
14684 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014685
Daniel Veillard34099b42004-11-04 17:34:35 +000014686 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14687 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14688 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14689 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14690 mem_base = xmlMemBlocks();
14691 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14692 filename = gen_filepath(n_filename, 1);
14693 recovery = gen_int(n_recovery, 2);
14694 data = gen_userdata(n_data, 3);
14695
14696 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14697 desret_xmlDocPtr(ret_val);
14698 call_tests++;
14699 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14700 des_filepath(n_filename, filename, 1);
14701 des_int(n_recovery, recovery, 2);
14702 des_userdata(n_data, data, 3);
14703 xmlResetLastError();
14704 if (mem_base != xmlMemBlocks()) {
14705 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014707 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014708 printf(" %d", n_sax);
14709 printf(" %d", n_filename);
14710 printf(" %d", n_recovery);
14711 printf(" %d", n_data);
14712 printf("\n");
14713 }
14714 }
14715 }
14716 }
14717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014718 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014719#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014720#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014721
Daniel Veillard42595322004-11-08 10:52:06 +000014722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014723}
14724
14725
14726static int
14727test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014729
William M. Brack21e4ef22005-01-02 09:53:13 +000014730#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014731#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014732 int mem_base;
14733 xmlDocPtr ret_val;
14734 xmlSAXHandlerPtr sax; /* the SAX handler block */
14735 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014736 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014737 int n_buffer;
14738 int size; /* the size of the array */
14739 int n_size;
14740 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14741 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014742
Daniel Veillard34099b42004-11-04 17:34:35 +000014743 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14744 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14745 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14746 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14747 mem_base = xmlMemBlocks();
14748 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14749 buffer = gen_const_char_ptr(n_buffer, 1);
14750 size = gen_int(n_size, 2);
14751 recovery = gen_int(n_recovery, 3);
14752
William M. Brackf13f77f2004-11-12 16:03:48 +000014753 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014754 desret_xmlDocPtr(ret_val);
14755 call_tests++;
14756 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014757 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014758 des_int(n_size, size, 2);
14759 des_int(n_recovery, recovery, 3);
14760 xmlResetLastError();
14761 if (mem_base != xmlMemBlocks()) {
14762 printf("Leak of %d blocks found in xmlSAXParseMemory",
14763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014764 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014765 printf(" %d", n_sax);
14766 printf(" %d", n_buffer);
14767 printf(" %d", n_size);
14768 printf(" %d", n_recovery);
14769 printf("\n");
14770 }
14771 }
14772 }
14773 }
14774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014775 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014776#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014777#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014778
Daniel Veillard42595322004-11-08 10:52:06 +000014779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014780}
14781
14782
14783static int
14784test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014786
William M. Brack21e4ef22005-01-02 09:53:13 +000014787#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014788#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014789 int mem_base;
14790 xmlDocPtr ret_val;
14791 xmlSAXHandlerPtr sax; /* the SAX handler block */
14792 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014793 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014794 int n_buffer;
14795 int size; /* the size of the array */
14796 int n_size;
14797 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14798 int n_recovery;
14799 void * data; /* the userdata */
14800 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801
Daniel Veillard34099b42004-11-04 17:34:35 +000014802 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14803 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14804 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14805 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14806 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14807 mem_base = xmlMemBlocks();
14808 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14809 buffer = gen_const_char_ptr(n_buffer, 1);
14810 size = gen_int(n_size, 2);
14811 recovery = gen_int(n_recovery, 3);
14812 data = gen_userdata(n_data, 4);
14813
William M. Brackf13f77f2004-11-12 16:03:48 +000014814 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014815 desret_xmlDocPtr(ret_val);
14816 call_tests++;
14817 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014818 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014819 des_int(n_size, size, 2);
14820 des_int(n_recovery, recovery, 3);
14821 des_userdata(n_data, data, 4);
14822 xmlResetLastError();
14823 if (mem_base != xmlMemBlocks()) {
14824 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014826 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014827 printf(" %d", n_sax);
14828 printf(" %d", n_buffer);
14829 printf(" %d", n_size);
14830 printf(" %d", n_recovery);
14831 printf(" %d", n_data);
14832 printf("\n");
14833 }
14834 }
14835 }
14836 }
14837 }
14838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014839 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014840#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014841#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014842
Daniel Veillard42595322004-11-08 10:52:06 +000014843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014844}
14845
14846
14847static int
14848test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014850
William M. Brack21e4ef22005-01-02 09:53:13 +000014851#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014852#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014853 int mem_base;
14854 int ret_val;
14855 xmlSAXHandlerPtr sax; /* a SAX handler */
14856 int n_sax;
14857 void * user_data; /* The user data returned on SAX callbacks */
14858 int n_user_data;
14859 const char * filename; /* a file name */
14860 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014861
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14863 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14864 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14865 mem_base = xmlMemBlocks();
14866 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14867 user_data = gen_userdata(n_user_data, 1);
14868 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014869
14870#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014871 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014872#endif
14873
Daniel Veillard34099b42004-11-04 17:34:35 +000014874
14875 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14876 desret_int(ret_val);
14877 call_tests++;
14878 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14879 des_userdata(n_user_data, user_data, 1);
14880 des_filepath(n_filename, filename, 2);
14881 xmlResetLastError();
14882 if (mem_base != xmlMemBlocks()) {
14883 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014885 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014886 printf(" %d", n_sax);
14887 printf(" %d", n_user_data);
14888 printf(" %d", n_filename);
14889 printf("\n");
14890 }
14891 }
14892 }
14893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014894 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014895#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014896#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014897
Daniel Veillard42595322004-11-08 10:52:06 +000014898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014899}
14900
14901
14902static int
14903test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014905
William M. Brack21e4ef22005-01-02 09:53:13 +000014906#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014907#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014908 int mem_base;
14909 int ret_val;
14910 xmlSAXHandlerPtr sax; /* a SAX handler */
14911 int n_sax;
14912 void * user_data; /* The user data returned on SAX callbacks */
14913 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014914 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014915 int n_buffer;
14916 int size; /* the length of the XML document in bytes */
14917 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014918
Daniel Veillard34099b42004-11-04 17:34:35 +000014919 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14920 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14921 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14922 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14923 mem_base = xmlMemBlocks();
14924 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14925 user_data = gen_userdata(n_user_data, 1);
14926 buffer = gen_const_char_ptr(n_buffer, 2);
14927 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014928
14929#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014930 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014931#endif
14932
Daniel Veillard34099b42004-11-04 17:34:35 +000014933
William M. Brackf13f77f2004-11-12 16:03:48 +000014934 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014935 desret_int(ret_val);
14936 call_tests++;
14937 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14938 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014939 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014940 des_int(n_size, size, 3);
14941 xmlResetLastError();
14942 if (mem_base != xmlMemBlocks()) {
14943 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014945 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014946 printf(" %d", n_sax);
14947 printf(" %d", n_user_data);
14948 printf(" %d", n_buffer);
14949 printf(" %d", n_size);
14950 printf("\n");
14951 }
14952 }
14953 }
14954 }
14955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014956 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014957#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014958#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014959
Daniel Veillard42595322004-11-08 10:52:06 +000014960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014961}
14962
14963
14964static int
14965test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014967
14968
14969 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014971}
14972
14973
14974static int
14975test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014977
William M. Brack21e4ef22005-01-02 09:53:13 +000014978#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014979#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014980 int mem_base;
14981 int ret_val;
14982 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
14983 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014984 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014985 int n_name;
14986 void * value; /* pointer to the location of the new value */
14987 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014988
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014989 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14990 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
14991 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
14992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014993 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14994 name = gen_const_char_ptr(n_name, 1);
14995 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014996
William M. Brackf13f77f2004-11-12 16:03:48 +000014997 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014998 desret_int(ret_val);
14999 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015000 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015001 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015002 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015003 xmlResetLastError();
15004 if (mem_base != xmlMemBlocks()) {
15005 printf("Leak of %d blocks found in xmlSetFeature",
15006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015007 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015008 printf(" %d", n_ctxt);
15009 printf(" %d", n_name);
15010 printf(" %d", n_value);
15011 printf("\n");
15012 }
15013 }
15014 }
15015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015016 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015017#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015018#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015019
Daniel Veillard42595322004-11-08 10:52:06 +000015020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015021}
15022
15023
15024static int
15025test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015027
William M. Brack21e4ef22005-01-02 09:53:13 +000015028#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015029#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015030 int mem_base;
15031 xmlParserCtxtPtr ctxt; /* an XML parser context */
15032 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015033 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015034 int n_buffer;
15035 const char * filename; /* a file name */
15036 int n_filename;
15037
15038 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15039 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15040 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015042 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15043 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15044 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045
William M. Brackf13f77f2004-11-12 16:03:48 +000015046 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015048 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015049 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015050 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015051 xmlResetLastError();
15052 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015053 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015055 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015056 printf(" %d", n_ctxt);
15057 printf(" %d", n_buffer);
15058 printf(" %d", n_filename);
15059 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015060 }
15061 }
15062 }
15063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015064 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015065#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015066#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015067
Daniel Veillard42595322004-11-08 10:52:06 +000015068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069}
15070
15071
15072static int
15073test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015075
William M. Brack21e4ef22005-01-02 09:53:13 +000015076#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015077#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015078 int mem_base;
15079 xmlParserCtxtPtr ctxt; /* an XML parser context */
15080 int n_ctxt;
15081
15082 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015084 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015085
15086 xmlStopParser(ctxt);
15087 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015088 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015089 xmlResetLastError();
15090 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015091 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015093 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015094 printf(" %d", n_ctxt);
15095 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015096 }
15097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015098 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015099#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015100#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015101
Daniel Veillard42595322004-11-08 10:52:06 +000015102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015103}
15104
15105
15106static int
15107test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015109
15110 int mem_base;
15111 int ret_val;
15112 int val; /* int 0 or 1 */
15113 int n_val;
15114
15115 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015117 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118
15119 ret_val = xmlSubstituteEntitiesDefault(val);
15120 desret_int(ret_val);
15121 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015122 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015123 xmlResetLastError();
15124 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015125 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015127 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015128 printf(" %d", n_val);
15129 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015130 }
15131 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015132 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015133
Daniel Veillard42595322004-11-08 10:52:06 +000015134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015135}
15136
15137static int
15138test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015140
William M. Brack094dd862004-11-14 14:28:34 +000015141 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret += test_xmlByteConsumed();
15143 test_ret += test_xmlClearNodeInfoSeq();
15144 test_ret += test_xmlClearParserCtxt();
15145 test_ret += test_xmlCreateDocParserCtxt();
15146 test_ret += test_xmlCreatePushParserCtxt();
15147 test_ret += test_xmlCtxtReadDoc();
15148 test_ret += test_xmlCtxtReadFile();
15149 test_ret += test_xmlCtxtReadMemory();
15150 test_ret += test_xmlCtxtReset();
15151 test_ret += test_xmlCtxtResetPush();
15152 test_ret += test_xmlCtxtUseOptions();
15153 test_ret += test_xmlGetExternalEntityLoader();
15154 test_ret += test_xmlGetFeature();
15155 test_ret += test_xmlGetFeaturesList();
15156 test_ret += test_xmlIOParseDTD();
15157 test_ret += test_xmlInitNodeInfoSeq();
15158 test_ret += test_xmlInitParser();
15159 test_ret += test_xmlInitParserCtxt();
15160 test_ret += test_xmlKeepBlanksDefault();
15161 test_ret += test_xmlLineNumbersDefault();
15162 test_ret += test_xmlLoadExternalEntity();
15163 test_ret += test_xmlNewIOInputStream();
15164 test_ret += test_xmlNewParserCtxt();
15165 test_ret += test_xmlParseBalancedChunkMemory();
15166 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15167 test_ret += test_xmlParseChunk();
15168 test_ret += test_xmlParseCtxtExternalEntity();
15169 test_ret += test_xmlParseDTD();
15170 test_ret += test_xmlParseDoc();
15171 test_ret += test_xmlParseDocument();
15172 test_ret += test_xmlParseEntity();
15173 test_ret += test_xmlParseExtParsedEnt();
15174 test_ret += test_xmlParseExternalEntity();
15175 test_ret += test_xmlParseFile();
15176 test_ret += test_xmlParseInNodeContext();
15177 test_ret += test_xmlParseMemory();
15178 test_ret += test_xmlParserAddNodeInfo();
15179 test_ret += test_xmlParserFindNodeInfo();
15180 test_ret += test_xmlParserFindNodeInfoIndex();
15181 test_ret += test_xmlParserInputGrow();
15182 test_ret += test_xmlParserInputRead();
15183 test_ret += test_xmlPedanticParserDefault();
15184 test_ret += test_xmlReadDoc();
15185 test_ret += test_xmlReadFile();
15186 test_ret += test_xmlReadMemory();
15187 test_ret += test_xmlRecoverDoc();
15188 test_ret += test_xmlRecoverFile();
15189 test_ret += test_xmlRecoverMemory();
15190 test_ret += test_xmlSAXParseDTD();
15191 test_ret += test_xmlSAXParseDoc();
15192 test_ret += test_xmlSAXParseEntity();
15193 test_ret += test_xmlSAXParseFile();
15194 test_ret += test_xmlSAXParseFileWithData();
15195 test_ret += test_xmlSAXParseMemory();
15196 test_ret += test_xmlSAXParseMemoryWithData();
15197 test_ret += test_xmlSAXUserParseFile();
15198 test_ret += test_xmlSAXUserParseMemory();
15199 test_ret += test_xmlSetExternalEntityLoader();
15200 test_ret += test_xmlSetFeature();
15201 test_ret += test_xmlSetupParserForBuffer();
15202 test_ret += test_xmlStopParser();
15203 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015204
Daniel Veillard42595322004-11-08 10:52:06 +000015205 if (test_ret != 0)
15206 printf("Module parser: %d errors\n", test_ret);
15207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015208}
15209
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015210static int
15211test_htmlCreateFileParserCtxt(void) {
15212 int test_ret = 0;
15213
William M. Brack21e4ef22005-01-02 09:53:13 +000015214#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015215 int mem_base;
15216 htmlParserCtxtPtr ret_val;
15217 const char * filename; /* the filename */
15218 int n_filename;
15219 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15220 int n_encoding;
15221
15222 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15223 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15224 mem_base = xmlMemBlocks();
15225 filename = gen_fileoutput(n_filename, 0);
15226 encoding = gen_const_char_ptr(n_encoding, 1);
15227
William M. Brackf13f77f2004-11-12 16:03:48 +000015228 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015229 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015230 call_tests++;
15231 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015232 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015233 xmlResetLastError();
15234 if (mem_base != xmlMemBlocks()) {
15235 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15236 xmlMemBlocks() - mem_base);
15237 test_ret++;
15238 printf(" %d", n_filename);
15239 printf(" %d", n_encoding);
15240 printf("\n");
15241 }
15242 }
15243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015244 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015245#endif
15246
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015247 return(test_ret);
15248}
15249
15250
15251static int
15252test_htmlInitAutoClose(void) {
15253 int test_ret = 0;
15254
William M. Brack21e4ef22005-01-02 09:53:13 +000015255#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015256 int mem_base;
15257
15258 mem_base = xmlMemBlocks();
15259
15260 htmlInitAutoClose();
15261 call_tests++;
15262 xmlResetLastError();
15263 if (mem_base != xmlMemBlocks()) {
15264 printf("Leak of %d blocks found in htmlInitAutoClose",
15265 xmlMemBlocks() - mem_base);
15266 test_ret++;
15267 printf("\n");
15268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015269 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015270#endif
15271
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015272 return(test_ret);
15273}
15274
15275
15276static int
15277test_inputPop(void) {
15278 int test_ret = 0;
15279
15280 int mem_base;
15281 xmlParserInputPtr ret_val;
15282 xmlParserCtxtPtr ctxt; /* an XML parser context */
15283 int n_ctxt;
15284
15285 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15286 mem_base = xmlMemBlocks();
15287 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15288
15289 ret_val = inputPop(ctxt);
15290 desret_xmlParserInputPtr(ret_val);
15291 call_tests++;
15292 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15293 xmlResetLastError();
15294 if (mem_base != xmlMemBlocks()) {
15295 printf("Leak of %d blocks found in inputPop",
15296 xmlMemBlocks() - mem_base);
15297 test_ret++;
15298 printf(" %d", n_ctxt);
15299 printf("\n");
15300 }
15301 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015302 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015303
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015304 return(test_ret);
15305}
15306
15307
15308static int
15309test_inputPush(void) {
15310 int test_ret = 0;
15311
15312 int mem_base;
15313 int ret_val;
15314 xmlParserCtxtPtr ctxt; /* an XML parser context */
15315 int n_ctxt;
15316 xmlParserInputPtr value; /* the parser input */
15317 int n_value;
15318
15319 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15320 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15321 mem_base = xmlMemBlocks();
15322 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15323 value = gen_xmlParserInputPtr(n_value, 1);
15324
15325 ret_val = inputPush(ctxt, value);
15326 desret_int(ret_val);
15327 call_tests++;
15328 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15329 des_xmlParserInputPtr(n_value, value, 1);
15330 xmlResetLastError();
15331 if (mem_base != xmlMemBlocks()) {
15332 printf("Leak of %d blocks found in inputPush",
15333 xmlMemBlocks() - mem_base);
15334 test_ret++;
15335 printf(" %d", n_ctxt);
15336 printf(" %d", n_value);
15337 printf("\n");
15338 }
15339 }
15340 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015341 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015342
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015343 return(test_ret);
15344}
15345
15346
15347static int
15348test_namePop(void) {
15349 int test_ret = 0;
15350
15351 int mem_base;
15352 const xmlChar * ret_val;
15353 xmlParserCtxtPtr ctxt; /* an XML parser context */
15354 int n_ctxt;
15355
15356 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15357 mem_base = xmlMemBlocks();
15358 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15359
15360 ret_val = namePop(ctxt);
15361 desret_const_xmlChar_ptr(ret_val);
15362 call_tests++;
15363 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15364 xmlResetLastError();
15365 if (mem_base != xmlMemBlocks()) {
15366 printf("Leak of %d blocks found in namePop",
15367 xmlMemBlocks() - mem_base);
15368 test_ret++;
15369 printf(" %d", n_ctxt);
15370 printf("\n");
15371 }
15372 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015374
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015375 return(test_ret);
15376}
15377
15378
15379static int
15380test_namePush(void) {
15381 int test_ret = 0;
15382
15383 int mem_base;
15384 int ret_val;
15385 xmlParserCtxtPtr ctxt; /* an XML parser context */
15386 int n_ctxt;
15387 xmlChar * value; /* the element name */
15388 int n_value;
15389
15390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15391 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15392 mem_base = xmlMemBlocks();
15393 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15394 value = gen_const_xmlChar_ptr(n_value, 1);
15395
William M. Brackf13f77f2004-11-12 16:03:48 +000015396 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015397 desret_int(ret_val);
15398 call_tests++;
15399 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015400 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015401 xmlResetLastError();
15402 if (mem_base != xmlMemBlocks()) {
15403 printf("Leak of %d blocks found in namePush",
15404 xmlMemBlocks() - mem_base);
15405 test_ret++;
15406 printf(" %d", n_ctxt);
15407 printf(" %d", n_value);
15408 printf("\n");
15409 }
15410 }
15411 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015413
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015414 return(test_ret);
15415}
15416
15417
15418static int
15419test_nodePop(void) {
15420 int test_ret = 0;
15421
15422 int mem_base;
15423 xmlNodePtr ret_val;
15424 xmlParserCtxtPtr ctxt; /* an XML parser context */
15425 int n_ctxt;
15426
15427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15428 mem_base = xmlMemBlocks();
15429 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15430
15431 ret_val = nodePop(ctxt);
15432 desret_xmlNodePtr(ret_val);
15433 call_tests++;
15434 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15435 xmlResetLastError();
15436 if (mem_base != xmlMemBlocks()) {
15437 printf("Leak of %d blocks found in nodePop",
15438 xmlMemBlocks() - mem_base);
15439 test_ret++;
15440 printf(" %d", n_ctxt);
15441 printf("\n");
15442 }
15443 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015444 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015445
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015446 return(test_ret);
15447}
15448
15449
15450static int
15451test_nodePush(void) {
15452 int test_ret = 0;
15453
15454 int mem_base;
15455 int ret_val;
15456 xmlParserCtxtPtr ctxt; /* an XML parser context */
15457 int n_ctxt;
15458 xmlNodePtr value; /* the element node */
15459 int n_value;
15460
15461 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15462 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15463 mem_base = xmlMemBlocks();
15464 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15465 value = gen_xmlNodePtr(n_value, 1);
15466
15467 ret_val = nodePush(ctxt, value);
15468 desret_int(ret_val);
15469 call_tests++;
15470 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15471 des_xmlNodePtr(n_value, value, 1);
15472 xmlResetLastError();
15473 if (mem_base != xmlMemBlocks()) {
15474 printf("Leak of %d blocks found in nodePush",
15475 xmlMemBlocks() - mem_base);
15476 test_ret++;
15477 printf(" %d", n_ctxt);
15478 printf(" %d", n_value);
15479 printf("\n");
15480 }
15481 }
15482 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015484
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015485 return(test_ret);
15486}
15487
15488
15489static int
15490test_xmlCheckLanguageID(void) {
15491 int test_ret = 0;
15492
15493 int mem_base;
15494 int ret_val;
15495 xmlChar * lang; /* pointer to the string value */
15496 int n_lang;
15497
15498 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15499 mem_base = xmlMemBlocks();
15500 lang = gen_const_xmlChar_ptr(n_lang, 0);
15501
William M. Brackf13f77f2004-11-12 16:03:48 +000015502 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015503 desret_int(ret_val);
15504 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015505 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015506 xmlResetLastError();
15507 if (mem_base != xmlMemBlocks()) {
15508 printf("Leak of %d blocks found in xmlCheckLanguageID",
15509 xmlMemBlocks() - mem_base);
15510 test_ret++;
15511 printf(" %d", n_lang);
15512 printf("\n");
15513 }
15514 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015516
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015517 return(test_ret);
15518}
15519
15520
15521static int
15522test_xmlCopyChar(void) {
15523 int test_ret = 0;
15524
15525 int mem_base;
15526 int ret_val;
15527 int len; /* Ignored, compatibility */
15528 int n_len;
15529 xmlChar * out; /* pointer to an array of xmlChar */
15530 int n_out;
15531 int val; /* the char value */
15532 int n_val;
15533
15534 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15535 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15536 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15537 mem_base = xmlMemBlocks();
15538 len = gen_int(n_len, 0);
15539 out = gen_xmlChar_ptr(n_out, 1);
15540 val = gen_int(n_val, 2);
15541
15542 ret_val = xmlCopyChar(len, out, val);
15543 desret_int(ret_val);
15544 call_tests++;
15545 des_int(n_len, len, 0);
15546 des_xmlChar_ptr(n_out, out, 1);
15547 des_int(n_val, val, 2);
15548 xmlResetLastError();
15549 if (mem_base != xmlMemBlocks()) {
15550 printf("Leak of %d blocks found in xmlCopyChar",
15551 xmlMemBlocks() - mem_base);
15552 test_ret++;
15553 printf(" %d", n_len);
15554 printf(" %d", n_out);
15555 printf(" %d", n_val);
15556 printf("\n");
15557 }
15558 }
15559 }
15560 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015562
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015563 return(test_ret);
15564}
15565
15566
15567static int
15568test_xmlCopyCharMultiByte(void) {
15569 int test_ret = 0;
15570
15571 int mem_base;
15572 int ret_val;
15573 xmlChar * out; /* pointer to an array of xmlChar */
15574 int n_out;
15575 int val; /* the char value */
15576 int n_val;
15577
15578 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15579 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15580 mem_base = xmlMemBlocks();
15581 out = gen_xmlChar_ptr(n_out, 0);
15582 val = gen_int(n_val, 1);
15583
15584 ret_val = xmlCopyCharMultiByte(out, val);
15585 desret_int(ret_val);
15586 call_tests++;
15587 des_xmlChar_ptr(n_out, out, 0);
15588 des_int(n_val, val, 1);
15589 xmlResetLastError();
15590 if (mem_base != xmlMemBlocks()) {
15591 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15592 xmlMemBlocks() - mem_base);
15593 test_ret++;
15594 printf(" %d", n_out);
15595 printf(" %d", n_val);
15596 printf("\n");
15597 }
15598 }
15599 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015601
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015602 return(test_ret);
15603}
15604
15605
15606static int
15607test_xmlCreateEntityParserCtxt(void) {
15608 int test_ret = 0;
15609
15610 int mem_base;
15611 xmlParserCtxtPtr ret_val;
15612 xmlChar * URL; /* the entity URL */
15613 int n_URL;
15614 xmlChar * ID; /* the entity PUBLIC ID */
15615 int n_ID;
15616 xmlChar * base; /* a possible base for the target URI */
15617 int n_base;
15618
15619 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15620 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15621 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15622 mem_base = xmlMemBlocks();
15623 URL = gen_const_xmlChar_ptr(n_URL, 0);
15624 ID = gen_const_xmlChar_ptr(n_ID, 1);
15625 base = gen_const_xmlChar_ptr(n_base, 2);
15626
William M. Brackf13f77f2004-11-12 16:03:48 +000015627 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015628 desret_xmlParserCtxtPtr(ret_val);
15629 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015630 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15631 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15632 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015633 xmlResetLastError();
15634 if (mem_base != xmlMemBlocks()) {
15635 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15636 xmlMemBlocks() - mem_base);
15637 test_ret++;
15638 printf(" %d", n_URL);
15639 printf(" %d", n_ID);
15640 printf(" %d", n_base);
15641 printf("\n");
15642 }
15643 }
15644 }
15645 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015647
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015648 return(test_ret);
15649}
15650
15651
15652static int
15653test_xmlCreateFileParserCtxt(void) {
15654 int test_ret = 0;
15655
15656 int mem_base;
15657 xmlParserCtxtPtr ret_val;
15658 const char * filename; /* the filename */
15659 int n_filename;
15660
15661 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15662 mem_base = xmlMemBlocks();
15663 filename = gen_fileoutput(n_filename, 0);
15664
15665 ret_val = xmlCreateFileParserCtxt(filename);
15666 desret_xmlParserCtxtPtr(ret_val);
15667 call_tests++;
15668 des_fileoutput(n_filename, filename, 0);
15669 xmlResetLastError();
15670 if (mem_base != xmlMemBlocks()) {
15671 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15672 xmlMemBlocks() - mem_base);
15673 test_ret++;
15674 printf(" %d", n_filename);
15675 printf("\n");
15676 }
15677 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015678 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015679
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015680 return(test_ret);
15681}
15682
15683
15684static int
15685test_xmlCreateMemoryParserCtxt(void) {
15686 int test_ret = 0;
15687
15688 int mem_base;
15689 xmlParserCtxtPtr ret_val;
15690 char * buffer; /* a pointer to a char array */
15691 int n_buffer;
15692 int size; /* the size of the array */
15693 int n_size;
15694
15695 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15696 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15697 mem_base = xmlMemBlocks();
15698 buffer = gen_const_char_ptr(n_buffer, 0);
15699 size = gen_int(n_size, 1);
15700
William M. Brackf13f77f2004-11-12 16:03:48 +000015701 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015702 desret_xmlParserCtxtPtr(ret_val);
15703 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015704 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015705 des_int(n_size, size, 1);
15706 xmlResetLastError();
15707 if (mem_base != xmlMemBlocks()) {
15708 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15709 xmlMemBlocks() - mem_base);
15710 test_ret++;
15711 printf(" %d", n_buffer);
15712 printf(" %d", n_size);
15713 printf("\n");
15714 }
15715 }
15716 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015718
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015719 return(test_ret);
15720}
15721
15722
15723static int
15724test_xmlCreateURLParserCtxt(void) {
15725 int test_ret = 0;
15726
15727 int mem_base;
15728 xmlParserCtxtPtr ret_val;
15729 const char * filename; /* the filename or URL */
15730 int n_filename;
15731 int options; /* a combination of xmlParserOption */
15732 int n_options;
15733
15734 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15735 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15736 mem_base = xmlMemBlocks();
15737 filename = gen_fileoutput(n_filename, 0);
15738 options = gen_int(n_options, 1);
15739
15740 ret_val = xmlCreateURLParserCtxt(filename, options);
15741 desret_xmlParserCtxtPtr(ret_val);
15742 call_tests++;
15743 des_fileoutput(n_filename, filename, 0);
15744 des_int(n_options, options, 1);
15745 xmlResetLastError();
15746 if (mem_base != xmlMemBlocks()) {
15747 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15748 xmlMemBlocks() - mem_base);
15749 test_ret++;
15750 printf(" %d", n_filename);
15751 printf(" %d", n_options);
15752 printf("\n");
15753 }
15754 }
15755 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015756 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015757
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015758 return(test_ret);
15759}
15760
15761
15762static int
15763test_xmlCurrentChar(void) {
15764 int test_ret = 0;
15765
15766 int mem_base;
15767 int ret_val;
15768 xmlParserCtxtPtr ctxt; /* the XML parser context */
15769 int n_ctxt;
15770 int * len; /* pointer to the length of the char read */
15771 int n_len;
15772
15773 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15774 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15775 mem_base = xmlMemBlocks();
15776 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15777 len = gen_int_ptr(n_len, 1);
15778
15779 ret_val = xmlCurrentChar(ctxt, len);
15780 desret_int(ret_val);
15781 call_tests++;
15782 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15783 des_int_ptr(n_len, len, 1);
15784 xmlResetLastError();
15785 if (mem_base != xmlMemBlocks()) {
15786 printf("Leak of %d blocks found in xmlCurrentChar",
15787 xmlMemBlocks() - mem_base);
15788 test_ret++;
15789 printf(" %d", n_ctxt);
15790 printf(" %d", n_len);
15791 printf("\n");
15792 }
15793 }
15794 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015796
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015797 return(test_ret);
15798}
15799
15800
15801static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015802test_xmlErrMemory(void) {
15803 int test_ret = 0;
15804
15805 int mem_base;
15806 xmlParserCtxtPtr ctxt; /* an XML parser context */
15807 int n_ctxt;
15808 char * extra; /* extra informations */
15809 int n_extra;
15810
15811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15812 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15813 mem_base = xmlMemBlocks();
15814 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15815 extra = gen_const_char_ptr(n_extra, 1);
15816
William M. Brackf13f77f2004-11-12 16:03:48 +000015817 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015818 call_tests++;
15819 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015820 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015821 xmlResetLastError();
15822 if (mem_base != xmlMemBlocks()) {
15823 printf("Leak of %d blocks found in xmlErrMemory",
15824 xmlMemBlocks() - mem_base);
15825 test_ret++;
15826 printf(" %d", n_ctxt);
15827 printf(" %d", n_extra);
15828 printf("\n");
15829 }
15830 }
15831 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015833
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015834 return(test_ret);
15835}
15836
15837
15838static int
15839test_xmlIsLetter(void) {
15840 int test_ret = 0;
15841
15842 int mem_base;
15843 int ret_val;
15844 int c; /* an unicode character (int) */
15845 int n_c;
15846
15847 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15848 mem_base = xmlMemBlocks();
15849 c = gen_int(n_c, 0);
15850
15851 ret_val = xmlIsLetter(c);
15852 desret_int(ret_val);
15853 call_tests++;
15854 des_int(n_c, c, 0);
15855 xmlResetLastError();
15856 if (mem_base != xmlMemBlocks()) {
15857 printf("Leak of %d blocks found in xmlIsLetter",
15858 xmlMemBlocks() - mem_base);
15859 test_ret++;
15860 printf(" %d", n_c);
15861 printf("\n");
15862 }
15863 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015864 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015865
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015866 return(test_ret);
15867}
15868
15869
15870static int
15871test_xmlNewEntityInputStream(void) {
15872 int test_ret = 0;
15873
15874 int mem_base;
15875 xmlParserInputPtr ret_val;
15876 xmlParserCtxtPtr ctxt; /* an XML parser context */
15877 int n_ctxt;
15878 xmlEntityPtr entity; /* an Entity pointer */
15879 int n_entity;
15880
15881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15882 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15883 mem_base = xmlMemBlocks();
15884 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15885 entity = gen_xmlEntityPtr(n_entity, 1);
15886
15887 ret_val = xmlNewEntityInputStream(ctxt, entity);
15888 desret_xmlParserInputPtr(ret_val);
15889 call_tests++;
15890 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15891 des_xmlEntityPtr(n_entity, entity, 1);
15892 xmlResetLastError();
15893 if (mem_base != xmlMemBlocks()) {
15894 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15895 xmlMemBlocks() - mem_base);
15896 test_ret++;
15897 printf(" %d", n_ctxt);
15898 printf(" %d", n_entity);
15899 printf("\n");
15900 }
15901 }
15902 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015903 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015904
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015905 return(test_ret);
15906}
15907
15908
15909static int
15910test_xmlNewInputFromFile(void) {
15911 int test_ret = 0;
15912
15913 int mem_base;
15914 xmlParserInputPtr ret_val;
15915 xmlParserCtxtPtr ctxt; /* an XML parser context */
15916 int n_ctxt;
15917 const char * filename; /* the filename to use as entity */
15918 int n_filename;
15919
15920 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15921 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15922 mem_base = xmlMemBlocks();
15923 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15924 filename = gen_filepath(n_filename, 1);
15925
15926 ret_val = xmlNewInputFromFile(ctxt, filename);
15927 desret_xmlParserInputPtr(ret_val);
15928 call_tests++;
15929 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15930 des_filepath(n_filename, filename, 1);
15931 xmlResetLastError();
15932 if (mem_base != xmlMemBlocks()) {
15933 printf("Leak of %d blocks found in xmlNewInputFromFile",
15934 xmlMemBlocks() - mem_base);
15935 test_ret++;
15936 printf(" %d", n_ctxt);
15937 printf(" %d", n_filename);
15938 printf("\n");
15939 }
15940 }
15941 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015942 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015943
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015944 return(test_ret);
15945}
15946
15947
15948static int
15949test_xmlNewInputStream(void) {
15950 int test_ret = 0;
15951
15952 int mem_base;
15953 xmlParserInputPtr ret_val;
15954 xmlParserCtxtPtr ctxt; /* an XML parser context */
15955 int n_ctxt;
15956
15957 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15958 mem_base = xmlMemBlocks();
15959 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15960
15961 ret_val = xmlNewInputStream(ctxt);
15962 desret_xmlParserInputPtr(ret_val);
15963 call_tests++;
15964 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15965 xmlResetLastError();
15966 if (mem_base != xmlMemBlocks()) {
15967 printf("Leak of %d blocks found in xmlNewInputStream",
15968 xmlMemBlocks() - mem_base);
15969 test_ret++;
15970 printf(" %d", n_ctxt);
15971 printf("\n");
15972 }
15973 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015975
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015976 return(test_ret);
15977}
15978
15979
15980static int
15981test_xmlNewStringInputStream(void) {
15982 int test_ret = 0;
15983
15984 int mem_base;
15985 xmlParserInputPtr ret_val;
15986 xmlParserCtxtPtr ctxt; /* an XML parser context */
15987 int n_ctxt;
15988 xmlChar * buffer; /* an memory buffer */
15989 int n_buffer;
15990
15991 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15992 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15993 mem_base = xmlMemBlocks();
15994 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15995 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15996
William M. Brackf13f77f2004-11-12 16:03:48 +000015997 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015998 desret_xmlParserInputPtr(ret_val);
15999 call_tests++;
16000 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016001 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016002 xmlResetLastError();
16003 if (mem_base != xmlMemBlocks()) {
16004 printf("Leak of %d blocks found in xmlNewStringInputStream",
16005 xmlMemBlocks() - mem_base);
16006 test_ret++;
16007 printf(" %d", n_ctxt);
16008 printf(" %d", n_buffer);
16009 printf("\n");
16010 }
16011 }
16012 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016013 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016014
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016015 return(test_ret);
16016}
16017
16018
16019static int
16020test_xmlNextChar(void) {
16021 int test_ret = 0;
16022
16023 int mem_base;
16024 xmlParserCtxtPtr ctxt; /* the XML parser context */
16025 int n_ctxt;
16026
16027 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16028 mem_base = xmlMemBlocks();
16029 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16030
16031 xmlNextChar(ctxt);
16032 call_tests++;
16033 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16034 xmlResetLastError();
16035 if (mem_base != xmlMemBlocks()) {
16036 printf("Leak of %d blocks found in xmlNextChar",
16037 xmlMemBlocks() - mem_base);
16038 test_ret++;
16039 printf(" %d", n_ctxt);
16040 printf("\n");
16041 }
16042 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016044
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016045 return(test_ret);
16046}
16047
16048
16049static int
16050test_xmlParserInputShrink(void) {
16051 int test_ret = 0;
16052
16053 int mem_base;
16054 xmlParserInputPtr in; /* an XML parser input */
16055 int n_in;
16056
16057 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16058 mem_base = xmlMemBlocks();
16059 in = gen_xmlParserInputPtr(n_in, 0);
16060
16061 xmlParserInputShrink(in);
16062 call_tests++;
16063 des_xmlParserInputPtr(n_in, in, 0);
16064 xmlResetLastError();
16065 if (mem_base != xmlMemBlocks()) {
16066 printf("Leak of %d blocks found in xmlParserInputShrink",
16067 xmlMemBlocks() - mem_base);
16068 test_ret++;
16069 printf(" %d", n_in);
16070 printf("\n");
16071 }
16072 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016074
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016075 return(test_ret);
16076}
16077
16078
16079static int
16080test_xmlPopInput(void) {
16081 int test_ret = 0;
16082
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016083 int mem_base;
16084 xmlChar ret_val;
16085 xmlParserCtxtPtr ctxt; /* an XML parser context */
16086 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016087
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016088 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16089 mem_base = xmlMemBlocks();
16090 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16091
16092 ret_val = xmlPopInput(ctxt);
16093 desret_xmlChar(ret_val);
16094 call_tests++;
16095 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16096 xmlResetLastError();
16097 if (mem_base != xmlMemBlocks()) {
16098 printf("Leak of %d blocks found in xmlPopInput",
16099 xmlMemBlocks() - mem_base);
16100 test_ret++;
16101 printf(" %d", n_ctxt);
16102 printf("\n");
16103 }
16104 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016106
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016107 return(test_ret);
16108}
16109
16110
16111static int
16112test_xmlPushInput(void) {
16113 int test_ret = 0;
16114
16115 int mem_base;
16116 xmlParserCtxtPtr ctxt; /* an XML parser context */
16117 int n_ctxt;
16118 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16119 int n_input;
16120
16121 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16122 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16123 mem_base = xmlMemBlocks();
16124 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16125 input = gen_xmlParserInputPtr(n_input, 1);
16126
16127 xmlPushInput(ctxt, input);
16128 call_tests++;
16129 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16130 des_xmlParserInputPtr(n_input, input, 1);
16131 xmlResetLastError();
16132 if (mem_base != xmlMemBlocks()) {
16133 printf("Leak of %d blocks found in xmlPushInput",
16134 xmlMemBlocks() - mem_base);
16135 test_ret++;
16136 printf(" %d", n_ctxt);
16137 printf(" %d", n_input);
16138 printf("\n");
16139 }
16140 }
16141 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016143
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016144 return(test_ret);
16145}
16146
16147
16148static int
16149test_xmlSetEntityReferenceFunc(void) {
16150 int test_ret = 0;
16151
16152
16153 /* missing type support */
16154 return(test_ret);
16155}
16156
16157
16158static int
16159test_xmlSplitQName(void) {
16160 int test_ret = 0;
16161
16162 int mem_base;
16163 xmlChar * ret_val;
16164 xmlParserCtxtPtr ctxt; /* an XML parser context */
16165 int n_ctxt;
16166 xmlChar * name; /* an XML parser context */
16167 int n_name;
16168 xmlChar ** prefix; /* a xmlChar ** */
16169 int n_prefix;
16170
16171 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16172 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16173 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16174 mem_base = xmlMemBlocks();
16175 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16176 name = gen_const_xmlChar_ptr(n_name, 1);
16177 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16178
William M. Brackf13f77f2004-11-12 16:03:48 +000016179 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016180 desret_xmlChar_ptr(ret_val);
16181 call_tests++;
16182 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016183 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016184 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16185 xmlResetLastError();
16186 if (mem_base != xmlMemBlocks()) {
16187 printf("Leak of %d blocks found in xmlSplitQName",
16188 xmlMemBlocks() - mem_base);
16189 test_ret++;
16190 printf(" %d", n_ctxt);
16191 printf(" %d", n_name);
16192 printf(" %d", n_prefix);
16193 printf("\n");
16194 }
16195 }
16196 }
16197 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016198 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016199
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016200 return(test_ret);
16201}
16202
16203
16204static int
16205test_xmlStringCurrentChar(void) {
16206 int test_ret = 0;
16207
16208 int mem_base;
16209 int ret_val;
16210 xmlParserCtxtPtr ctxt; /* the XML parser context */
16211 int n_ctxt;
16212 xmlChar * cur; /* pointer to the beginning of the char */
16213 int n_cur;
16214 int * len; /* pointer to the length of the char read */
16215 int n_len;
16216
16217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16218 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16219 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16220 mem_base = xmlMemBlocks();
16221 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16222 cur = gen_const_xmlChar_ptr(n_cur, 1);
16223 len = gen_int_ptr(n_len, 2);
16224
William M. Brackf13f77f2004-11-12 16:03:48 +000016225 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016226 desret_int(ret_val);
16227 call_tests++;
16228 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016229 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016230 des_int_ptr(n_len, len, 2);
16231 xmlResetLastError();
16232 if (mem_base != xmlMemBlocks()) {
16233 printf("Leak of %d blocks found in xmlStringCurrentChar",
16234 xmlMemBlocks() - mem_base);
16235 test_ret++;
16236 printf(" %d", n_ctxt);
16237 printf(" %d", n_cur);
16238 printf(" %d", n_len);
16239 printf("\n");
16240 }
16241 }
16242 }
16243 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016244 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016245
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016246 return(test_ret);
16247}
16248
16249
16250static int
16251test_xmlStringDecodeEntities(void) {
16252 int test_ret = 0;
16253
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016254 int mem_base;
16255 xmlChar * ret_val;
16256 xmlParserCtxtPtr ctxt; /* the parser context */
16257 int n_ctxt;
16258 xmlChar * str; /* the input string */
16259 int n_str;
16260 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16261 int n_what;
16262 xmlChar end; /* an end marker xmlChar, 0 if none */
16263 int n_end;
16264 xmlChar end2; /* an end marker xmlChar, 0 if none */
16265 int n_end2;
16266 xmlChar end3; /* an end marker xmlChar, 0 if none */
16267 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016268
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016269 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16270 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16271 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16272 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16273 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16274 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16275 mem_base = xmlMemBlocks();
16276 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16277 str = gen_const_xmlChar_ptr(n_str, 1);
16278 what = gen_int(n_what, 2);
16279 end = gen_xmlChar(n_end, 3);
16280 end2 = gen_xmlChar(n_end2, 4);
16281 end3 = gen_xmlChar(n_end3, 5);
16282
William M. Brackf13f77f2004-11-12 16:03:48 +000016283 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016284 desret_xmlChar_ptr(ret_val);
16285 call_tests++;
16286 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016287 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016288 des_int(n_what, what, 2);
16289 des_xmlChar(n_end, end, 3);
16290 des_xmlChar(n_end2, end2, 4);
16291 des_xmlChar(n_end3, end3, 5);
16292 xmlResetLastError();
16293 if (mem_base != xmlMemBlocks()) {
16294 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16295 xmlMemBlocks() - mem_base);
16296 test_ret++;
16297 printf(" %d", n_ctxt);
16298 printf(" %d", n_str);
16299 printf(" %d", n_what);
16300 printf(" %d", n_end);
16301 printf(" %d", n_end2);
16302 printf(" %d", n_end3);
16303 printf("\n");
16304 }
16305 }
16306 }
16307 }
16308 }
16309 }
16310 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016311 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016312
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016313 return(test_ret);
16314}
16315
16316
16317static int
16318test_xmlStringLenDecodeEntities(void) {
16319 int test_ret = 0;
16320
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016321 int mem_base;
16322 xmlChar * ret_val;
16323 xmlParserCtxtPtr ctxt; /* the parser context */
16324 int n_ctxt;
16325 xmlChar * str; /* the input string */
16326 int n_str;
16327 int len; /* the string length */
16328 int n_len;
16329 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16330 int n_what;
16331 xmlChar end; /* an end marker xmlChar, 0 if none */
16332 int n_end;
16333 xmlChar end2; /* an end marker xmlChar, 0 if none */
16334 int n_end2;
16335 xmlChar end3; /* an end marker xmlChar, 0 if none */
16336 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016337
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16339 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16340 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16341 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16342 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16343 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16344 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16345 mem_base = xmlMemBlocks();
16346 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16347 str = gen_const_xmlChar_ptr(n_str, 1);
16348 len = gen_int(n_len, 2);
16349 what = gen_int(n_what, 3);
16350 end = gen_xmlChar(n_end, 4);
16351 end2 = gen_xmlChar(n_end2, 5);
16352 end3 = gen_xmlChar(n_end3, 6);
16353
William M. Brackf13f77f2004-11-12 16:03:48 +000016354 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016355 desret_xmlChar_ptr(ret_val);
16356 call_tests++;
16357 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016358 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016359 des_int(n_len, len, 2);
16360 des_int(n_what, what, 3);
16361 des_xmlChar(n_end, end, 4);
16362 des_xmlChar(n_end2, end2, 5);
16363 des_xmlChar(n_end3, end3, 6);
16364 xmlResetLastError();
16365 if (mem_base != xmlMemBlocks()) {
16366 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16367 xmlMemBlocks() - mem_base);
16368 test_ret++;
16369 printf(" %d", n_ctxt);
16370 printf(" %d", n_str);
16371 printf(" %d", n_len);
16372 printf(" %d", n_what);
16373 printf(" %d", n_end);
16374 printf(" %d", n_end2);
16375 printf(" %d", n_end3);
16376 printf("\n");
16377 }
16378 }
16379 }
16380 }
16381 }
16382 }
16383 }
16384 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016385 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016386
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016387 return(test_ret);
16388}
16389
16390
16391static int
16392test_xmlSwitchEncoding(void) {
16393 int test_ret = 0;
16394
16395 int mem_base;
16396 int ret_val;
16397 xmlParserCtxtPtr ctxt; /* the parser context */
16398 int n_ctxt;
16399 xmlCharEncoding enc; /* the encoding value (number) */
16400 int n_enc;
16401
16402 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16403 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16404 mem_base = xmlMemBlocks();
16405 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16406 enc = gen_xmlCharEncoding(n_enc, 1);
16407
16408 ret_val = xmlSwitchEncoding(ctxt, enc);
16409 desret_int(ret_val);
16410 call_tests++;
16411 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16412 des_xmlCharEncoding(n_enc, enc, 1);
16413 xmlResetLastError();
16414 if (mem_base != xmlMemBlocks()) {
16415 printf("Leak of %d blocks found in xmlSwitchEncoding",
16416 xmlMemBlocks() - mem_base);
16417 test_ret++;
16418 printf(" %d", n_ctxt);
16419 printf(" %d", n_enc);
16420 printf("\n");
16421 }
16422 }
16423 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016425
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016426 return(test_ret);
16427}
16428
16429
16430static int
16431test_xmlSwitchInputEncoding(void) {
16432 int test_ret = 0;
16433
16434 int mem_base;
16435 int ret_val;
16436 xmlParserCtxtPtr ctxt; /* the parser context */
16437 int n_ctxt;
16438 xmlParserInputPtr input; /* the input stream */
16439 int n_input;
16440 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16441 int n_handler;
16442
16443 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16444 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16445 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16446 mem_base = xmlMemBlocks();
16447 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16448 input = gen_xmlParserInputPtr(n_input, 1);
16449 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16450
16451 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16452 desret_int(ret_val);
16453 call_tests++;
16454 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16455 des_xmlParserInputPtr(n_input, input, 1);
16456 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16457 xmlResetLastError();
16458 if (mem_base != xmlMemBlocks()) {
16459 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16460 xmlMemBlocks() - mem_base);
16461 test_ret++;
16462 printf(" %d", n_ctxt);
16463 printf(" %d", n_input);
16464 printf(" %d", n_handler);
16465 printf("\n");
16466 }
16467 }
16468 }
16469 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016470 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016471
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016472 return(test_ret);
16473}
16474
16475
16476static int
16477test_xmlSwitchToEncoding(void) {
16478 int test_ret = 0;
16479
16480 int mem_base;
16481 int ret_val;
16482 xmlParserCtxtPtr ctxt; /* the parser context */
16483 int n_ctxt;
16484 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16485 int n_handler;
16486
16487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16488 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16489 mem_base = xmlMemBlocks();
16490 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16491 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16492
16493 ret_val = xmlSwitchToEncoding(ctxt, handler);
16494 desret_int(ret_val);
16495 call_tests++;
16496 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16497 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16498 xmlResetLastError();
16499 if (mem_base != xmlMemBlocks()) {
16500 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16501 xmlMemBlocks() - mem_base);
16502 test_ret++;
16503 printf(" %d", n_ctxt);
16504 printf(" %d", n_handler);
16505 printf("\n");
16506 }
16507 }
16508 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016509 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016510
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016511 return(test_ret);
16512}
16513
16514static int
16515test_parserInternals(void) {
16516 int test_ret = 0;
16517
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016518 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016519 test_ret += test_htmlCreateFileParserCtxt();
16520 test_ret += test_htmlInitAutoClose();
16521 test_ret += test_inputPop();
16522 test_ret += test_inputPush();
16523 test_ret += test_namePop();
16524 test_ret += test_namePush();
16525 test_ret += test_nodePop();
16526 test_ret += test_nodePush();
16527 test_ret += test_xmlCheckLanguageID();
16528 test_ret += test_xmlCopyChar();
16529 test_ret += test_xmlCopyCharMultiByte();
16530 test_ret += test_xmlCreateEntityParserCtxt();
16531 test_ret += test_xmlCreateFileParserCtxt();
16532 test_ret += test_xmlCreateMemoryParserCtxt();
16533 test_ret += test_xmlCreateURLParserCtxt();
16534 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016535 test_ret += test_xmlErrMemory();
16536 test_ret += test_xmlIsLetter();
16537 test_ret += test_xmlNewEntityInputStream();
16538 test_ret += test_xmlNewInputFromFile();
16539 test_ret += test_xmlNewInputStream();
16540 test_ret += test_xmlNewStringInputStream();
16541 test_ret += test_xmlNextChar();
16542 test_ret += test_xmlParserInputShrink();
16543 test_ret += test_xmlPopInput();
16544 test_ret += test_xmlPushInput();
16545 test_ret += test_xmlSetEntityReferenceFunc();
16546 test_ret += test_xmlSplitQName();
16547 test_ret += test_xmlStringCurrentChar();
16548 test_ret += test_xmlStringDecodeEntities();
16549 test_ret += test_xmlStringLenDecodeEntities();
16550 test_ret += test_xmlSwitchEncoding();
16551 test_ret += test_xmlSwitchInputEncoding();
16552 test_ret += test_xmlSwitchToEncoding();
16553
16554 if (test_ret != 0)
16555 printf("Module parserInternals: %d errors\n", test_ret);
16556 return(test_ret);
16557}
16558
Daniel Veillardd93f6252004-11-02 15:53:51 +000016559static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016560test_xmlPatternGetStreamCtxt(void) {
16561 int test_ret = 0;
16562
16563
16564 /* missing type support */
16565 return(test_ret);
16566}
16567
16568
16569static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016570test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016572
William M. Brack21e4ef22005-01-02 09:53:13 +000016573#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016574 int mem_base;
16575 int ret_val;
16576 xmlPatternPtr comp; /* the precompiled pattern */
16577 int n_comp;
16578 xmlNodePtr node; /* a node */
16579 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016580
Daniel Veillardce682bc2004-11-05 17:22:25 +000016581 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16582 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16583 mem_base = xmlMemBlocks();
16584 comp = gen_xmlPatternPtr(n_comp, 0);
16585 node = gen_xmlNodePtr(n_node, 1);
16586
16587 ret_val = xmlPatternMatch(comp, node);
16588 desret_int(ret_val);
16589 call_tests++;
16590 des_xmlPatternPtr(n_comp, comp, 0);
16591 des_xmlNodePtr(n_node, node, 1);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlPatternMatch",
16595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016596 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016597 printf(" %d", n_comp);
16598 printf(" %d", n_node);
16599 printf("\n");
16600 }
16601 }
16602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016604#endif
16605
Daniel Veillard42595322004-11-08 10:52:06 +000016606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016607}
16608
16609
16610static int
16611test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016613
16614
16615 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016617}
16618
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016619
16620#define gen_nb_xmlStreamCtxtPtr 1
16621static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16622 return(NULL);
16623}
16624static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16625}
16626
16627static int
16628test_xmlStreamPop(void) {
16629 int test_ret = 0;
16630
16631#if defined(LIBXML_PATTERN_ENABLED)
16632 int mem_base;
16633 int ret_val;
16634 xmlStreamCtxtPtr stream; /* the stream context */
16635 int n_stream;
16636
16637 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16638 mem_base = xmlMemBlocks();
16639 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16640
16641 ret_val = xmlStreamPop(stream);
16642 desret_int(ret_val);
16643 call_tests++;
16644 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16645 xmlResetLastError();
16646 if (mem_base != xmlMemBlocks()) {
16647 printf("Leak of %d blocks found in xmlStreamPop",
16648 xmlMemBlocks() - mem_base);
16649 test_ret++;
16650 printf(" %d", n_stream);
16651 printf("\n");
16652 }
16653 }
16654 function_tests++;
16655#endif
16656
16657 return(test_ret);
16658}
16659
16660
16661static int
16662test_xmlStreamPush(void) {
16663 int test_ret = 0;
16664
16665#if defined(LIBXML_PATTERN_ENABLED)
16666 int mem_base;
16667 int ret_val;
16668 xmlStreamCtxtPtr stream; /* the stream context */
16669 int n_stream;
16670 xmlChar * name; /* the current name */
16671 int n_name;
16672 xmlChar * ns; /* the namespace name */
16673 int n_ns;
16674
16675 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16677 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16678 mem_base = xmlMemBlocks();
16679 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16680 name = gen_const_xmlChar_ptr(n_name, 1);
16681 ns = gen_const_xmlChar_ptr(n_ns, 2);
16682
16683 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16684 desret_int(ret_val);
16685 call_tests++;
16686 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16687 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16688 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16689 xmlResetLastError();
16690 if (mem_base != xmlMemBlocks()) {
16691 printf("Leak of %d blocks found in xmlStreamPush",
16692 xmlMemBlocks() - mem_base);
16693 test_ret++;
16694 printf(" %d", n_stream);
16695 printf(" %d", n_name);
16696 printf(" %d", n_ns);
16697 printf("\n");
16698 }
16699 }
16700 }
16701 }
16702 function_tests++;
16703#endif
16704
16705 return(test_ret);
16706}
16707
Daniel Veillardd93f6252004-11-02 15:53:51 +000016708static int
16709test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016711
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016712 if (quiet == 0) printf("Testing pattern : 3 of 8 functions ...\n");
16713 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016714 test_ret += test_xmlPatternMatch();
16715 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016716 test_ret += test_xmlStreamPop();
16717 test_ret += test_xmlStreamPush();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016718
Daniel Veillard42595322004-11-08 10:52:06 +000016719 if (test_ret != 0)
16720 printf("Module pattern: %d errors\n", test_ret);
16721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016722}
Daniel Veillarda521d282004-11-09 14:59:59 +000016723#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016724
Daniel Veillardce682bc2004-11-05 17:22:25 +000016725#define gen_nb_xmlRelaxNGPtr 1
16726static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16727 return(NULL);
16728}
16729static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16730}
Daniel Veillarda521d282004-11-09 14:59:59 +000016731#endif
16732
Daniel Veillardce682bc2004-11-05 17:22:25 +000016733
Daniel Veillardd93f6252004-11-02 15:53:51 +000016734static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016735test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016737
William M. Brack21e4ef22005-01-02 09:53:13 +000016738#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016739 int mem_base;
16740 FILE * output; /* the file output */
16741 int n_output;
16742 xmlRelaxNGPtr schema; /* a schema structure */
16743 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016744
Daniel Veillardce682bc2004-11-05 17:22:25 +000016745 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16746 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16747 mem_base = xmlMemBlocks();
16748 output = gen_FILE_ptr(n_output, 0);
16749 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16750
16751 xmlRelaxNGDump(output, schema);
16752 call_tests++;
16753 des_FILE_ptr(n_output, output, 0);
16754 des_xmlRelaxNGPtr(n_schema, schema, 1);
16755 xmlResetLastError();
16756 if (mem_base != xmlMemBlocks()) {
16757 printf("Leak of %d blocks found in xmlRelaxNGDump",
16758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016759 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016760 printf(" %d", n_output);
16761 printf(" %d", n_schema);
16762 printf("\n");
16763 }
16764 }
16765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016766 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016767#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016768
Daniel Veillard42595322004-11-08 10:52:06 +000016769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016770}
16771
16772
16773static int
16774test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016776
William M. Brack21e4ef22005-01-02 09:53:13 +000016777#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016778 int mem_base;
16779 FILE * output; /* the file output */
16780 int n_output;
16781 xmlRelaxNGPtr schema; /* a schema structure */
16782 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016783
Daniel Veillardce682bc2004-11-05 17:22:25 +000016784 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16785 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16786 mem_base = xmlMemBlocks();
16787 output = gen_FILE_ptr(n_output, 0);
16788 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16789
16790 xmlRelaxNGDumpTree(output, schema);
16791 call_tests++;
16792 des_FILE_ptr(n_output, output, 0);
16793 des_xmlRelaxNGPtr(n_schema, schema, 1);
16794 xmlResetLastError();
16795 if (mem_base != xmlMemBlocks()) {
16796 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016798 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016799 printf(" %d", n_output);
16800 printf(" %d", n_schema);
16801 printf("\n");
16802 }
16803 }
16804 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016805 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016806#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016807
Daniel Veillard42595322004-11-08 10:52:06 +000016808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016809}
16810
Daniel Veillarda521d282004-11-09 14:59:59 +000016811#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016812
Daniel Veillardce682bc2004-11-05 17:22:25 +000016813#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16814static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16815 return(NULL);
16816}
16817static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16818}
Daniel Veillarda521d282004-11-09 14:59:59 +000016819#endif
16820
16821#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016822
16823#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16824static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16825 return(NULL);
16826}
16827static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16828}
Daniel Veillarda521d282004-11-09 14:59:59 +000016829#endif
16830
16831#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016832
16833#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16834static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16835 return(NULL);
16836}
16837static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16838}
Daniel Veillarda521d282004-11-09 14:59:59 +000016839#endif
16840
16841#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016842
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016843#define gen_nb_void_ptr_ptr 1
16844static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16845 return(NULL);
16846}
16847static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16848}
Daniel Veillarda521d282004-11-09 14:59:59 +000016849#endif
16850
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016851
Daniel Veillardd93f6252004-11-02 15:53:51 +000016852static int
16853test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016855
William M. Brack21e4ef22005-01-02 09:53:13 +000016856#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016857 int mem_base;
16858 int ret_val;
16859 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16860 int n_ctxt;
16861 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16862 int n_err;
16863 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16864 int n_warn;
16865 void ** ctx; /* contextual data for the callbacks result */
16866 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016867
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016868 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16869 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16870 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16871 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16872 mem_base = xmlMemBlocks();
16873 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16874 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16875 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16876 ctx = gen_void_ptr_ptr(n_ctx, 3);
16877
16878 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16879 desret_int(ret_val);
16880 call_tests++;
16881 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16882 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16883 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16884 des_void_ptr_ptr(n_ctx, ctx, 3);
16885 xmlResetLastError();
16886 if (mem_base != xmlMemBlocks()) {
16887 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016889 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016890 printf(" %d", n_ctxt);
16891 printf(" %d", n_err);
16892 printf(" %d", n_warn);
16893 printf(" %d", n_ctx);
16894 printf("\n");
16895 }
16896 }
16897 }
16898 }
16899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016900 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016901#endif
16902
Daniel Veillard42595322004-11-08 10:52:06 +000016903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016904}
16905
Daniel Veillarda521d282004-11-09 14:59:59 +000016906#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016907
Daniel Veillardce682bc2004-11-05 17:22:25 +000016908#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16909static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16910 return(NULL);
16911}
16912static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16913}
Daniel Veillarda521d282004-11-09 14:59:59 +000016914#endif
16915
Daniel Veillardce682bc2004-11-05 17:22:25 +000016916
Daniel Veillardd93f6252004-11-02 15:53:51 +000016917static int
16918test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016920
William M. Brack21e4ef22005-01-02 09:53:13 +000016921#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016922 int mem_base;
16923 int ret_val;
16924 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16925 int n_ctxt;
16926 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16927 int n_err;
16928 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16929 int n_warn;
16930 void ** ctx; /* the functions context result */
16931 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016932
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016933 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16934 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16935 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16936 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16937 mem_base = xmlMemBlocks();
16938 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16939 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16940 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16941 ctx = gen_void_ptr_ptr(n_ctx, 3);
16942
16943 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16944 desret_int(ret_val);
16945 call_tests++;
16946 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16947 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16948 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16949 des_void_ptr_ptr(n_ctx, ctx, 3);
16950 xmlResetLastError();
16951 if (mem_base != xmlMemBlocks()) {
16952 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016954 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016955 printf(" %d", n_ctxt);
16956 printf(" %d", n_err);
16957 printf(" %d", n_warn);
16958 printf(" %d", n_ctx);
16959 printf("\n");
16960 }
16961 }
16962 }
16963 }
16964 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016965 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016966#endif
16967
Daniel Veillard42595322004-11-08 10:52:06 +000016968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016969}
16970
16971
16972static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016973test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016974 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016975
William M. Brack21e4ef22005-01-02 09:53:13 +000016976#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000016977 int mem_base;
16978 int ret_val;
16979
16980 mem_base = xmlMemBlocks();
16981
16982 ret_val = xmlRelaxNGInitTypes();
16983 desret_int(ret_val);
16984 call_tests++;
16985 xmlResetLastError();
16986 if (mem_base != xmlMemBlocks()) {
16987 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016989 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016990 printf("\n");
16991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016992 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016993#endif
16994
Daniel Veillard42595322004-11-08 10:52:06 +000016995 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016996}
16997
16998
16999static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017000test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017002
William M. Brack21e4ef22005-01-02 09:53:13 +000017003#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017004 int mem_base;
17005 xmlRelaxNGParserCtxtPtr ret_val;
17006 xmlDocPtr doc; /* a preparsed document tree */
17007 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017008
Daniel Veillard42595322004-11-08 10:52:06 +000017009 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17010 mem_base = xmlMemBlocks();
17011 doc = gen_xmlDocPtr(n_doc, 0);
17012
17013 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17014 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17015 call_tests++;
17016 des_xmlDocPtr(n_doc, doc, 0);
17017 xmlResetLastError();
17018 if (mem_base != xmlMemBlocks()) {
17019 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17020 xmlMemBlocks() - mem_base);
17021 test_ret++;
17022 printf(" %d", n_doc);
17023 printf("\n");
17024 }
17025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017026 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017027#endif
17028
Daniel Veillard42595322004-11-08 10:52:06 +000017029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017030}
17031
17032
17033static int
17034test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017036
William M. Brack21e4ef22005-01-02 09:53:13 +000017037#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017038 int mem_base;
17039 xmlRelaxNGParserCtxtPtr ret_val;
17040 char * buffer; /* a pointer to a char array containing the schemas */
17041 int n_buffer;
17042 int size; /* the size of the array */
17043 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017044
Daniel Veillard42595322004-11-08 10:52:06 +000017045 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17046 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17047 mem_base = xmlMemBlocks();
17048 buffer = gen_const_char_ptr(n_buffer, 0);
17049 size = gen_int(n_size, 1);
17050
William M. Brackf13f77f2004-11-12 16:03:48 +000017051 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017052 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17053 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017054 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017055 des_int(n_size, size, 1);
17056 xmlResetLastError();
17057 if (mem_base != xmlMemBlocks()) {
17058 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17059 xmlMemBlocks() - mem_base);
17060 test_ret++;
17061 printf(" %d", n_buffer);
17062 printf(" %d", n_size);
17063 printf("\n");
17064 }
17065 }
17066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017068#endif
17069
Daniel Veillard42595322004-11-08 10:52:06 +000017070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017071}
17072
17073
17074static int
17075test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017077
William M. Brack21e4ef22005-01-02 09:53:13 +000017078#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017079 int mem_base;
17080 xmlRelaxNGParserCtxtPtr ret_val;
17081 char * URL; /* the location of the schema */
17082 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017083
Daniel Veillard42595322004-11-08 10:52:06 +000017084 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17085 mem_base = xmlMemBlocks();
17086 URL = gen_const_char_ptr(n_URL, 0);
17087
William M. Brackf13f77f2004-11-12 16:03:48 +000017088 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017089 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17090 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017091 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017092 xmlResetLastError();
17093 if (mem_base != xmlMemBlocks()) {
17094 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17095 xmlMemBlocks() - mem_base);
17096 test_ret++;
17097 printf(" %d", n_URL);
17098 printf("\n");
17099 }
17100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017102#endif
17103
Daniel Veillard42595322004-11-08 10:52:06 +000017104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017105}
17106
17107
17108static int
17109test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017111
17112
17113 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017115}
17116
17117
17118static int
17119test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017121
17122
17123 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017125}
17126
17127
17128static int
17129test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017131
17132
17133 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017135}
17136
17137
17138static int
17139test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017141
17142
17143 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017145}
17146
17147
17148static int
17149test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017151
William M. Brack21e4ef22005-01-02 09:53:13 +000017152#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017153 int mem_base;
17154 int ret_val;
17155 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17156 int n_ctxt;
17157 xmlDocPtr doc; /* a parsed document tree */
17158 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017159
Daniel Veillardce682bc2004-11-05 17:22:25 +000017160 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17161 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17162 mem_base = xmlMemBlocks();
17163 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17164 doc = gen_xmlDocPtr(n_doc, 1);
17165
17166 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17167 desret_int(ret_val);
17168 call_tests++;
17169 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17170 des_xmlDocPtr(n_doc, doc, 1);
17171 xmlResetLastError();
17172 if (mem_base != xmlMemBlocks()) {
17173 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017175 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017176 printf(" %d", n_ctxt);
17177 printf(" %d", n_doc);
17178 printf("\n");
17179 }
17180 }
17181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017182 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017183#endif
17184
Daniel Veillard42595322004-11-08 10:52:06 +000017185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017186}
17187
17188
17189static int
17190test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017192
William M. Brack21e4ef22005-01-02 09:53:13 +000017193#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017194 int mem_base;
17195 int ret_val;
17196 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17197 int n_ctxt;
17198 xmlDocPtr doc; /* a document instance */
17199 int n_doc;
17200 xmlNodePtr elem; /* an element instance */
17201 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017202
Daniel Veillardce682bc2004-11-05 17:22:25 +000017203 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17204 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17205 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17206 mem_base = xmlMemBlocks();
17207 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17208 doc = gen_xmlDocPtr(n_doc, 1);
17209 elem = gen_xmlNodePtr(n_elem, 2);
17210
17211 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17212 desret_int(ret_val);
17213 call_tests++;
17214 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17215 des_xmlDocPtr(n_doc, doc, 1);
17216 des_xmlNodePtr(n_elem, elem, 2);
17217 xmlResetLastError();
17218 if (mem_base != xmlMemBlocks()) {
17219 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017221 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017222 printf(" %d", n_ctxt);
17223 printf(" %d", n_doc);
17224 printf(" %d", n_elem);
17225 printf("\n");
17226 }
17227 }
17228 }
17229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017230 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017231#endif
17232
Daniel Veillard42595322004-11-08 10:52:06 +000017233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017234}
17235
17236
17237static int
17238test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017240
William M. Brack21e4ef22005-01-02 09:53:13 +000017241#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017242 int mem_base;
17243 int ret_val;
17244 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17245 int n_ctxt;
17246 xmlDocPtr doc; /* a document instance */
17247 int n_doc;
17248 xmlNodePtr elem; /* an element instance */
17249 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017250
Daniel Veillardce682bc2004-11-05 17:22:25 +000017251 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17252 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17253 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17254 mem_base = xmlMemBlocks();
17255 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17256 doc = gen_xmlDocPtr(n_doc, 1);
17257 elem = gen_xmlNodePtr(n_elem, 2);
17258
17259 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17260 desret_int(ret_val);
17261 call_tests++;
17262 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17263 des_xmlDocPtr(n_doc, doc, 1);
17264 des_xmlNodePtr(n_elem, elem, 2);
17265 xmlResetLastError();
17266 if (mem_base != xmlMemBlocks()) {
17267 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017269 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017270 printf(" %d", n_ctxt);
17271 printf(" %d", n_doc);
17272 printf(" %d", n_elem);
17273 printf("\n");
17274 }
17275 }
17276 }
17277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017278 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017279#endif
17280
Daniel Veillard42595322004-11-08 10:52:06 +000017281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017282}
17283
17284
17285static int
17286test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017288
William M. Brack21e4ef22005-01-02 09:53:13 +000017289#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017290 int mem_base;
17291 int ret_val;
17292 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17293 int n_ctxt;
17294 xmlChar * data; /* some character data read */
17295 int n_data;
17296 int len; /* the lenght of the data */
17297 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017298
Daniel Veillardce682bc2004-11-05 17:22:25 +000017299 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17300 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17301 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17302 mem_base = xmlMemBlocks();
17303 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17304 data = gen_const_xmlChar_ptr(n_data, 1);
17305 len = gen_int(n_len, 2);
17306
William M. Brackf13f77f2004-11-12 16:03:48 +000017307 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017308 desret_int(ret_val);
17309 call_tests++;
17310 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017311 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017312 des_int(n_len, len, 2);
17313 xmlResetLastError();
17314 if (mem_base != xmlMemBlocks()) {
17315 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017317 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017318 printf(" %d", n_ctxt);
17319 printf(" %d", n_data);
17320 printf(" %d", n_len);
17321 printf("\n");
17322 }
17323 }
17324 }
17325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017326 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017327#endif
17328
Daniel Veillard42595322004-11-08 10:52:06 +000017329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330}
17331
17332
17333static int
17334test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017336
William M. Brack21e4ef22005-01-02 09:53:13 +000017337#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017338 int mem_base;
17339 int ret_val;
17340 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17341 int n_ctxt;
17342 xmlDocPtr doc; /* a document instance */
17343 int n_doc;
17344 xmlNodePtr elem; /* an element instance */
17345 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017346
Daniel Veillardce682bc2004-11-05 17:22:25 +000017347 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17348 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17349 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17350 mem_base = xmlMemBlocks();
17351 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17352 doc = gen_xmlDocPtr(n_doc, 1);
17353 elem = gen_xmlNodePtr(n_elem, 2);
17354
17355 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17356 desret_int(ret_val);
17357 call_tests++;
17358 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17359 des_xmlDocPtr(n_doc, doc, 1);
17360 des_xmlNodePtr(n_elem, elem, 2);
17361 xmlResetLastError();
17362 if (mem_base != xmlMemBlocks()) {
17363 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017365 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017366 printf(" %d", n_ctxt);
17367 printf(" %d", n_doc);
17368 printf(" %d", n_elem);
17369 printf("\n");
17370 }
17371 }
17372 }
17373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017374 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017375#endif
17376
Daniel Veillard42595322004-11-08 10:52:06 +000017377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017378}
17379
17380
17381static int
17382test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017384
William M. Brack21e4ef22005-01-02 09:53:13 +000017385#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017386 int mem_base;
17387 int ret_val;
17388 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17389 int n_ctxt;
17390 int flags; /* a set of flags values */
17391 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017392
Daniel Veillardce682bc2004-11-05 17:22:25 +000017393 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17394 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17395 mem_base = xmlMemBlocks();
17396 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17397 flags = gen_int(n_flags, 1);
17398
17399 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17400 desret_int(ret_val);
17401 call_tests++;
17402 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17403 des_int(n_flags, flags, 1);
17404 xmlResetLastError();
17405 if (mem_base != xmlMemBlocks()) {
17406 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017408 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017409 printf(" %d", n_ctxt);
17410 printf(" %d", n_flags);
17411 printf("\n");
17412 }
17413 }
17414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017415 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017416#endif
17417
Daniel Veillard42595322004-11-08 10:52:06 +000017418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017419}
17420
17421static int
17422test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017424
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017425 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017426 test_ret += test_xmlRelaxNGDump();
17427 test_ret += test_xmlRelaxNGDumpTree();
17428 test_ret += test_xmlRelaxNGGetParserErrors();
17429 test_ret += test_xmlRelaxNGGetValidErrors();
17430 test_ret += test_xmlRelaxNGInitTypes();
17431 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17432 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17433 test_ret += test_xmlRelaxNGNewParserCtxt();
17434 test_ret += test_xmlRelaxNGNewValidCtxt();
17435 test_ret += test_xmlRelaxNGParse();
17436 test_ret += test_xmlRelaxNGSetParserErrors();
17437 test_ret += test_xmlRelaxNGSetValidErrors();
17438 test_ret += test_xmlRelaxNGValidateDoc();
17439 test_ret += test_xmlRelaxNGValidateFullElement();
17440 test_ret += test_xmlRelaxNGValidatePopElement();
17441 test_ret += test_xmlRelaxNGValidatePushCData();
17442 test_ret += test_xmlRelaxNGValidatePushElement();
17443 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017444
Daniel Veillard42595322004-11-08 10:52:06 +000017445 if (test_ret != 0)
17446 printf("Module relaxng: %d errors\n", test_ret);
17447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017448}
17449static int
17450test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017452
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017453 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017454
Daniel Veillard42595322004-11-08 10:52:06 +000017455 if (test_ret != 0)
17456 printf("Module schemasInternals: %d errors\n", test_ret);
17457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017458}
17459
17460static int
17461test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017463
17464 int mem_base;
17465 xmlNodePtr ret_val;
17466 xmlNodePtr parent; /* the parent node */
17467 int n_parent;
17468 xmlNodePtr cur; /* the child node */
17469 int n_cur;
17470
Daniel Veillarda03e3652004-11-02 18:45:30 +000017471 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017472 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017474 parent = gen_xmlNodePtr(n_parent, 0);
17475 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017476
17477 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017478 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017479 desret_xmlNodePtr(ret_val);
17480 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017481 des_xmlNodePtr(n_parent, parent, 0);
17482 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017483 xmlResetLastError();
17484 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017485 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017487 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017488 printf(" %d", n_parent);
17489 printf(" %d", n_cur);
17490 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017491 }
17492 }
17493 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017494 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017495
Daniel Veillard42595322004-11-08 10:52:06 +000017496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017497}
17498
17499
17500static int
17501test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017503
17504 int mem_base;
17505 xmlNodePtr ret_val;
17506 xmlNodePtr parent; /* the parent node */
17507 int n_parent;
17508 xmlNodePtr cur; /* the first node in the list */
17509 int n_cur;
17510
Daniel Veillarda03e3652004-11-02 18:45:30 +000017511 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017512 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17513 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017514 parent = gen_xmlNodePtr(n_parent, 0);
17515 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017516
17517 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017518 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017519 desret_xmlNodePtr(ret_val);
17520 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017521 des_xmlNodePtr(n_parent, parent, 0);
17522 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017523 xmlResetLastError();
17524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017525 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017528 printf(" %d", n_parent);
17529 printf(" %d", n_cur);
17530 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017531 }
17532 }
17533 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017534 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017535
Daniel Veillard42595322004-11-08 10:52:06 +000017536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017537}
17538
17539
17540static int
17541test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017543
17544 int mem_base;
17545 xmlNodePtr ret_val;
17546 xmlNodePtr cur; /* the child node */
17547 int n_cur;
17548 xmlNodePtr elem; /* the new node */
17549 int n_elem;
17550
17551 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017552 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017553 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017554 cur = gen_xmlNodePtr(n_cur, 0);
17555 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556
17557 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017558 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017559 desret_xmlNodePtr(ret_val);
17560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017561 des_xmlNodePtr(n_cur, cur, 0);
17562 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017563 xmlResetLastError();
17564 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017565 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017567 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017568 printf(" %d", n_cur);
17569 printf(" %d", n_elem);
17570 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017571 }
17572 }
17573 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017574 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017575
Daniel Veillard42595322004-11-08 10:52:06 +000017576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017577}
17578
17579
17580static int
17581test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017583
William M. Brack21e4ef22005-01-02 09:53:13 +000017584#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017585 int mem_base;
17586 xmlNodePtr ret_val;
17587 xmlNodePtr cur; /* the child node */
17588 int n_cur;
17589 xmlNodePtr elem; /* the new node */
17590 int n_elem;
17591
17592 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017593 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017595 cur = gen_xmlNodePtr(n_cur, 0);
17596 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017597
17598 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017599 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017600 desret_xmlNodePtr(ret_val);
17601 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017602 des_xmlNodePtr(n_cur, cur, 0);
17603 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017604 xmlResetLastError();
17605 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017606 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017608 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017609 printf(" %d", n_cur);
17610 printf(" %d", n_elem);
17611 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017612 }
17613 }
17614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017615 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616#endif
17617
Daniel Veillard42595322004-11-08 10:52:06 +000017618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017619}
17620
17621
17622static int
17623test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017625
17626 int mem_base;
17627 xmlNodePtr ret_val;
17628 xmlNodePtr cur; /* the child node */
17629 int n_cur;
17630 xmlNodePtr elem; /* the new node */
17631 int n_elem;
17632
17633 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017634 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017636 cur = gen_xmlNodePtr(n_cur, 0);
17637 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017638
17639 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017640 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017641 desret_xmlNodePtr(ret_val);
17642 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017643 des_xmlNodePtr(n_cur, cur, 0);
17644 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645 xmlResetLastError();
17646 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017647 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017649 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017650 printf(" %d", n_cur);
17651 printf(" %d", n_elem);
17652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017653 }
17654 }
17655 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017656 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017657
Daniel Veillard42595322004-11-08 10:52:06 +000017658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017659}
17660
17661
17662static int
17663test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017665
William M. Brack21e4ef22005-01-02 09:53:13 +000017666#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017667#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017668 int mem_base;
17669 xmlBufferPtr buf; /* the XML buffer output */
17670 int n_buf;
17671 xmlDocPtr doc; /* the document */
17672 int n_doc;
17673 xmlAttrPtr attr; /* the attribute node */
17674 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017675 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017676 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017677
Daniel Veillardce244ad2004-11-05 10:03:46 +000017678 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17679 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17680 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17681 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17682 mem_base = xmlMemBlocks();
17683 buf = gen_xmlBufferPtr(n_buf, 0);
17684 doc = gen_xmlDocPtr(n_doc, 1);
17685 attr = gen_xmlAttrPtr(n_attr, 2);
17686 string = gen_const_xmlChar_ptr(n_string, 3);
17687
William M. Brackf13f77f2004-11-12 16:03:48 +000017688 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017689 call_tests++;
17690 des_xmlBufferPtr(n_buf, buf, 0);
17691 des_xmlDocPtr(n_doc, doc, 1);
17692 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017693 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017694 xmlResetLastError();
17695 if (mem_base != xmlMemBlocks()) {
17696 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017698 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017699 printf(" %d", n_buf);
17700 printf(" %d", n_doc);
17701 printf(" %d", n_attr);
17702 printf(" %d", n_string);
17703 printf("\n");
17704 }
17705 }
17706 }
17707 }
17708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017709 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017710#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017711#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017712
Daniel Veillard42595322004-11-08 10:52:06 +000017713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017714}
17715
17716
17717static int
17718test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017720
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017721 int mem_base;
17722 int ret_val;
17723 xmlBufferPtr buf; /* the buffer to dump */
17724 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017725 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017726 int n_str;
17727 int len; /* the number of #xmlChar to add */
17728 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017729
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017730 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17731 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17732 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017734 buf = gen_xmlBufferPtr(n_buf, 0);
17735 str = gen_const_xmlChar_ptr(n_str, 1);
17736 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017737
William M. Brackf13f77f2004-11-12 16:03:48 +000017738 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017739 desret_int(ret_val);
17740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017741 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017742 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017743 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017744 xmlResetLastError();
17745 if (mem_base != xmlMemBlocks()) {
17746 printf("Leak of %d blocks found in xmlBufferAdd",
17747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017748 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017749 printf(" %d", n_buf);
17750 printf(" %d", n_str);
17751 printf(" %d", n_len);
17752 printf("\n");
17753 }
17754 }
17755 }
17756 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017757 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017758
Daniel Veillard42595322004-11-08 10:52:06 +000017759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017760}
17761
17762
17763static int
17764test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017766
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017767 int mem_base;
17768 int ret_val;
17769 xmlBufferPtr buf; /* the buffer */
17770 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017771 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017772 int n_str;
17773 int len; /* the number of #xmlChar to add */
17774 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017775
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017776 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17777 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17778 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017780 buf = gen_xmlBufferPtr(n_buf, 0);
17781 str = gen_const_xmlChar_ptr(n_str, 1);
17782 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017783
William M. Brackf13f77f2004-11-12 16:03:48 +000017784 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017785 desret_int(ret_val);
17786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017788 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017789 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017790 xmlResetLastError();
17791 if (mem_base != xmlMemBlocks()) {
17792 printf("Leak of %d blocks found in xmlBufferAddHead",
17793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017794 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017795 printf(" %d", n_buf);
17796 printf(" %d", n_str);
17797 printf(" %d", n_len);
17798 printf("\n");
17799 }
17800 }
17801 }
17802 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017803 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017804
Daniel Veillard42595322004-11-08 10:52:06 +000017805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017806}
17807
17808
17809static int
17810test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017812
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017813 int mem_base;
17814 int ret_val;
17815 xmlBufferPtr buf; /* the buffer to dump */
17816 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017817 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017818 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017819
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017820 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17821 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17822 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017823 buf = gen_xmlBufferPtr(n_buf, 0);
17824 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017825
William M. Brackf13f77f2004-11-12 16:03:48 +000017826 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017827 desret_int(ret_val);
17828 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017829 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017830 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017831 xmlResetLastError();
17832 if (mem_base != xmlMemBlocks()) {
17833 printf("Leak of %d blocks found in xmlBufferCCat",
17834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017835 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017836 printf(" %d", n_buf);
17837 printf(" %d", n_str);
17838 printf("\n");
17839 }
17840 }
17841 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017842 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017843
Daniel Veillard42595322004-11-08 10:52:06 +000017844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017845}
17846
17847
17848static int
17849test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017851
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017852 int mem_base;
17853 int ret_val;
17854 xmlBufferPtr buf; /* the buffer to add to */
17855 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017856 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017857 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017858
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017859 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17860 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017862 buf = gen_xmlBufferPtr(n_buf, 0);
17863 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017864
William M. Brackf13f77f2004-11-12 16:03:48 +000017865 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017866 desret_int(ret_val);
17867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017868 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017869 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017870 xmlResetLastError();
17871 if (mem_base != xmlMemBlocks()) {
17872 printf("Leak of %d blocks found in xmlBufferCat",
17873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017874 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017875 printf(" %d", n_buf);
17876 printf(" %d", n_str);
17877 printf("\n");
17878 }
17879 }
17880 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017881 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017882
Daniel Veillard42595322004-11-08 10:52:06 +000017883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017884}
17885
17886
Daniel Veillardce682bc2004-11-05 17:22:25 +000017887#define gen_nb_const_xmlBufferPtr 1
17888static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17889 return(NULL);
17890}
17891static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17892}
17893
Daniel Veillardd93f6252004-11-02 15:53:51 +000017894static int
17895test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017897
Daniel Veillardce682bc2004-11-05 17:22:25 +000017898 int mem_base;
17899 const xmlChar * ret_val;
17900 xmlBufferPtr buf; /* the buffer */
17901 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017902
Daniel Veillardce682bc2004-11-05 17:22:25 +000017903 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17904 mem_base = xmlMemBlocks();
17905 buf = gen_const_xmlBufferPtr(n_buf, 0);
17906
William M. Brackf13f77f2004-11-12 16:03:48 +000017907 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017908 desret_const_xmlChar_ptr(ret_val);
17909 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017910 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017911 xmlResetLastError();
17912 if (mem_base != xmlMemBlocks()) {
17913 printf("Leak of %d blocks found in xmlBufferContent",
17914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017915 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017916 printf(" %d", n_buf);
17917 printf("\n");
17918 }
17919 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017920 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017921
Daniel Veillard42595322004-11-08 10:52:06 +000017922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017923}
17924
17925
17926static int
17927test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017929
Daniel Veillard3d95c732004-11-06 22:25:14 +000017930 int mem_base;
17931 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017932
Daniel Veillard3d95c732004-11-06 22:25:14 +000017933 mem_base = xmlMemBlocks();
17934
17935 ret_val = xmlBufferCreate();
17936 desret_xmlBufferPtr(ret_val);
17937 call_tests++;
17938 xmlResetLastError();
17939 if (mem_base != xmlMemBlocks()) {
17940 printf("Leak of %d blocks found in xmlBufferCreate",
17941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017942 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017943 printf("\n");
17944 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017945 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017946
Daniel Veillard42595322004-11-08 10:52:06 +000017947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017948}
17949
17950
17951static int
17952test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017954
17955
17956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017958}
17959
17960
17961static int
17962test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017964
17965
17966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017968}
17969
17970
17971static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017972test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017974
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017975 int mem_base;
17976 xmlBufferPtr buf; /* the buffer */
17977 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017978
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017979 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017981 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017982
17983 xmlBufferEmpty(buf);
17984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017985 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017986 xmlResetLastError();
17987 if (mem_base != xmlMemBlocks()) {
17988 printf("Leak of %d blocks found in xmlBufferEmpty",
17989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017990 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017991 printf(" %d", n_buf);
17992 printf("\n");
17993 }
17994 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017996
Daniel Veillard42595322004-11-08 10:52:06 +000017997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017998}
17999
18000
18001static int
18002test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018004
Daniel Veillard3d97e662004-11-04 10:49:00 +000018005 int mem_base;
18006 int ret_val;
18007 xmlBufferPtr buf; /* the buffer */
18008 int n_buf;
18009 unsigned int len; /* the minimum free size to allocate */
18010 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018011
Daniel Veillard3d97e662004-11-04 10:49:00 +000018012 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18013 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18014 mem_base = xmlMemBlocks();
18015 buf = gen_xmlBufferPtr(n_buf, 0);
18016 len = gen_unsigned_int(n_len, 1);
18017
18018 ret_val = xmlBufferGrow(buf, len);
18019 desret_int(ret_val);
18020 call_tests++;
18021 des_xmlBufferPtr(n_buf, buf, 0);
18022 des_unsigned_int(n_len, len, 1);
18023 xmlResetLastError();
18024 if (mem_base != xmlMemBlocks()) {
18025 printf("Leak of %d blocks found in xmlBufferGrow",
18026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018027 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018028 printf(" %d", n_buf);
18029 printf(" %d", n_len);
18030 printf("\n");
18031 }
18032 }
18033 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018035
Daniel Veillard42595322004-11-08 10:52:06 +000018036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018037}
18038
18039
18040static int
18041test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018043
Daniel Veillardce682bc2004-11-05 17:22:25 +000018044 int mem_base;
18045 int ret_val;
18046 xmlBufferPtr buf; /* the buffer */
18047 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018048
Daniel Veillardce682bc2004-11-05 17:22:25 +000018049 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18050 mem_base = xmlMemBlocks();
18051 buf = gen_const_xmlBufferPtr(n_buf, 0);
18052
William M. Brackf13f77f2004-11-12 16:03:48 +000018053 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018054 desret_int(ret_val);
18055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018056 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018057 xmlResetLastError();
18058 if (mem_base != xmlMemBlocks()) {
18059 printf("Leak of %d blocks found in xmlBufferLength",
18060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018061 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018062 printf(" %d", n_buf);
18063 printf("\n");
18064 }
18065 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018067
Daniel Veillard42595322004-11-08 10:52:06 +000018068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018069}
18070
18071
18072static int
18073test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018075
Daniel Veillard3d97e662004-11-04 10:49:00 +000018076 int mem_base;
18077 int ret_val;
18078 xmlBufferPtr buf; /* the buffer to resize */
18079 int n_buf;
18080 unsigned int size; /* the desired size */
18081 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018082
Daniel Veillard3d97e662004-11-04 10:49:00 +000018083 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18084 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18085 mem_base = xmlMemBlocks();
18086 buf = gen_xmlBufferPtr(n_buf, 0);
18087 size = gen_unsigned_int(n_size, 1);
18088
18089 ret_val = xmlBufferResize(buf, size);
18090 desret_int(ret_val);
18091 call_tests++;
18092 des_xmlBufferPtr(n_buf, buf, 0);
18093 des_unsigned_int(n_size, size, 1);
18094 xmlResetLastError();
18095 if (mem_base != xmlMemBlocks()) {
18096 printf("Leak of %d blocks found in xmlBufferResize",
18097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018098 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018099 printf(" %d", n_buf);
18100 printf(" %d", n_size);
18101 printf("\n");
18102 }
18103 }
18104 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018106
Daniel Veillard42595322004-11-08 10:52:06 +000018107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018108}
18109
18110
18111static int
18112test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018114
Daniel Veillard57b25162004-11-06 14:50:18 +000018115 int mem_base;
18116 xmlBufferPtr buf; /* the buffer to tune */
18117 int n_buf;
18118 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18119 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018120
Daniel Veillard57b25162004-11-06 14:50:18 +000018121 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18122 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18123 mem_base = xmlMemBlocks();
18124 buf = gen_xmlBufferPtr(n_buf, 0);
18125 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18126
18127 xmlBufferSetAllocationScheme(buf, scheme);
18128 call_tests++;
18129 des_xmlBufferPtr(n_buf, buf, 0);
18130 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18131 xmlResetLastError();
18132 if (mem_base != xmlMemBlocks()) {
18133 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018135 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018136 printf(" %d", n_buf);
18137 printf(" %d", n_scheme);
18138 printf("\n");
18139 }
18140 }
18141 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018143
Daniel Veillard42595322004-11-08 10:52:06 +000018144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018145}
18146
18147
18148static int
18149test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018151
Daniel Veillard3d97e662004-11-04 10:49:00 +000018152 int mem_base;
18153 int ret_val;
18154 xmlBufferPtr buf; /* the buffer to dump */
18155 int n_buf;
18156 unsigned int len; /* the number of xmlChar to remove */
18157 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018158
Daniel Veillard3d97e662004-11-04 10:49:00 +000018159 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18160 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18161 mem_base = xmlMemBlocks();
18162 buf = gen_xmlBufferPtr(n_buf, 0);
18163 len = gen_unsigned_int(n_len, 1);
18164
18165 ret_val = xmlBufferShrink(buf, len);
18166 desret_int(ret_val);
18167 call_tests++;
18168 des_xmlBufferPtr(n_buf, buf, 0);
18169 des_unsigned_int(n_len, len, 1);
18170 xmlResetLastError();
18171 if (mem_base != xmlMemBlocks()) {
18172 printf("Leak of %d blocks found in xmlBufferShrink",
18173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018174 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018175 printf(" %d", n_buf);
18176 printf(" %d", n_len);
18177 printf("\n");
18178 }
18179 }
18180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018182
Daniel Veillard42595322004-11-08 10:52:06 +000018183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018184}
18185
18186
18187static int
18188test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018190
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018191 int mem_base;
18192 xmlBufferPtr buf; /* the XML buffer */
18193 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018194 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018195 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018196
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018197 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18198 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018200 buf = gen_xmlBufferPtr(n_buf, 0);
18201 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018202
William M. Brackf13f77f2004-11-12 16:03:48 +000018203 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018205 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018206 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018207 xmlResetLastError();
18208 if (mem_base != xmlMemBlocks()) {
18209 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018211 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018212 printf(" %d", n_buf);
18213 printf(" %d", n_string);
18214 printf("\n");
18215 }
18216 }
18217 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018219
Daniel Veillard42595322004-11-08 10:52:06 +000018220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018221}
18222
18223
18224static int
18225test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018227
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018228 int mem_base;
18229 xmlBufferPtr buf; /* the XML buffer output */
18230 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018231 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018232 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018233
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018234 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18235 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018237 buf = gen_xmlBufferPtr(n_buf, 0);
18238 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239
William M. Brackf13f77f2004-11-12 16:03:48 +000018240 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018242 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018243 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018244 xmlResetLastError();
18245 if (mem_base != xmlMemBlocks()) {
18246 printf("Leak of %d blocks found in xmlBufferWriteChar",
18247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018248 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018249 printf(" %d", n_buf);
18250 printf(" %d", n_string);
18251 printf("\n");
18252 }
18253 }
18254 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018256
Daniel Veillard42595322004-11-08 10:52:06 +000018257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018258}
18259
18260
18261static int
18262test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018264
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018265 int mem_base;
18266 xmlBufferPtr buf; /* the XML buffer output */
18267 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018268 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018269 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018270
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018271 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18272 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18273 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018274 buf = gen_xmlBufferPtr(n_buf, 0);
18275 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018276
William M. Brackf13f77f2004-11-12 16:03:48 +000018277 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018279 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018280 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018281 xmlResetLastError();
18282 if (mem_base != xmlMemBlocks()) {
18283 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018285 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018286 printf(" %d", n_buf);
18287 printf(" %d", n_string);
18288 printf("\n");
18289 }
18290 }
18291 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018293
Daniel Veillard42595322004-11-08 10:52:06 +000018294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018295}
18296
18297
18298static int
18299test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018301
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018302 int mem_base;
18303 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018304 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018305 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018306 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018307 int n_prefix;
18308 xmlChar * memory; /* preallocated memory */
18309 int n_memory;
18310 int len; /* preallocated memory length */
18311 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018312
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018313 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18314 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18315 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18316 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018318 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18319 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18320 memory = gen_xmlChar_ptr(n_memory, 2);
18321 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018322
William M. Brackf13f77f2004-11-12 16:03:48 +000018323 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018324 if ((ret_val != NULL) && (ret_val != ncname) &&
18325 (ret_val != prefix) && (ret_val != memory))
18326 xmlFree(ret_val);
18327 ret_val = NULL;
18328 desret_xmlChar_ptr(ret_val);
18329 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018330 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18331 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018332 des_xmlChar_ptr(n_memory, memory, 2);
18333 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018334 xmlResetLastError();
18335 if (mem_base != xmlMemBlocks()) {
18336 printf("Leak of %d blocks found in xmlBuildQName",
18337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018338 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018339 printf(" %d", n_ncname);
18340 printf(" %d", n_prefix);
18341 printf(" %d", n_memory);
18342 printf(" %d", n_len);
18343 printf("\n");
18344 }
18345 }
18346 }
18347 }
18348 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018350
Daniel Veillard42595322004-11-08 10:52:06 +000018351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018352}
18353
18354
18355static int
18356test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018358
William M. Brack21e4ef22005-01-02 09:53:13 +000018359#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018360 int mem_base;
18361 xmlDocPtr ret_val;
18362 xmlDocPtr doc; /* the document */
18363 int n_doc;
18364 int recursive; /* if not zero do a recursive copy. */
18365 int n_recursive;
18366
18367 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18368 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018370 doc = gen_xmlDocPtr(n_doc, 0);
18371 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018372
18373 ret_val = xmlCopyDoc(doc, recursive);
18374 desret_xmlDocPtr(ret_val);
18375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018376 des_xmlDocPtr(n_doc, doc, 0);
18377 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018378 xmlResetLastError();
18379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018380 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018383 printf(" %d", n_doc);
18384 printf(" %d", n_recursive);
18385 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018386 }
18387 }
18388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018389 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018390#endif
18391
Daniel Veillard42595322004-11-08 10:52:06 +000018392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018393}
18394
18395
18396static int
18397test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018399
William M. Brack21e4ef22005-01-02 09:53:13 +000018400#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018401 int mem_base;
18402 xmlDtdPtr ret_val;
18403 xmlDtdPtr dtd; /* the dtd */
18404 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018405
Daniel Veillard27f20102004-11-05 11:50:11 +000018406 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18407 mem_base = xmlMemBlocks();
18408 dtd = gen_xmlDtdPtr(n_dtd, 0);
18409
18410 ret_val = xmlCopyDtd(dtd);
18411 desret_xmlDtdPtr(ret_val);
18412 call_tests++;
18413 des_xmlDtdPtr(n_dtd, dtd, 0);
18414 xmlResetLastError();
18415 if (mem_base != xmlMemBlocks()) {
18416 printf("Leak of %d blocks found in xmlCopyDtd",
18417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018418 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018419 printf(" %d", n_dtd);
18420 printf("\n");
18421 }
18422 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018423 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018424#endif
18425
Daniel Veillard42595322004-11-08 10:52:06 +000018426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018427}
18428
18429
18430static int
18431test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018433
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018434 int mem_base;
18435 xmlNsPtr ret_val;
18436 xmlNsPtr cur; /* the namespace */
18437 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018438
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018439 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18440 mem_base = xmlMemBlocks();
18441 cur = gen_xmlNsPtr(n_cur, 0);
18442
18443 ret_val = xmlCopyNamespace(cur);
18444 if (ret_val != NULL) xmlFreeNs(ret_val);
18445 desret_xmlNsPtr(ret_val);
18446 call_tests++;
18447 des_xmlNsPtr(n_cur, cur, 0);
18448 xmlResetLastError();
18449 if (mem_base != xmlMemBlocks()) {
18450 printf("Leak of %d blocks found in xmlCopyNamespace",
18451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018452 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018453 printf(" %d", n_cur);
18454 printf("\n");
18455 }
18456 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018457 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018458
Daniel Veillard42595322004-11-08 10:52:06 +000018459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018460}
18461
18462
18463static int
18464test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018467 int mem_base;
18468 xmlNsPtr ret_val;
18469 xmlNsPtr cur; /* the first namespace */
18470 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018471
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018472 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18473 mem_base = xmlMemBlocks();
18474 cur = gen_xmlNsPtr(n_cur, 0);
18475
18476 ret_val = xmlCopyNamespaceList(cur);
18477 if (ret_val != NULL) xmlFreeNsList(ret_val);
18478 desret_xmlNsPtr(ret_val);
18479 call_tests++;
18480 des_xmlNsPtr(n_cur, cur, 0);
18481 xmlResetLastError();
18482 if (mem_base != xmlMemBlocks()) {
18483 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018485 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018486 printf(" %d", n_cur);
18487 printf("\n");
18488 }
18489 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018491
Daniel Veillard42595322004-11-08 10:52:06 +000018492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018493}
18494
18495
18496static int
18497test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018499
Daniel Veillardce682bc2004-11-05 17:22:25 +000018500 int mem_base;
18501 xmlNodePtr ret_val;
18502 xmlNodePtr node; /* the node */
18503 int n_node;
18504 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18505 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018506
Daniel Veillardce682bc2004-11-05 17:22:25 +000018507 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18508 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18509 mem_base = xmlMemBlocks();
18510 node = gen_const_xmlNodePtr(n_node, 0);
18511 extended = gen_int(n_extended, 1);
18512
William M. Brackf13f77f2004-11-12 16:03:48 +000018513 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018514 desret_xmlNodePtr(ret_val);
18515 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018516 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018517 des_int(n_extended, extended, 1);
18518 xmlResetLastError();
18519 if (mem_base != xmlMemBlocks()) {
18520 printf("Leak of %d blocks found in xmlCopyNode",
18521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018522 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018523 printf(" %d", n_node);
18524 printf(" %d", n_extended);
18525 printf("\n");
18526 }
18527 }
18528 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018529 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018530
Daniel Veillard42595322004-11-08 10:52:06 +000018531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018532}
18533
18534
18535static int
18536test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018538
Daniel Veillardce682bc2004-11-05 17:22:25 +000018539 int mem_base;
18540 xmlNodePtr ret_val;
18541 xmlNodePtr node; /* the first node in the list. */
18542 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018543
Daniel Veillardce682bc2004-11-05 17:22:25 +000018544 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18545 mem_base = xmlMemBlocks();
18546 node = gen_const_xmlNodePtr(n_node, 0);
18547
William M. Brackf13f77f2004-11-12 16:03:48 +000018548 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018549 desret_xmlNodePtr(ret_val);
18550 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018551 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018552 xmlResetLastError();
18553 if (mem_base != xmlMemBlocks()) {
18554 printf("Leak of %d blocks found in xmlCopyNodeList",
18555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018556 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018557 printf(" %d", n_node);
18558 printf("\n");
18559 }
18560 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018562
Daniel Veillard42595322004-11-08 10:52:06 +000018563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018564}
18565
18566
18567static int
18568test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018570
Daniel Veillard57b25162004-11-06 14:50:18 +000018571 int mem_base;
18572 xmlAttrPtr ret_val;
18573 xmlNodePtr target; /* the element where the attribute will be grafted */
18574 int n_target;
18575 xmlAttrPtr cur; /* the attribute */
18576 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018577
Daniel Veillard57b25162004-11-06 14:50:18 +000018578 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18579 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18580 mem_base = xmlMemBlocks();
18581 target = gen_xmlNodePtr(n_target, 0);
18582 cur = gen_xmlAttrPtr(n_cur, 1);
18583
18584 ret_val = xmlCopyProp(target, cur);
18585 desret_xmlAttrPtr(ret_val);
18586 call_tests++;
18587 des_xmlNodePtr(n_target, target, 0);
18588 des_xmlAttrPtr(n_cur, cur, 1);
18589 xmlResetLastError();
18590 if (mem_base != xmlMemBlocks()) {
18591 printf("Leak of %d blocks found in xmlCopyProp",
18592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018593 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018594 printf(" %d", n_target);
18595 printf(" %d", n_cur);
18596 printf("\n");
18597 }
18598 }
18599 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018601
Daniel Veillard42595322004-11-08 10:52:06 +000018602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018603}
18604
18605
18606static int
18607test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018609
Daniel Veillard57b25162004-11-06 14:50:18 +000018610 int mem_base;
18611 xmlAttrPtr ret_val;
18612 xmlNodePtr target; /* the element where the attributes will be grafted */
18613 int n_target;
18614 xmlAttrPtr cur; /* the first attribute */
18615 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018616
Daniel Veillard57b25162004-11-06 14:50:18 +000018617 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18618 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18619 mem_base = xmlMemBlocks();
18620 target = gen_xmlNodePtr(n_target, 0);
18621 cur = gen_xmlAttrPtr(n_cur, 1);
18622
18623 ret_val = xmlCopyPropList(target, cur);
18624 desret_xmlAttrPtr(ret_val);
18625 call_tests++;
18626 des_xmlNodePtr(n_target, target, 0);
18627 des_xmlAttrPtr(n_cur, cur, 1);
18628 xmlResetLastError();
18629 if (mem_base != xmlMemBlocks()) {
18630 printf("Leak of %d blocks found in xmlCopyPropList",
18631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018632 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018633 printf(" %d", n_target);
18634 printf(" %d", n_cur);
18635 printf("\n");
18636 }
18637 }
18638 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018640
Daniel Veillard42595322004-11-08 10:52:06 +000018641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018642}
18643
18644
18645static int
18646test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018648
Daniel Veillard34099b42004-11-04 17:34:35 +000018649 int mem_base;
18650 xmlDtdPtr ret_val;
18651 xmlDocPtr doc; /* the document pointer */
18652 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018653 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018654 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018655 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018656 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018657 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018658 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018659
Daniel Veillard34099b42004-11-04 17:34:35 +000018660 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18661 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18662 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18663 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18664 mem_base = xmlMemBlocks();
18665 doc = gen_xmlDocPtr(n_doc, 0);
18666 name = gen_const_xmlChar_ptr(n_name, 1);
18667 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18668 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18669
William M. Brackf13f77f2004-11-12 16:03:48 +000018670 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018671 desret_xmlDtdPtr(ret_val);
18672 call_tests++;
18673 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018674 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18675 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18676 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018677 xmlResetLastError();
18678 if (mem_base != xmlMemBlocks()) {
18679 printf("Leak of %d blocks found in xmlCreateIntSubset",
18680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018681 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018682 printf(" %d", n_doc);
18683 printf(" %d", n_name);
18684 printf(" %d", n_ExternalID);
18685 printf(" %d", n_SystemID);
18686 printf("\n");
18687 }
18688 }
18689 }
18690 }
18691 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018692 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018693
Daniel Veillard42595322004-11-08 10:52:06 +000018694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018695}
18696
18697
18698static int
18699test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018701
Daniel Veillardce682bc2004-11-05 17:22:25 +000018702 int mem_base;
18703 xmlNodePtr ret_val;
18704 xmlNodePtr node; /* the node */
18705 int n_node;
18706 xmlDocPtr doc; /* the document */
18707 int n_doc;
18708 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18709 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018710
Daniel Veillardce682bc2004-11-05 17:22:25 +000018711 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18712 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18713 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18714 mem_base = xmlMemBlocks();
18715 node = gen_const_xmlNodePtr(n_node, 0);
18716 doc = gen_xmlDocPtr(n_doc, 1);
18717 extended = gen_int(n_extended, 2);
18718
William M. Brackf13f77f2004-11-12 16:03:48 +000018719 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018720 desret_xmlNodePtr(ret_val);
18721 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018722 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018723 des_xmlDocPtr(n_doc, doc, 1);
18724 des_int(n_extended, extended, 2);
18725 xmlResetLastError();
18726 if (mem_base != xmlMemBlocks()) {
18727 printf("Leak of %d blocks found in xmlDocCopyNode",
18728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018730 printf(" %d", n_node);
18731 printf(" %d", n_doc);
18732 printf(" %d", n_extended);
18733 printf("\n");
18734 }
18735 }
18736 }
18737 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018738 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018739
Daniel Veillard42595322004-11-08 10:52:06 +000018740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018741}
18742
18743
18744static int
18745test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018747
Daniel Veillardce682bc2004-11-05 17:22:25 +000018748 int mem_base;
18749 xmlNodePtr ret_val;
18750 xmlDocPtr doc; /* the target document */
18751 int n_doc;
18752 xmlNodePtr node; /* the first node in the list. */
18753 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018754
Daniel Veillardce682bc2004-11-05 17:22:25 +000018755 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18756 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18757 mem_base = xmlMemBlocks();
18758 doc = gen_xmlDocPtr(n_doc, 0);
18759 node = gen_const_xmlNodePtr(n_node, 1);
18760
William M. Brackf13f77f2004-11-12 16:03:48 +000018761 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018762 desret_xmlNodePtr(ret_val);
18763 call_tests++;
18764 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018765 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018766 xmlResetLastError();
18767 if (mem_base != xmlMemBlocks()) {
18768 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018770 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018771 printf(" %d", n_doc);
18772 printf(" %d", n_node);
18773 printf("\n");
18774 }
18775 }
18776 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018778
Daniel Veillard42595322004-11-08 10:52:06 +000018779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018780}
18781
18782
18783static int
18784test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018786
William M. Brack21e4ef22005-01-02 09:53:13 +000018787#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018788 int mem_base;
18789 int ret_val;
18790 FILE * f; /* the FILE* */
18791 int n_f;
18792 xmlDocPtr cur; /* the document */
18793 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018794
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018795 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18796 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18797 mem_base = xmlMemBlocks();
18798 f = gen_FILE_ptr(n_f, 0);
18799 cur = gen_xmlDocPtr(n_cur, 1);
18800
18801 ret_val = xmlDocDump(f, cur);
18802 desret_int(ret_val);
18803 call_tests++;
18804 des_FILE_ptr(n_f, f, 0);
18805 des_xmlDocPtr(n_cur, cur, 1);
18806 xmlResetLastError();
18807 if (mem_base != xmlMemBlocks()) {
18808 printf("Leak of %d blocks found in xmlDocDump",
18809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018810 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018811 printf(" %d", n_f);
18812 printf(" %d", n_cur);
18813 printf("\n");
18814 }
18815 }
18816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018817 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018818#endif
18819
Daniel Veillard42595322004-11-08 10:52:06 +000018820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018821}
18822
18823
18824static int
18825test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018827
William M. Brack21e4ef22005-01-02 09:53:13 +000018828#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018829 int mem_base;
18830 xmlDocPtr cur; /* the document */
18831 int n_cur;
18832 xmlChar ** mem; /* OUT: the memory pointer */
18833 int n_mem;
18834 int * size; /* OUT: the memory length */
18835 int n_size;
18836 int format; /* should formatting spaces been added */
18837 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018838
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018839 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18840 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18841 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18842 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18843 mem_base = xmlMemBlocks();
18844 cur = gen_xmlDocPtr(n_cur, 0);
18845 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18846 size = gen_int_ptr(n_size, 2);
18847 format = gen_int(n_format, 3);
18848
18849 xmlDocDumpFormatMemory(cur, mem, size, format);
18850 call_tests++;
18851 des_xmlDocPtr(n_cur, cur, 0);
18852 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18853 des_int_ptr(n_size, size, 2);
18854 des_int(n_format, format, 3);
18855 xmlResetLastError();
18856 if (mem_base != xmlMemBlocks()) {
18857 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018859 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018860 printf(" %d", n_cur);
18861 printf(" %d", n_mem);
18862 printf(" %d", n_size);
18863 printf(" %d", n_format);
18864 printf("\n");
18865 }
18866 }
18867 }
18868 }
18869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018870 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018871#endif
18872
Daniel Veillard42595322004-11-08 10:52:06 +000018873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018874}
18875
18876
18877static int
18878test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018880
William M. Brack21e4ef22005-01-02 09:53:13 +000018881#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018882 int mem_base;
18883 xmlDocPtr out_doc; /* Document to generate XML text from */
18884 int n_out_doc;
18885 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18886 int n_doc_txt_ptr;
18887 int * doc_txt_len; /* Length of the generated XML text */
18888 int n_doc_txt_len;
18889 char * txt_encoding; /* Character encoding to use when generating XML text */
18890 int n_txt_encoding;
18891 int format; /* should formatting spaces been added */
18892 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018893
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018894 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18895 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18896 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18897 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18898 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18899 mem_base = xmlMemBlocks();
18900 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18901 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18902 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18903 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18904 format = gen_int(n_format, 4);
18905
William M. Brackf13f77f2004-11-12 16:03:48 +000018906 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018907 call_tests++;
18908 des_xmlDocPtr(n_out_doc, out_doc, 0);
18909 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18910 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018911 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018912 des_int(n_format, format, 4);
18913 xmlResetLastError();
18914 if (mem_base != xmlMemBlocks()) {
18915 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018917 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018918 printf(" %d", n_out_doc);
18919 printf(" %d", n_doc_txt_ptr);
18920 printf(" %d", n_doc_txt_len);
18921 printf(" %d", n_txt_encoding);
18922 printf(" %d", n_format);
18923 printf("\n");
18924 }
18925 }
18926 }
18927 }
18928 }
18929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018930 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018931#endif
18932
Daniel Veillard42595322004-11-08 10:52:06 +000018933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018934}
18935
18936
18937static int
18938test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018940
William M. Brack21e4ef22005-01-02 09:53:13 +000018941#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018942 int mem_base;
18943 xmlDocPtr cur; /* the document */
18944 int n_cur;
18945 xmlChar ** mem; /* OUT: the memory pointer */
18946 int n_mem;
18947 int * size; /* OUT: the memory length */
18948 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018949
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018950 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18951 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18952 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18953 mem_base = xmlMemBlocks();
18954 cur = gen_xmlDocPtr(n_cur, 0);
18955 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18956 size = gen_int_ptr(n_size, 2);
18957
18958 xmlDocDumpMemory(cur, mem, size);
18959 call_tests++;
18960 des_xmlDocPtr(n_cur, cur, 0);
18961 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18962 des_int_ptr(n_size, size, 2);
18963 xmlResetLastError();
18964 if (mem_base != xmlMemBlocks()) {
18965 printf("Leak of %d blocks found in xmlDocDumpMemory",
18966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018967 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018968 printf(" %d", n_cur);
18969 printf(" %d", n_mem);
18970 printf(" %d", n_size);
18971 printf("\n");
18972 }
18973 }
18974 }
18975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018976 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018977#endif
18978
Daniel Veillard42595322004-11-08 10:52:06 +000018979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018980}
18981
18982
18983static int
18984test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018986
William M. Brack21e4ef22005-01-02 09:53:13 +000018987#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018988 int mem_base;
18989 xmlDocPtr out_doc; /* Document to generate XML text from */
18990 int n_out_doc;
18991 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18992 int n_doc_txt_ptr;
18993 int * doc_txt_len; /* Length of the generated XML text */
18994 int n_doc_txt_len;
18995 char * txt_encoding; /* Character encoding to use when generating XML text */
18996 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018997
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018998 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18999 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19000 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19001 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19002 mem_base = xmlMemBlocks();
19003 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19004 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19005 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19006 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19007
William M. Brackf13f77f2004-11-12 16:03:48 +000019008 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019009 call_tests++;
19010 des_xmlDocPtr(n_out_doc, out_doc, 0);
19011 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19012 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019013 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019014 xmlResetLastError();
19015 if (mem_base != xmlMemBlocks()) {
19016 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019018 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019019 printf(" %d", n_out_doc);
19020 printf(" %d", n_doc_txt_ptr);
19021 printf(" %d", n_doc_txt_len);
19022 printf(" %d", n_txt_encoding);
19023 printf("\n");
19024 }
19025 }
19026 }
19027 }
19028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019029 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019030#endif
19031
Daniel Veillard42595322004-11-08 10:52:06 +000019032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019033}
19034
19035
19036static int
19037test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019039
William M. Brack21e4ef22005-01-02 09:53:13 +000019040#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019041 int mem_base;
19042 int ret_val;
19043 FILE * f; /* the FILE* */
19044 int n_f;
19045 xmlDocPtr cur; /* the document */
19046 int n_cur;
19047 int format; /* should formatting spaces been added */
19048 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019049
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019050 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19051 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19052 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19053 mem_base = xmlMemBlocks();
19054 f = gen_FILE_ptr(n_f, 0);
19055 cur = gen_xmlDocPtr(n_cur, 1);
19056 format = gen_int(n_format, 2);
19057
19058 ret_val = xmlDocFormatDump(f, cur, format);
19059 desret_int(ret_val);
19060 call_tests++;
19061 des_FILE_ptr(n_f, f, 0);
19062 des_xmlDocPtr(n_cur, cur, 1);
19063 des_int(n_format, format, 2);
19064 xmlResetLastError();
19065 if (mem_base != xmlMemBlocks()) {
19066 printf("Leak of %d blocks found in xmlDocFormatDump",
19067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019068 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019069 printf(" %d", n_f);
19070 printf(" %d", n_cur);
19071 printf(" %d", n_format);
19072 printf("\n");
19073 }
19074 }
19075 }
19076 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019077 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019078#endif
19079
Daniel Veillard42595322004-11-08 10:52:06 +000019080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019081}
19082
19083
19084static int
19085test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019087
19088 int mem_base;
19089 xmlNodePtr ret_val;
19090 xmlDocPtr doc; /* the document */
19091 int n_doc;
19092
19093 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019095 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019096
19097 ret_val = xmlDocGetRootElement(doc);
19098 desret_xmlNodePtr(ret_val);
19099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019100 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019101 xmlResetLastError();
19102 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019103 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019106 printf(" %d", n_doc);
19107 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019108 }
19109 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019110 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019111
Daniel Veillard42595322004-11-08 10:52:06 +000019112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019113}
19114
19115
19116static int
19117test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019119
William M. Brack21e4ef22005-01-02 09:53:13 +000019120#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019121 int mem_base;
19122 xmlNodePtr ret_val;
19123 xmlDocPtr doc; /* the document */
19124 int n_doc;
19125 xmlNodePtr root; /* the new document root element */
19126 int n_root;
19127
19128 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019129 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019131 doc = gen_xmlDocPtr(n_doc, 0);
19132 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019133
19134 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019135 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019136 desret_xmlNodePtr(ret_val);
19137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019138 des_xmlDocPtr(n_doc, doc, 0);
19139 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019140 xmlResetLastError();
19141 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019142 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019144 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019145 printf(" %d", n_doc);
19146 printf(" %d", n_root);
19147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019148 }
19149 }
19150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019151 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019152#endif
19153
Daniel Veillard42595322004-11-08 10:52:06 +000019154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019155}
19156
19157
19158static int
19159test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019161
William M. Brack21e4ef22005-01-02 09:53:13 +000019162#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019163 int mem_base;
19164 FILE * f; /* the FILE * for the output */
19165 int n_f;
19166 xmlDocPtr doc; /* the document */
19167 int n_doc;
19168 xmlNodePtr cur; /* the current node */
19169 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019171 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19173 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19174 mem_base = xmlMemBlocks();
19175 f = gen_FILE_ptr(n_f, 0);
19176 doc = gen_xmlDocPtr(n_doc, 1);
19177 cur = gen_xmlNodePtr(n_cur, 2);
19178
19179 xmlElemDump(f, doc, cur);
19180 call_tests++;
19181 des_FILE_ptr(n_f, f, 0);
19182 des_xmlDocPtr(n_doc, doc, 1);
19183 des_xmlNodePtr(n_cur, cur, 2);
19184 xmlResetLastError();
19185 if (mem_base != xmlMemBlocks()) {
19186 printf("Leak of %d blocks found in xmlElemDump",
19187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019188 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019189 printf(" %d", n_f);
19190 printf(" %d", n_doc);
19191 printf(" %d", n_cur);
19192 printf("\n");
19193 }
19194 }
19195 }
19196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019197 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019198#endif
19199
Daniel Veillard42595322004-11-08 10:52:06 +000019200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019201}
19202
19203
19204static int
19205test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019207
Daniel Veillard57b25162004-11-06 14:50:18 +000019208 int mem_base;
19209 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019210
Daniel Veillard57b25162004-11-06 14:50:18 +000019211 mem_base = xmlMemBlocks();
19212
19213 ret_val = xmlGetBufferAllocationScheme();
19214 desret_xmlBufferAllocationScheme(ret_val);
19215 call_tests++;
19216 xmlResetLastError();
19217 if (mem_base != xmlMemBlocks()) {
19218 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019220 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019221 printf("\n");
19222 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019223 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019224
Daniel Veillard42595322004-11-08 10:52:06 +000019225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019226}
19227
19228
19229static int
19230test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019232
19233 int mem_base;
19234 int ret_val;
19235
19236 mem_base = xmlMemBlocks();
19237
19238 ret_val = xmlGetCompressMode();
19239 desret_int(ret_val);
19240 call_tests++;
19241 xmlResetLastError();
19242 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019243 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019245 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019246 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019247 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019249
Daniel Veillard42595322004-11-08 10:52:06 +000019250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019251}
19252
19253
19254static int
19255test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019257
19258 int mem_base;
19259 int ret_val;
19260 xmlDocPtr doc; /* the document */
19261 int n_doc;
19262
19263 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019265 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019266
19267 ret_val = xmlGetDocCompressMode(doc);
19268 desret_int(ret_val);
19269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019270 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019271 xmlResetLastError();
19272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019273 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019276 printf(" %d", n_doc);
19277 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019278 }
19279 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019280 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019281
Daniel Veillard42595322004-11-08 10:52:06 +000019282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019283}
19284
19285
19286static int
19287test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019289
Daniel Veillard34099b42004-11-04 17:34:35 +000019290 int mem_base;
19291 xmlDtdPtr ret_val;
19292 xmlDocPtr doc; /* the document pointer */
19293 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019294
Daniel Veillard34099b42004-11-04 17:34:35 +000019295 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19296 mem_base = xmlMemBlocks();
19297 doc = gen_xmlDocPtr(n_doc, 0);
19298
19299 ret_val = xmlGetIntSubset(doc);
19300 desret_xmlDtdPtr(ret_val);
19301 call_tests++;
19302 des_xmlDocPtr(n_doc, doc, 0);
19303 xmlResetLastError();
19304 if (mem_base != xmlMemBlocks()) {
19305 printf("Leak of %d blocks found in xmlGetIntSubset",
19306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019307 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019308 printf(" %d", n_doc);
19309 printf("\n");
19310 }
19311 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019312 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019313
Daniel Veillard42595322004-11-08 10:52:06 +000019314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019315}
19316
19317
19318static int
19319test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019321
19322 int mem_base;
19323 xmlNodePtr ret_val;
19324 xmlNodePtr parent; /* the parent node */
19325 int n_parent;
19326
19327 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019329 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330
19331 ret_val = xmlGetLastChild(parent);
19332 desret_xmlNodePtr(ret_val);
19333 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019334 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019335 xmlResetLastError();
19336 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019337 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019339 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019340 printf(" %d", n_parent);
19341 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019342 }
19343 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019345
Daniel Veillard42595322004-11-08 10:52:06 +000019346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019347}
19348
19349
19350static int
19351test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019354 int mem_base;
19355 long ret_val;
19356 xmlNodePtr node; /* valid node */
19357 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019358
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019359 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19360 mem_base = xmlMemBlocks();
19361 node = gen_xmlNodePtr(n_node, 0);
19362
19363 ret_val = xmlGetLineNo(node);
19364 desret_long(ret_val);
19365 call_tests++;
19366 des_xmlNodePtr(n_node, node, 0);
19367 xmlResetLastError();
19368 if (mem_base != xmlMemBlocks()) {
19369 printf("Leak of %d blocks found in xmlGetLineNo",
19370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019371 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019372 printf(" %d", n_node);
19373 printf("\n");
19374 }
19375 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019377
Daniel Veillard42595322004-11-08 10:52:06 +000019378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019379}
19380
19381
19382static int
19383test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019385
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019386 int mem_base;
19387 xmlChar * ret_val;
19388 xmlNodePtr node; /* the node */
19389 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019390 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019391 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019392
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019393 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19394 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19395 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019396 node = gen_xmlNodePtr(n_node, 0);
19397 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019398
William M. Brackf13f77f2004-11-12 16:03:48 +000019399 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019400 desret_xmlChar_ptr(ret_val);
19401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019402 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019403 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019404 xmlResetLastError();
19405 if (mem_base != xmlMemBlocks()) {
19406 printf("Leak of %d blocks found in xmlGetNoNsProp",
19407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019408 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019409 printf(" %d", n_node);
19410 printf(" %d", n_name);
19411 printf("\n");
19412 }
19413 }
19414 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019415 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019416
Daniel Veillard42595322004-11-08 10:52:06 +000019417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418}
19419
19420
19421static int
19422test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019424
William M. Brack21e4ef22005-01-02 09:53:13 +000019425#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019426 int mem_base;
19427 xmlChar * ret_val;
19428 xmlNodePtr node; /* a node */
19429 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019430
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019431 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019433 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019434
19435 ret_val = xmlGetNodePath(node);
19436 desret_xmlChar_ptr(ret_val);
19437 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019438 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019439 xmlResetLastError();
19440 if (mem_base != xmlMemBlocks()) {
19441 printf("Leak of %d blocks found in xmlGetNodePath",
19442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019443 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019444 printf(" %d", n_node);
19445 printf("\n");
19446 }
19447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019448 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019449#endif
19450
Daniel Veillard42595322004-11-08 10:52:06 +000019451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019452}
19453
19454
19455static int
19456test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458
19459
19460 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019462}
19463
19464
19465static int
19466test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019468
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019469 int mem_base;
19470 xmlChar * ret_val;
19471 xmlNodePtr node; /* the node */
19472 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019473 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019474 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019475 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019476 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019477
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019478 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19479 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19480 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019482 node = gen_xmlNodePtr(n_node, 0);
19483 name = gen_const_xmlChar_ptr(n_name, 1);
19484 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019485
William M. Brackf13f77f2004-11-12 16:03:48 +000019486 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019487 desret_xmlChar_ptr(ret_val);
19488 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019489 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019490 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19491 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019492 xmlResetLastError();
19493 if (mem_base != xmlMemBlocks()) {
19494 printf("Leak of %d blocks found in xmlGetNsProp",
19495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019496 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019497 printf(" %d", n_node);
19498 printf(" %d", n_name);
19499 printf(" %d", n_nameSpace);
19500 printf("\n");
19501 }
19502 }
19503 }
19504 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019505 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019506
Daniel Veillard42595322004-11-08 10:52:06 +000019507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019508}
19509
19510
19511static int
19512test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019514
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019515 int mem_base;
19516 xmlChar * ret_val;
19517 xmlNodePtr node; /* the node */
19518 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019519 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019520 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019521
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019522 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19523 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019525 node = gen_xmlNodePtr(n_node, 0);
19526 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019527
William M. Brackf13f77f2004-11-12 16:03:48 +000019528 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019529 desret_xmlChar_ptr(ret_val);
19530 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019531 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019532 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019533 xmlResetLastError();
19534 if (mem_base != xmlMemBlocks()) {
19535 printf("Leak of %d blocks found in xmlGetProp",
19536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019537 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019538 printf(" %d", n_node);
19539 printf(" %d", n_name);
19540 printf("\n");
19541 }
19542 }
19543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019545
Daniel Veillard42595322004-11-08 10:52:06 +000019546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019547}
19548
19549
19550static int
19551test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019553
Daniel Veillard57b25162004-11-06 14:50:18 +000019554 int mem_base;
19555 xmlAttrPtr ret_val;
19556 xmlNodePtr node; /* the node */
19557 int n_node;
19558 xmlChar * name; /* the attribute name */
19559 int n_name;
19560 xmlChar * nameSpace; /* the URI of the namespace */
19561 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019562
Daniel Veillard57b25162004-11-06 14:50:18 +000019563 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19564 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19565 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19566 mem_base = xmlMemBlocks();
19567 node = gen_xmlNodePtr(n_node, 0);
19568 name = gen_const_xmlChar_ptr(n_name, 1);
19569 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19570
William M. Brackf13f77f2004-11-12 16:03:48 +000019571 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019572 desret_xmlAttrPtr(ret_val);
19573 call_tests++;
19574 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019575 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19576 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019577 xmlResetLastError();
19578 if (mem_base != xmlMemBlocks()) {
19579 printf("Leak of %d blocks found in xmlHasNsProp",
19580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019581 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019582 printf(" %d", n_node);
19583 printf(" %d", n_name);
19584 printf(" %d", n_nameSpace);
19585 printf("\n");
19586 }
19587 }
19588 }
19589 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019590 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019591
Daniel Veillard42595322004-11-08 10:52:06 +000019592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019593}
19594
19595
19596static int
19597test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019599
Daniel Veillard57b25162004-11-06 14:50:18 +000019600 int mem_base;
19601 xmlAttrPtr ret_val;
19602 xmlNodePtr node; /* the node */
19603 int n_node;
19604 xmlChar * name; /* the attribute name */
19605 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019606
Daniel Veillard57b25162004-11-06 14:50:18 +000019607 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19608 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19609 mem_base = xmlMemBlocks();
19610 node = gen_xmlNodePtr(n_node, 0);
19611 name = gen_const_xmlChar_ptr(n_name, 1);
19612
William M. Brackf13f77f2004-11-12 16:03:48 +000019613 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019614 desret_xmlAttrPtr(ret_val);
19615 call_tests++;
19616 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019617 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019618 xmlResetLastError();
19619 if (mem_base != xmlMemBlocks()) {
19620 printf("Leak of %d blocks found in xmlHasProp",
19621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019622 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019623 printf(" %d", n_node);
19624 printf(" %d", n_name);
19625 printf("\n");
19626 }
19627 }
19628 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019630
Daniel Veillard42595322004-11-08 10:52:06 +000019631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019632}
19633
19634
19635static int
19636test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019638
19639 int mem_base;
19640 int ret_val;
19641 xmlNodePtr node; /* the node */
19642 int n_node;
19643
19644 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019646 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019647
19648 ret_val = xmlIsBlankNode(node);
19649 desret_int(ret_val);
19650 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019651 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019652 xmlResetLastError();
19653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019654 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019657 printf(" %d", n_node);
19658 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019659 }
19660 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019662
Daniel Veillard42595322004-11-08 10:52:06 +000019663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019664}
19665
19666
19667static int
19668test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019670
19671 int mem_base;
19672 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019673 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019674 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019675 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019676 int n_publicID;
19677
19678 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19679 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019681 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19682 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683
William M. Brackf13f77f2004-11-12 16:03:48 +000019684 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019685 desret_int(ret_val);
19686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019687 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19688 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019689 xmlResetLastError();
19690 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019691 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019693 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019694 printf(" %d", n_systemID);
19695 printf(" %d", n_publicID);
19696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019697 }
19698 }
19699 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019701
Daniel Veillard42595322004-11-08 10:52:06 +000019702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019703}
19704
19705
19706static int
19707test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709
19710 int mem_base;
19711 xmlNodePtr ret_val;
19712 xmlDocPtr doc; /* the document */
19713 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019714 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019715 int n_content;
19716 int len; /* the length of the block */
19717 int n_len;
19718
19719 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19720 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19721 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019723 doc = gen_xmlDocPtr(n_doc, 0);
19724 content = gen_const_xmlChar_ptr(n_content, 1);
19725 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019726
William M. Brackf13f77f2004-11-12 16:03:48 +000019727 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728 desret_xmlNodePtr(ret_val);
19729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019730 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019731 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019732 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019733 xmlResetLastError();
19734 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019735 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019737 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019738 printf(" %d", n_doc);
19739 printf(" %d", n_content);
19740 printf(" %d", n_len);
19741 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019742 }
19743 }
19744 }
19745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019747
Daniel Veillard42595322004-11-08 10:52:06 +000019748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019749}
19750
19751
19752static int
19753test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019755
19756 int mem_base;
19757 xmlNodePtr ret_val;
19758 xmlDocPtr doc; /* the document */
19759 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019760 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019761 int n_name;
19762
19763 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19764 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019766 doc = gen_xmlDocPtr(n_doc, 0);
19767 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019768
William M. Brackf13f77f2004-11-12 16:03:48 +000019769 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019770 desret_xmlNodePtr(ret_val);
19771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019772 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019773 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019774 xmlResetLastError();
19775 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019776 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019778 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019779 printf(" %d", n_doc);
19780 printf(" %d", n_name);
19781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019782 }
19783 }
19784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019786
Daniel Veillard42595322004-11-08 10:52:06 +000019787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019788}
19789
19790
19791static int
19792test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019794
William M. Brack21e4ef22005-01-02 09:53:13 +000019795#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019796#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019797 int mem_base;
19798 xmlNodePtr ret_val;
19799 xmlNodePtr parent; /* the parent node */
19800 int n_parent;
19801 xmlNsPtr ns; /* a namespace if any */
19802 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019803 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019804 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019805 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019806 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019807
Daniel Veillard27f20102004-11-05 11:50:11 +000019808 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19809 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19810 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19811 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19812 mem_base = xmlMemBlocks();
19813 parent = gen_xmlNodePtr(n_parent, 0);
19814 ns = gen_xmlNsPtr(n_ns, 1);
19815 name = gen_const_xmlChar_ptr(n_name, 2);
19816 content = gen_const_xmlChar_ptr(n_content, 3);
19817
William M. Brackf13f77f2004-11-12 16:03:48 +000019818 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019819 desret_xmlNodePtr(ret_val);
19820 call_tests++;
19821 des_xmlNodePtr(n_parent, parent, 0);
19822 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019823 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19824 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019825 xmlResetLastError();
19826 if (mem_base != xmlMemBlocks()) {
19827 printf("Leak of %d blocks found in xmlNewChild",
19828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019829 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019830 printf(" %d", n_parent);
19831 printf(" %d", n_ns);
19832 printf(" %d", n_name);
19833 printf(" %d", n_content);
19834 printf("\n");
19835 }
19836 }
19837 }
19838 }
19839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019840 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019841#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019842#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019843
Daniel Veillard42595322004-11-08 10:52:06 +000019844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019845}
19846
19847
19848static int
19849test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019851
19852 int mem_base;
19853 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019854 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855 int n_content;
19856
19857 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019859 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019860
William M. Brackf13f77f2004-11-12 16:03:48 +000019861 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019862 desret_xmlNodePtr(ret_val);
19863 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019864 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019865 xmlResetLastError();
19866 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019867 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019869 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019870 printf(" %d", n_content);
19871 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019872 }
19873 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019874 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019875
Daniel Veillard42595322004-11-08 10:52:06 +000019876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019877}
19878
19879
19880static int
19881test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019883
19884 int mem_base;
19885 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019886 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019887 int n_version;
19888
19889 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019891 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019892
William M. Brackf13f77f2004-11-12 16:03:48 +000019893 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019894 desret_xmlDocPtr(ret_val);
19895 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019896 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019897 xmlResetLastError();
19898 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019899 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019901 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019902 printf(" %d", n_version);
19903 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019904 }
19905 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019906 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019907
Daniel Veillard42595322004-11-08 10:52:06 +000019908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019909}
19910
19911
19912static int
19913test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019915
19916 int mem_base;
19917 xmlNodePtr ret_val;
19918 xmlDocPtr doc; /* the document */
19919 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019920 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921 int n_content;
19922
19923 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19924 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019926 doc = gen_xmlDocPtr(n_doc, 0);
19927 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019928
William M. Brackf13f77f2004-11-12 16:03:48 +000019929 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 desret_xmlNodePtr(ret_val);
19931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019932 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019933 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019934 xmlResetLastError();
19935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019936 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019939 printf(" %d", n_doc);
19940 printf(" %d", n_content);
19941 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019942 }
19943 }
19944 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019945 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019946
Daniel Veillard42595322004-11-08 10:52:06 +000019947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019948}
19949
19950
19951static int
19952test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954
William M. Brack21e4ef22005-01-02 09:53:13 +000019955#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019956 int mem_base;
19957 xmlNodePtr ret_val;
19958 xmlDocPtr doc; /* the document owning the fragment */
19959 int n_doc;
19960
19961 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019963 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019964
19965 ret_val = xmlNewDocFragment(doc);
19966 desret_xmlNodePtr(ret_val);
19967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019968 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019969 xmlResetLastError();
19970 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019971 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019973 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019974 printf(" %d", n_doc);
19975 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019976 }
19977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019978 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019979#endif
19980
Daniel Veillard42595322004-11-08 10:52:06 +000019981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019982}
19983
19984
19985static int
19986test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019988
Daniel Veillard27f20102004-11-05 11:50:11 +000019989 int mem_base;
19990 xmlNodePtr ret_val;
19991 xmlDocPtr doc; /* the document */
19992 int n_doc;
19993 xmlNsPtr ns; /* namespace if any */
19994 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019995 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019996 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019997 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019998 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019999
Daniel Veillard27f20102004-11-05 11:50:11 +000020000 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20001 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20002 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20003 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20004 mem_base = xmlMemBlocks();
20005 doc = gen_xmlDocPtr(n_doc, 0);
20006 ns = gen_xmlNsPtr(n_ns, 1);
20007 name = gen_const_xmlChar_ptr(n_name, 2);
20008 content = gen_const_xmlChar_ptr(n_content, 3);
20009
William M. Brackf13f77f2004-11-12 16:03:48 +000020010 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020011 desret_xmlNodePtr(ret_val);
20012 call_tests++;
20013 des_xmlDocPtr(n_doc, doc, 0);
20014 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020015 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20016 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020017 xmlResetLastError();
20018 if (mem_base != xmlMemBlocks()) {
20019 printf("Leak of %d blocks found in xmlNewDocNode",
20020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020021 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020022 printf(" %d", n_doc);
20023 printf(" %d", n_ns);
20024 printf(" %d", n_name);
20025 printf(" %d", n_content);
20026 printf("\n");
20027 }
20028 }
20029 }
20030 }
20031 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020033
Daniel Veillard42595322004-11-08 10:52:06 +000020034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020035}
20036
20037
20038static int
20039test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020041
Daniel Veillard27f20102004-11-05 11:50:11 +000020042 int mem_base;
20043 xmlNodePtr ret_val;
20044 xmlDocPtr doc; /* the document */
20045 int n_doc;
20046 xmlNsPtr ns; /* namespace if any */
20047 int n_ns;
20048 xmlChar * name; /* the node name */
20049 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020050 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020051 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020052
Daniel Veillard27f20102004-11-05 11:50:11 +000020053 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20054 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20055 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20056 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20057 mem_base = xmlMemBlocks();
20058 doc = gen_xmlDocPtr(n_doc, 0);
20059 ns = gen_xmlNsPtr(n_ns, 1);
20060 name = gen_eaten_name(n_name, 2);
20061 content = gen_const_xmlChar_ptr(n_content, 3);
20062
William M. Brackf13f77f2004-11-12 16:03:48 +000020063 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020064 desret_xmlNodePtr(ret_val);
20065 call_tests++;
20066 des_xmlDocPtr(n_doc, doc, 0);
20067 des_xmlNsPtr(n_ns, ns, 1);
20068 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020069 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020070 xmlResetLastError();
20071 if (mem_base != xmlMemBlocks()) {
20072 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020074 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020075 printf(" %d", n_doc);
20076 printf(" %d", n_ns);
20077 printf(" %d", n_name);
20078 printf(" %d", n_content);
20079 printf("\n");
20080 }
20081 }
20082 }
20083 }
20084 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020085 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020086
Daniel Veillard42595322004-11-08 10:52:06 +000020087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020088}
20089
20090
20091static int
20092test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020094
20095 int mem_base;
20096 xmlNodePtr ret_val;
20097 xmlDocPtr doc; /* the target document */
20098 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020099 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020101 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020102 int n_content;
20103
20104 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20105 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20106 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020108 doc = gen_xmlDocPtr(n_doc, 0);
20109 name = gen_const_xmlChar_ptr(n_name, 1);
20110 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111
William M. Brackf13f77f2004-11-12 16:03:48 +000020112 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020113 desret_xmlNodePtr(ret_val);
20114 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020115 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020116 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20117 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020118 xmlResetLastError();
20119 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020120 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020122 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020123 printf(" %d", n_doc);
20124 printf(" %d", n_name);
20125 printf(" %d", n_content);
20126 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020127 }
20128 }
20129 }
20130 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020131 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020132
Daniel Veillard42595322004-11-08 10:52:06 +000020133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020134}
20135
20136
20137static int
20138test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020140
Daniel Veillard57b25162004-11-06 14:50:18 +000020141 int mem_base;
20142 xmlAttrPtr ret_val;
20143 xmlDocPtr doc; /* the document */
20144 int n_doc;
20145 xmlChar * name; /* the name of the attribute */
20146 int n_name;
20147 xmlChar * value; /* the value of the attribute */
20148 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020149
Daniel Veillard57b25162004-11-06 14:50:18 +000020150 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20151 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20152 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20153 mem_base = xmlMemBlocks();
20154 doc = gen_xmlDocPtr(n_doc, 0);
20155 name = gen_const_xmlChar_ptr(n_name, 1);
20156 value = gen_const_xmlChar_ptr(n_value, 2);
20157
William M. Brackf13f77f2004-11-12 16:03:48 +000020158 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020159 desret_xmlAttrPtr(ret_val);
20160 call_tests++;
20161 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020162 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20163 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020164 xmlResetLastError();
20165 if (mem_base != xmlMemBlocks()) {
20166 printf("Leak of %d blocks found in xmlNewDocProp",
20167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020168 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020169 printf(" %d", n_doc);
20170 printf(" %d", n_name);
20171 printf(" %d", n_value);
20172 printf("\n");
20173 }
20174 }
20175 }
20176 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020178
Daniel Veillard42595322004-11-08 10:52:06 +000020179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020180}
20181
20182
20183static int
20184test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020186
William M. Brack21e4ef22005-01-02 09:53:13 +000020187#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020188#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020189 int mem_base;
20190 xmlNodePtr ret_val;
20191 xmlDocPtr doc; /* the document */
20192 int n_doc;
20193 xmlNsPtr ns; /* namespace if any */
20194 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020195 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020196 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020197 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020198 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020199
Daniel Veillard27f20102004-11-05 11:50:11 +000020200 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20201 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20203 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20204 mem_base = xmlMemBlocks();
20205 doc = gen_xmlDocPtr(n_doc, 0);
20206 ns = gen_xmlNsPtr(n_ns, 1);
20207 name = gen_const_xmlChar_ptr(n_name, 2);
20208 content = gen_const_xmlChar_ptr(n_content, 3);
20209
William M. Brackf13f77f2004-11-12 16:03:48 +000020210 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020211 desret_xmlNodePtr(ret_val);
20212 call_tests++;
20213 des_xmlDocPtr(n_doc, doc, 0);
20214 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020215 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20216 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020217 xmlResetLastError();
20218 if (mem_base != xmlMemBlocks()) {
20219 printf("Leak of %d blocks found in xmlNewDocRawNode",
20220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020221 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020222 printf(" %d", n_doc);
20223 printf(" %d", n_ns);
20224 printf(" %d", n_name);
20225 printf(" %d", n_content);
20226 printf("\n");
20227 }
20228 }
20229 }
20230 }
20231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020232 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020233#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020234#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020235
Daniel Veillard42595322004-11-08 10:52:06 +000020236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237}
20238
20239
20240static int
20241test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020243
20244 int mem_base;
20245 xmlNodePtr ret_val;
20246 xmlDocPtr doc; /* the document */
20247 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020248 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020249 int n_content;
20250
20251 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20252 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20253 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020254 doc = gen_xmlDocPtr(n_doc, 0);
20255 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256
William M. Brackf13f77f2004-11-12 16:03:48 +000020257 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020258 desret_xmlNodePtr(ret_val);
20259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020260 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020261 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020262 xmlResetLastError();
20263 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020264 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020267 printf(" %d", n_doc);
20268 printf(" %d", n_content);
20269 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020270 }
20271 }
20272 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020274
Daniel Veillard42595322004-11-08 10:52:06 +000020275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020276}
20277
20278
20279static int
20280test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020282
20283 int mem_base;
20284 xmlNodePtr ret_val;
20285 xmlDocPtr doc; /* the document */
20286 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020287 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020288 int n_content;
20289 int len; /* the text len. */
20290 int n_len;
20291
20292 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20293 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20294 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20295 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020296 doc = gen_xmlDocPtr(n_doc, 0);
20297 content = gen_const_xmlChar_ptr(n_content, 1);
20298 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020299
William M. Brackf13f77f2004-11-12 16:03:48 +000020300 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020301 desret_xmlNodePtr(ret_val);
20302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020303 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020304 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020305 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020306 xmlResetLastError();
20307 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020308 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020310 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020311 printf(" %d", n_doc);
20312 printf(" %d", n_content);
20313 printf(" %d", n_len);
20314 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020315 }
20316 }
20317 }
20318 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020319 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020320
Daniel Veillard42595322004-11-08 10:52:06 +000020321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020322}
20323
20324
20325static int
20326test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020328
Daniel Veillard34099b42004-11-04 17:34:35 +000020329 int mem_base;
20330 xmlDtdPtr ret_val;
20331 xmlDocPtr doc; /* the document pointer */
20332 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020333 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020334 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020335 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020336 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020337 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020338 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020339
Daniel Veillard34099b42004-11-04 17:34:35 +000020340 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20341 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20342 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20343 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20344 mem_base = xmlMemBlocks();
20345 doc = gen_xmlDocPtr(n_doc, 0);
20346 name = gen_const_xmlChar_ptr(n_name, 1);
20347 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20348 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20349
William M. Brackf13f77f2004-11-12 16:03:48 +000020350 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020351 desret_xmlDtdPtr(ret_val);
20352 call_tests++;
20353 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020354 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20355 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20356 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020357 xmlResetLastError();
20358 if (mem_base != xmlMemBlocks()) {
20359 printf("Leak of %d blocks found in xmlNewDtd",
20360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020361 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020362 printf(" %d", n_doc);
20363 printf(" %d", n_name);
20364 printf(" %d", n_ExternalID);
20365 printf(" %d", n_SystemID);
20366 printf("\n");
20367 }
20368 }
20369 }
20370 }
20371 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020372 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020373
Daniel Veillard42595322004-11-08 10:52:06 +000020374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020375}
20376
20377
20378static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020379test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020381
Daniel Veillard27f20102004-11-05 11:50:11 +000020382 int mem_base;
20383 xmlNodePtr ret_val;
20384 xmlNsPtr ns; /* namespace if any */
20385 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020386 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020387 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020388
Daniel Veillard27f20102004-11-05 11:50:11 +000020389 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20391 mem_base = xmlMemBlocks();
20392 ns = gen_xmlNsPtr(n_ns, 0);
20393 name = gen_const_xmlChar_ptr(n_name, 1);
20394
William M. Brackf13f77f2004-11-12 16:03:48 +000020395 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020396 desret_xmlNodePtr(ret_val);
20397 call_tests++;
20398 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020400 xmlResetLastError();
20401 if (mem_base != xmlMemBlocks()) {
20402 printf("Leak of %d blocks found in xmlNewNode",
20403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020404 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020405 printf(" %d", n_ns);
20406 printf(" %d", n_name);
20407 printf("\n");
20408 }
20409 }
20410 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020412
Daniel Veillard42595322004-11-08 10:52:06 +000020413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020414}
20415
20416
20417static int
20418test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020420
Daniel Veillard27f20102004-11-05 11:50:11 +000020421 int mem_base;
20422 xmlNodePtr ret_val;
20423 xmlNsPtr ns; /* namespace if any */
20424 int n_ns;
20425 xmlChar * name; /* the node name */
20426 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020427
Daniel Veillard27f20102004-11-05 11:50:11 +000020428 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20429 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20430 mem_base = xmlMemBlocks();
20431 ns = gen_xmlNsPtr(n_ns, 0);
20432 name = gen_eaten_name(n_name, 1);
20433
20434 ret_val = xmlNewNodeEatName(ns, name);
20435 desret_xmlNodePtr(ret_val);
20436 call_tests++;
20437 des_xmlNsPtr(n_ns, ns, 0);
20438 des_eaten_name(n_name, name, 1);
20439 xmlResetLastError();
20440 if (mem_base != xmlMemBlocks()) {
20441 printf("Leak of %d blocks found in xmlNewNodeEatName",
20442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020443 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020444 printf(" %d", n_ns);
20445 printf(" %d", n_name);
20446 printf("\n");
20447 }
20448 }
20449 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020451
Daniel Veillard42595322004-11-08 10:52:06 +000020452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020453}
20454
20455
20456static int
20457test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020459
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020460 int mem_base;
20461 xmlNsPtr ret_val;
20462 xmlNodePtr node; /* the element carrying the namespace */
20463 int n_node;
20464 xmlChar * href; /* the URI associated */
20465 int n_href;
20466 xmlChar * prefix; /* the prefix for the namespace */
20467 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020468
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020469 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20470 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20471 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20472 mem_base = xmlMemBlocks();
20473 node = gen_xmlNodePtr(n_node, 0);
20474 href = gen_const_xmlChar_ptr(n_href, 1);
20475 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20476
William M. Brackf13f77f2004-11-12 16:03:48 +000020477 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020478 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20479 desret_xmlNsPtr(ret_val);
20480 call_tests++;
20481 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020482 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20483 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020484 xmlResetLastError();
20485 if (mem_base != xmlMemBlocks()) {
20486 printf("Leak of %d blocks found in xmlNewNs",
20487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020488 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020489 printf(" %d", n_node);
20490 printf(" %d", n_href);
20491 printf(" %d", n_prefix);
20492 printf("\n");
20493 }
20494 }
20495 }
20496 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020497 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020498
Daniel Veillard42595322004-11-08 10:52:06 +000020499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020500}
20501
20502
20503static int
20504test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020506
Daniel Veillard57b25162004-11-06 14:50:18 +000020507 int mem_base;
20508 xmlAttrPtr ret_val;
20509 xmlNodePtr node; /* the holding node */
20510 int n_node;
20511 xmlNsPtr ns; /* the namespace */
20512 int n_ns;
20513 xmlChar * name; /* the name of the attribute */
20514 int n_name;
20515 xmlChar * value; /* the value of the attribute */
20516 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020517
Daniel Veillard57b25162004-11-06 14:50:18 +000020518 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20519 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20520 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20521 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20522 mem_base = xmlMemBlocks();
20523 node = gen_xmlNodePtr(n_node, 0);
20524 ns = gen_xmlNsPtr(n_ns, 1);
20525 name = gen_const_xmlChar_ptr(n_name, 2);
20526 value = gen_const_xmlChar_ptr(n_value, 3);
20527
William M. Brackf13f77f2004-11-12 16:03:48 +000020528 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020529 desret_xmlAttrPtr(ret_val);
20530 call_tests++;
20531 des_xmlNodePtr(n_node, node, 0);
20532 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020533 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20534 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020535 xmlResetLastError();
20536 if (mem_base != xmlMemBlocks()) {
20537 printf("Leak of %d blocks found in xmlNewNsProp",
20538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020539 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020540 printf(" %d", n_node);
20541 printf(" %d", n_ns);
20542 printf(" %d", n_name);
20543 printf(" %d", n_value);
20544 printf("\n");
20545 }
20546 }
20547 }
20548 }
20549 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020551
Daniel Veillard42595322004-11-08 10:52:06 +000020552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020553}
20554
20555
20556static int
20557test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020559
Daniel Veillard57b25162004-11-06 14:50:18 +000020560 int mem_base;
20561 xmlAttrPtr ret_val;
20562 xmlNodePtr node; /* the holding node */
20563 int n_node;
20564 xmlNsPtr ns; /* the namespace */
20565 int n_ns;
20566 xmlChar * name; /* the name of the attribute */
20567 int n_name;
20568 xmlChar * value; /* the value of the attribute */
20569 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020570
Daniel Veillard57b25162004-11-06 14:50:18 +000020571 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20572 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20573 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20574 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20575 mem_base = xmlMemBlocks();
20576 node = gen_xmlNodePtr(n_node, 0);
20577 ns = gen_xmlNsPtr(n_ns, 1);
20578 name = gen_eaten_name(n_name, 2);
20579 value = gen_const_xmlChar_ptr(n_value, 3);
20580
William M. Brackf13f77f2004-11-12 16:03:48 +000020581 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020582 desret_xmlAttrPtr(ret_val);
20583 call_tests++;
20584 des_xmlNodePtr(n_node, node, 0);
20585 des_xmlNsPtr(n_ns, ns, 1);
20586 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020587 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020588 xmlResetLastError();
20589 if (mem_base != xmlMemBlocks()) {
20590 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020592 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020593 printf(" %d", n_node);
20594 printf(" %d", n_ns);
20595 printf(" %d", n_name);
20596 printf(" %d", n_value);
20597 printf("\n");
20598 }
20599 }
20600 }
20601 }
20602 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020603 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020604
Daniel Veillard42595322004-11-08 10:52:06 +000020605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020606}
20607
20608
20609static int
20610test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020612
20613 int mem_base;
20614 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020615 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020616 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020617 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020618 int n_content;
20619
20620 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20621 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20622 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020623 name = gen_const_xmlChar_ptr(n_name, 0);
20624 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020625
William M. Brackf13f77f2004-11-12 16:03:48 +000020626 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020627 desret_xmlNodePtr(ret_val);
20628 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020629 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20630 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020631 xmlResetLastError();
20632 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020633 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020635 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020636 printf(" %d", n_name);
20637 printf(" %d", n_content);
20638 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020639 }
20640 }
20641 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020643
Daniel Veillard42595322004-11-08 10:52:06 +000020644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020645}
20646
20647
20648static int
20649test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020651
William M. Brack21e4ef22005-01-02 09:53:13 +000020652#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020653#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020654 int mem_base;
20655 xmlAttrPtr ret_val;
20656 xmlNodePtr node; /* the holding node */
20657 int n_node;
20658 xmlChar * name; /* the name of the attribute */
20659 int n_name;
20660 xmlChar * value; /* the value of the attribute */
20661 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020662
Daniel Veillard57b25162004-11-06 14:50:18 +000020663 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20664 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20665 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20666 mem_base = xmlMemBlocks();
20667 node = gen_xmlNodePtr(n_node, 0);
20668 name = gen_const_xmlChar_ptr(n_name, 1);
20669 value = gen_const_xmlChar_ptr(n_value, 2);
20670
William M. Brackf13f77f2004-11-12 16:03:48 +000020671 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020672 desret_xmlAttrPtr(ret_val);
20673 call_tests++;
20674 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020675 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20676 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020677 xmlResetLastError();
20678 if (mem_base != xmlMemBlocks()) {
20679 printf("Leak of %d blocks found in xmlNewProp",
20680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020681 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020682 printf(" %d", n_node);
20683 printf(" %d", n_name);
20684 printf(" %d", n_value);
20685 printf("\n");
20686 }
20687 }
20688 }
20689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020690 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020691#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020692#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020693
Daniel Veillard42595322004-11-08 10:52:06 +000020694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020695}
20696
20697
20698static int
20699test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020701
20702 int mem_base;
20703 xmlNodePtr ret_val;
20704 xmlDocPtr doc; /* the document */
20705 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020706 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020707 int n_name;
20708
20709 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20710 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020712 doc = gen_xmlDocPtr(n_doc, 0);
20713 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020714
William M. Brackf13f77f2004-11-12 16:03:48 +000020715 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020716 desret_xmlNodePtr(ret_val);
20717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020718 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020719 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020720 xmlResetLastError();
20721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020722 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020725 printf(" %d", n_doc);
20726 printf(" %d", n_name);
20727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020728 }
20729 }
20730 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020731 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020732
Daniel Veillard42595322004-11-08 10:52:06 +000020733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020734}
20735
20736
20737static int
20738test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020740
20741 int mem_base;
20742 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020743 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020744 int n_content;
20745
20746 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20747 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020748 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020749
William M. Brackf13f77f2004-11-12 16:03:48 +000020750 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020751 desret_xmlNodePtr(ret_val);
20752 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020753 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020754 xmlResetLastError();
20755 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020756 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020758 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020759 printf(" %d", n_content);
20760 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020761 }
20762 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020764
Daniel Veillard42595322004-11-08 10:52:06 +000020765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020766}
20767
20768
20769static int
20770test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020772
William M. Brack21e4ef22005-01-02 09:53:13 +000020773#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020774#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020775 int mem_base;
20776 xmlNodePtr ret_val;
20777 xmlNodePtr parent; /* the parent node */
20778 int n_parent;
20779 xmlNsPtr ns; /* a namespace if any */
20780 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020781 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020782 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020783 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020784 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020785
Daniel Veillard27f20102004-11-05 11:50:11 +000020786 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20787 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20788 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20789 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20790 mem_base = xmlMemBlocks();
20791 parent = gen_xmlNodePtr(n_parent, 0);
20792 ns = gen_xmlNsPtr(n_ns, 1);
20793 name = gen_const_xmlChar_ptr(n_name, 2);
20794 content = gen_const_xmlChar_ptr(n_content, 3);
20795
William M. Brackf13f77f2004-11-12 16:03:48 +000020796 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020797 desret_xmlNodePtr(ret_val);
20798 call_tests++;
20799 des_xmlNodePtr(n_parent, parent, 0);
20800 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020801 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20802 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020803 xmlResetLastError();
20804 if (mem_base != xmlMemBlocks()) {
20805 printf("Leak of %d blocks found in xmlNewTextChild",
20806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020807 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020808 printf(" %d", n_parent);
20809 printf(" %d", n_ns);
20810 printf(" %d", n_name);
20811 printf(" %d", n_content);
20812 printf("\n");
20813 }
20814 }
20815 }
20816 }
20817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020818 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020819#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020820#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020821
Daniel Veillard42595322004-11-08 10:52:06 +000020822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020823}
20824
20825
20826static int
20827test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020829
20830 int mem_base;
20831 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020832 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020833 int n_content;
20834 int len; /* the text len. */
20835 int n_len;
20836
20837 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20838 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20839 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020840 content = gen_const_xmlChar_ptr(n_content, 0);
20841 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020842
William M. Brackf13f77f2004-11-12 16:03:48 +000020843 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020844 desret_xmlNodePtr(ret_val);
20845 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020846 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020847 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020848 xmlResetLastError();
20849 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020850 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020852 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020853 printf(" %d", n_content);
20854 printf(" %d", n_len);
20855 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020856 }
20857 }
20858 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020859 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020860
Daniel Veillard42595322004-11-08 10:52:06 +000020861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020862}
20863
20864
20865static int
20866test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020868
20869 int mem_base;
20870 xmlNodePtr cur; /* the node being modified */
20871 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020872 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020873 int n_content;
20874
20875 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20876 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020878 cur = gen_xmlNodePtr(n_cur, 0);
20879 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880
William M. Brackf13f77f2004-11-12 16:03:48 +000020881 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020883 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020884 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020885 xmlResetLastError();
20886 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020887 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020889 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020890 printf(" %d", n_cur);
20891 printf(" %d", n_content);
20892 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020893 }
20894 }
20895 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020897
Daniel Veillard42595322004-11-08 10:52:06 +000020898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020899}
20900
20901
20902static int
20903test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020905
20906 int mem_base;
20907 xmlNodePtr cur; /* the node being modified */
20908 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020909 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020910 int n_content;
20911 int len; /* the size of @content */
20912 int n_len;
20913
20914 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20915 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20916 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20917 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020918 cur = gen_xmlNodePtr(n_cur, 0);
20919 content = gen_const_xmlChar_ptr(n_content, 1);
20920 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020921
William M. Brackf13f77f2004-11-12 16:03:48 +000020922 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020924 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020925 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020926 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020927 xmlResetLastError();
20928 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020929 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020931 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020932 printf(" %d", n_cur);
20933 printf(" %d", n_content);
20934 printf(" %d", n_len);
20935 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020936 }
20937 }
20938 }
20939 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020940 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020941
Daniel Veillard42595322004-11-08 10:52:06 +000020942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020943}
20944
20945
20946static int
20947test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020949
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020950 int mem_base;
20951 int ret_val;
20952 xmlBufferPtr buffer; /* a buffer */
20953 int n_buffer;
20954 xmlNodePtr cur; /* the node being read */
20955 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020956
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020957 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20958 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20959 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020960 buffer = gen_xmlBufferPtr(n_buffer, 0);
20961 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020962
20963 ret_val = xmlNodeBufGetContent(buffer, cur);
20964 desret_int(ret_val);
20965 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020966 des_xmlBufferPtr(n_buffer, buffer, 0);
20967 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020968 xmlResetLastError();
20969 if (mem_base != xmlMemBlocks()) {
20970 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020972 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020973 printf(" %d", n_buffer);
20974 printf(" %d", n_cur);
20975 printf("\n");
20976 }
20977 }
20978 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020979 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020980
Daniel Veillard42595322004-11-08 10:52:06 +000020981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020982}
20983
20984
20985static int
20986test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020988
William M. Brack21e4ef22005-01-02 09:53:13 +000020989#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020990 int mem_base;
20991 int ret_val;
20992 xmlBufferPtr buf; /* the XML buffer output */
20993 int n_buf;
20994 xmlDocPtr doc; /* the document */
20995 int n_doc;
20996 xmlNodePtr cur; /* the current node */
20997 int n_cur;
20998 int level; /* the imbrication level for indenting */
20999 int n_level;
21000 int format; /* is formatting allowed */
21001 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021003 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21004 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21005 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21006 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21007 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021009 buf = gen_xmlBufferPtr(n_buf, 0);
21010 doc = gen_xmlDocPtr(n_doc, 1);
21011 cur = gen_xmlNodePtr(n_cur, 2);
21012 level = gen_int(n_level, 3);
21013 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021014
21015 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21016 desret_int(ret_val);
21017 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021018 des_xmlBufferPtr(n_buf, buf, 0);
21019 des_xmlDocPtr(n_doc, doc, 1);
21020 des_xmlNodePtr(n_cur, cur, 2);
21021 des_int(n_level, level, 3);
21022 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021023 xmlResetLastError();
21024 if (mem_base != xmlMemBlocks()) {
21025 printf("Leak of %d blocks found in xmlNodeDump",
21026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021028 printf(" %d", n_buf);
21029 printf(" %d", n_doc);
21030 printf(" %d", n_cur);
21031 printf(" %d", n_level);
21032 printf(" %d", n_format);
21033 printf("\n");
21034 }
21035 }
21036 }
21037 }
21038 }
21039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021040 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021041#endif
21042
Daniel Veillard42595322004-11-08 10:52:06 +000021043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021044}
21045
21046
21047static int
21048test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021050
William M. Brack21e4ef22005-01-02 09:53:13 +000021051#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021052 int mem_base;
21053 xmlOutputBufferPtr buf; /* the XML buffer output */
21054 int n_buf;
21055 xmlDocPtr doc; /* the document */
21056 int n_doc;
21057 xmlNodePtr cur; /* the current node */
21058 int n_cur;
21059 int level; /* the imbrication level for indenting */
21060 int n_level;
21061 int format; /* is formatting allowed */
21062 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021063 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021064 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021065
Daniel Veillard3d97e662004-11-04 10:49:00 +000021066 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21067 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21068 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21069 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21070 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21071 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21072 mem_base = xmlMemBlocks();
21073 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21074 doc = gen_xmlDocPtr(n_doc, 1);
21075 cur = gen_xmlNodePtr(n_cur, 2);
21076 level = gen_int(n_level, 3);
21077 format = gen_int(n_format, 4);
21078 encoding = gen_const_char_ptr(n_encoding, 5);
21079
William M. Brackf13f77f2004-11-12 16:03:48 +000021080 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021081 call_tests++;
21082 des_xmlOutputBufferPtr(n_buf, buf, 0);
21083 des_xmlDocPtr(n_doc, doc, 1);
21084 des_xmlNodePtr(n_cur, cur, 2);
21085 des_int(n_level, level, 3);
21086 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021087 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021088 xmlResetLastError();
21089 if (mem_base != xmlMemBlocks()) {
21090 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021092 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021093 printf(" %d", n_buf);
21094 printf(" %d", n_doc);
21095 printf(" %d", n_cur);
21096 printf(" %d", n_level);
21097 printf(" %d", n_format);
21098 printf(" %d", n_encoding);
21099 printf("\n");
21100 }
21101 }
21102 }
21103 }
21104 }
21105 }
21106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021107 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021108#endif
21109
Daniel Veillard42595322004-11-08 10:52:06 +000021110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021111}
21112
21113
21114static int
21115test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021118 int mem_base;
21119 xmlChar * ret_val;
21120 xmlDocPtr doc; /* the document the node pertains to */
21121 int n_doc;
21122 xmlNodePtr cur; /* the node being checked */
21123 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021124
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021125 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21126 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021128 doc = gen_xmlDocPtr(n_doc, 0);
21129 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021130
21131 ret_val = xmlNodeGetBase(doc, cur);
21132 desret_xmlChar_ptr(ret_val);
21133 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021134 des_xmlDocPtr(n_doc, doc, 0);
21135 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021136 xmlResetLastError();
21137 if (mem_base != xmlMemBlocks()) {
21138 printf("Leak of %d blocks found in xmlNodeGetBase",
21139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021140 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021141 printf(" %d", n_doc);
21142 printf(" %d", n_cur);
21143 printf("\n");
21144 }
21145 }
21146 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021148
Daniel Veillard42595322004-11-08 10:52:06 +000021149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021150}
21151
21152
21153static int
21154test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021156
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021157 int mem_base;
21158 xmlChar * ret_val;
21159 xmlNodePtr cur; /* the node being read */
21160 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021161
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021162 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021164 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021165
21166 ret_val = xmlNodeGetContent(cur);
21167 desret_xmlChar_ptr(ret_val);
21168 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021169 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021170 xmlResetLastError();
21171 if (mem_base != xmlMemBlocks()) {
21172 printf("Leak of %d blocks found in xmlNodeGetContent",
21173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021174 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021175 printf(" %d", n_cur);
21176 printf("\n");
21177 }
21178 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021180
Daniel Veillard42595322004-11-08 10:52:06 +000021181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021182}
21183
21184
21185static int
21186test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021188
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021189 int mem_base;
21190 xmlChar * ret_val;
21191 xmlNodePtr cur; /* the node being checked */
21192 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021193
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021194 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021196 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021197
21198 ret_val = xmlNodeGetLang(cur);
21199 desret_xmlChar_ptr(ret_val);
21200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021201 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021202 xmlResetLastError();
21203 if (mem_base != xmlMemBlocks()) {
21204 printf("Leak of %d blocks found in xmlNodeGetLang",
21205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021206 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021207 printf(" %d", n_cur);
21208 printf("\n");
21209 }
21210 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021212
Daniel Veillard42595322004-11-08 10:52:06 +000021213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021214}
21215
21216
21217static int
21218test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021220
21221 int mem_base;
21222 int ret_val;
21223 xmlNodePtr cur; /* the node being checked */
21224 int n_cur;
21225
21226 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21227 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021228 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021229
21230 ret_val = xmlNodeGetSpacePreserve(cur);
21231 desret_int(ret_val);
21232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021233 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021234 xmlResetLastError();
21235 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021236 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021238 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021239 printf(" %d", n_cur);
21240 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021241 }
21242 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021244
Daniel Veillard42595322004-11-08 10:52:06 +000021245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021246}
21247
21248
21249static int
21250test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021252
21253 int mem_base;
21254 int ret_val;
21255 xmlNodePtr node; /* the node */
21256 int n_node;
21257
21258 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021260 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021261
21262 ret_val = xmlNodeIsText(node);
21263 desret_int(ret_val);
21264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021265 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021266 xmlResetLastError();
21267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021268 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021271 printf(" %d", n_node);
21272 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021273 }
21274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021276
Daniel Veillard42595322004-11-08 10:52:06 +000021277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021278}
21279
21280
21281static int
21282test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021284
William M. Brack21e4ef22005-01-02 09:53:13 +000021285#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021286 int mem_base;
21287 xmlChar * ret_val;
21288 xmlDocPtr doc; /* the document */
21289 int n_doc;
21290 xmlNodePtr list; /* a Node list */
21291 int n_list;
21292 int inLine; /* should we replace entity contents or show their external form */
21293 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021294
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021295 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21296 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21297 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021299 doc = gen_xmlDocPtr(n_doc, 0);
21300 list = gen_xmlNodePtr(n_list, 1);
21301 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021302
21303 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21304 desret_xmlChar_ptr(ret_val);
21305 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021306 des_xmlDocPtr(n_doc, doc, 0);
21307 des_xmlNodePtr(n_list, list, 1);
21308 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021309 xmlResetLastError();
21310 if (mem_base != xmlMemBlocks()) {
21311 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021313 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021314 printf(" %d", n_doc);
21315 printf(" %d", n_list);
21316 printf(" %d", n_inLine);
21317 printf("\n");
21318 }
21319 }
21320 }
21321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021322 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021323#endif
21324
Daniel Veillard42595322004-11-08 10:52:06 +000021325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021326}
21327
21328
21329static int
21330test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021332
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021333 int mem_base;
21334 xmlChar * ret_val;
21335 xmlDocPtr doc; /* the document */
21336 int n_doc;
21337 xmlNodePtr list; /* a Node list */
21338 int n_list;
21339 int inLine; /* should we replace entity contents or show their external form */
21340 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021341
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021342 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21343 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21344 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021346 doc = gen_xmlDocPtr(n_doc, 0);
21347 list = gen_xmlNodePtr(n_list, 1);
21348 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021349
21350 ret_val = xmlNodeListGetString(doc, list, inLine);
21351 desret_xmlChar_ptr(ret_val);
21352 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021353 des_xmlDocPtr(n_doc, doc, 0);
21354 des_xmlNodePtr(n_list, list, 1);
21355 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021356 xmlResetLastError();
21357 if (mem_base != xmlMemBlocks()) {
21358 printf("Leak of %d blocks found in xmlNodeListGetString",
21359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021360 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021361 printf(" %d", n_doc);
21362 printf(" %d", n_list);
21363 printf(" %d", n_inLine);
21364 printf("\n");
21365 }
21366 }
21367 }
21368 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021369 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021370
Daniel Veillard42595322004-11-08 10:52:06 +000021371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021372}
21373
21374
21375static int
21376test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021378
William M. Brack21e4ef22005-01-02 09:53:13 +000021379#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021380 int mem_base;
21381 xmlNodePtr cur; /* the node being changed */
21382 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021383 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021384 int n_uri;
21385
21386 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21387 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021389 cur = gen_xmlNodePtr(n_cur, 0);
21390 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391
William M. Brackf13f77f2004-11-12 16:03:48 +000021392 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021394 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021395 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021396 xmlResetLastError();
21397 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021398 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021400 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021401 printf(" %d", n_cur);
21402 printf(" %d", n_uri);
21403 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021404 }
21405 }
21406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021407 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021408#endif
21409
Daniel Veillard42595322004-11-08 10:52:06 +000021410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021411}
21412
21413
21414static int
21415test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021417
21418 int mem_base;
21419 xmlNodePtr cur; /* the node being modified */
21420 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021421 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021422 int n_content;
21423
21424 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21425 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021427 cur = gen_xmlNodePtr(n_cur, 0);
21428 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429
William M. Brackf13f77f2004-11-12 16:03:48 +000021430 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021432 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021433 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021434 xmlResetLastError();
21435 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021436 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021438 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021439 printf(" %d", n_cur);
21440 printf(" %d", n_content);
21441 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021442 }
21443 }
21444 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021446
Daniel Veillard42595322004-11-08 10:52:06 +000021447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021448}
21449
21450
21451static int
21452test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021454
William M. Brack21e4ef22005-01-02 09:53:13 +000021455#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021456 int mem_base;
21457 xmlNodePtr cur; /* the node being modified */
21458 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021459 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021460 int n_content;
21461 int len; /* the size of @content */
21462 int n_len;
21463
21464 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21465 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21466 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021468 cur = gen_xmlNodePtr(n_cur, 0);
21469 content = gen_const_xmlChar_ptr(n_content, 1);
21470 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021471
William M. Brackf13f77f2004-11-12 16:03:48 +000021472 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021474 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021475 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021476 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021477 xmlResetLastError();
21478 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021479 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021481 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021482 printf(" %d", n_cur);
21483 printf(" %d", n_content);
21484 printf(" %d", n_len);
21485 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021486 }
21487 }
21488 }
21489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021490 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021491#endif
21492
Daniel Veillard42595322004-11-08 10:52:06 +000021493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021494}
21495
21496
21497static int
21498test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021500
William M. Brack21e4ef22005-01-02 09:53:13 +000021501#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021502 int mem_base;
21503 xmlNodePtr cur; /* the node being changed */
21504 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021505 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021506 int n_lang;
21507
21508 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21509 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21510 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021511 cur = gen_xmlNodePtr(n_cur, 0);
21512 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513
William M. Brackf13f77f2004-11-12 16:03:48 +000021514 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021516 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021517 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021518 xmlResetLastError();
21519 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021520 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021522 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021523 printf(" %d", n_cur);
21524 printf(" %d", n_lang);
21525 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021526 }
21527 }
21528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021529 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021530#endif
21531
Daniel Veillard42595322004-11-08 10:52:06 +000021532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533}
21534
21535
21536static int
21537test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539
William M. Brack21e4ef22005-01-02 09:53:13 +000021540#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021541 int mem_base;
21542 xmlNodePtr cur; /* the node being changed */
21543 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021544 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021545 int n_name;
21546
21547 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21548 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21549 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021550 cur = gen_xmlNodePtr(n_cur, 0);
21551 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552
William M. Brackf13f77f2004-11-12 16:03:48 +000021553 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021555 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021556 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021557 xmlResetLastError();
21558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021559 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021562 printf(" %d", n_cur);
21563 printf(" %d", n_name);
21564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565 }
21566 }
21567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021568 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021569#endif
21570
Daniel Veillard42595322004-11-08 10:52:06 +000021571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021572}
21573
21574
21575static int
21576test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578
William M. Brack21e4ef22005-01-02 09:53:13 +000021579#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021580 int mem_base;
21581 xmlNodePtr cur; /* the node being changed */
21582 int n_cur;
21583 int val; /* the xml:space value ("0": default, 1: "preserve") */
21584 int n_val;
21585
21586 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21587 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21588 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021589 cur = gen_xmlNodePtr(n_cur, 0);
21590 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591
21592 xmlNodeSetSpacePreserve(cur, val);
21593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021594 des_xmlNodePtr(n_cur, cur, 0);
21595 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021596 xmlResetLastError();
21597 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021598 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021600 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021601 printf(" %d", n_cur);
21602 printf(" %d", n_val);
21603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021604 }
21605 }
21606 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021607 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021608#endif
21609
Daniel Veillard42595322004-11-08 10:52:06 +000021610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611}
21612
21613
21614static int
21615test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021617
William M. Brack21e4ef22005-01-02 09:53:13 +000021618#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021619#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021620 int mem_base;
21621 int ret_val;
21622 xmlDocPtr doc; /* the document */
21623 int n_doc;
21624 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21625 int n_tree;
21626
21627 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21628 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021630 doc = gen_xmlDocPtr(n_doc, 0);
21631 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632
21633 ret_val = xmlReconciliateNs(doc, tree);
21634 desret_int(ret_val);
21635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021636 des_xmlDocPtr(n_doc, doc, 0);
21637 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021638 xmlResetLastError();
21639 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021640 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021642 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021643 printf(" %d", n_doc);
21644 printf(" %d", n_tree);
21645 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646 }
21647 }
21648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021649 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021650#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021651#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652
Daniel Veillard42595322004-11-08 10:52:06 +000021653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021654}
21655
21656
21657static int
21658test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021660
William M. Brack21e4ef22005-01-02 09:53:13 +000021661#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021662 int mem_base;
21663 int ret_val;
21664 xmlAttrPtr cur; /* an attribute */
21665 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021666
Daniel Veillardce244ad2004-11-05 10:03:46 +000021667 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21668 mem_base = xmlMemBlocks();
21669 cur = gen_xmlAttrPtr(n_cur, 0);
21670
21671 ret_val = xmlRemoveProp(cur);
21672 cur = NULL;
21673 desret_int(ret_val);
21674 call_tests++;
21675 des_xmlAttrPtr(n_cur, cur, 0);
21676 xmlResetLastError();
21677 if (mem_base != xmlMemBlocks()) {
21678 printf("Leak of %d blocks found in xmlRemoveProp",
21679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021680 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021681 printf(" %d", n_cur);
21682 printf("\n");
21683 }
21684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021685 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021686#endif
21687
Daniel Veillard42595322004-11-08 10:52:06 +000021688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021689}
21690
21691
21692static int
21693test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695
William M. Brack21e4ef22005-01-02 09:53:13 +000021696#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021697 int mem_base;
21698 xmlNodePtr ret_val;
21699 xmlNodePtr old; /* the old node */
21700 int n_old;
21701 xmlNodePtr cur; /* the node */
21702 int n_cur;
21703
21704 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021705 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021707 old = gen_xmlNodePtr(n_old, 0);
21708 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021709
21710 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021711 if (cur != NULL) {
21712 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021713 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021714 if (old != NULL) {
21715 xmlUnlinkNode(old);
21716 xmlFreeNode(old) ; old = NULL ; }
21717 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021718 desret_xmlNodePtr(ret_val);
21719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021720 des_xmlNodePtr(n_old, old, 0);
21721 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021722 xmlResetLastError();
21723 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021724 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021726 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021727 printf(" %d", n_old);
21728 printf(" %d", n_cur);
21729 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021730 }
21731 }
21732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021733 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734#endif
21735
Daniel Veillard42595322004-11-08 10:52:06 +000021736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021737}
21738
21739
21740static int
21741test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743
William M. Brack21e4ef22005-01-02 09:53:13 +000021744#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021745 int mem_base;
21746 int ret_val;
21747 const char * filename; /* the filename (or URL) */
21748 int n_filename;
21749 xmlDocPtr cur; /* the document */
21750 int n_cur;
21751
21752 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21753 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21754 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021755 filename = gen_fileoutput(n_filename, 0);
21756 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021757
21758 ret_val = xmlSaveFile(filename, cur);
21759 desret_int(ret_val);
21760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021761 des_fileoutput(n_filename, filename, 0);
21762 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021763 xmlResetLastError();
21764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021765 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021768 printf(" %d", n_filename);
21769 printf(" %d", n_cur);
21770 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021771 }
21772 }
21773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021774 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021775#endif
21776
Daniel Veillard42595322004-11-08 10:52:06 +000021777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021778}
21779
21780
21781static int
21782test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021784
William M. Brack21e4ef22005-01-02 09:53:13 +000021785#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021786 int mem_base;
21787 int ret_val;
21788 const char * filename; /* the filename (or URL) */
21789 int n_filename;
21790 xmlDocPtr cur; /* the document */
21791 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021792 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021793 int n_encoding;
21794
21795 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21796 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21797 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021799 filename = gen_fileoutput(n_filename, 0);
21800 cur = gen_xmlDocPtr(n_cur, 1);
21801 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021802
William M. Brackf13f77f2004-11-12 16:03:48 +000021803 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021804 desret_int(ret_val);
21805 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021806 des_fileoutput(n_filename, filename, 0);
21807 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021808 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021809 xmlResetLastError();
21810 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021811 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021813 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021814 printf(" %d", n_filename);
21815 printf(" %d", n_cur);
21816 printf(" %d", n_encoding);
21817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021818 }
21819 }
21820 }
21821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021822 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021823#endif
21824
Daniel Veillard42595322004-11-08 10:52:06 +000021825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021826}
21827
21828
21829static int
21830test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021832
William M. Brack21e4ef22005-01-02 09:53:13 +000021833#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021834 int mem_base;
21835 int ret_val;
21836 xmlOutputBufferPtr buf; /* an output I/O buffer */
21837 int n_buf;
21838 xmlDocPtr cur; /* the document */
21839 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021840 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021841 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021842
Daniel Veillard3d97e662004-11-04 10:49:00 +000021843 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21844 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21845 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21846 mem_base = xmlMemBlocks();
21847 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21848 cur = gen_xmlDocPtr(n_cur, 1);
21849 encoding = gen_const_char_ptr(n_encoding, 2);
21850
William M. Brackf13f77f2004-11-12 16:03:48 +000021851 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021852 buf = NULL;
21853 desret_int(ret_val);
21854 call_tests++;
21855 des_xmlOutputBufferPtr(n_buf, buf, 0);
21856 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021857 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021858 xmlResetLastError();
21859 if (mem_base != xmlMemBlocks()) {
21860 printf("Leak of %d blocks found in xmlSaveFileTo",
21861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021862 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021863 printf(" %d", n_buf);
21864 printf(" %d", n_cur);
21865 printf(" %d", n_encoding);
21866 printf("\n");
21867 }
21868 }
21869 }
21870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021871 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021872#endif
21873
Daniel Veillard42595322004-11-08 10:52:06 +000021874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021875}
21876
21877
21878static int
21879test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021881
William M. Brack21e4ef22005-01-02 09:53:13 +000021882#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021883 int mem_base;
21884 int ret_val;
21885 const char * filename; /* the filename (or URL) */
21886 int n_filename;
21887 xmlDocPtr cur; /* the document */
21888 int n_cur;
21889 int format; /* should formatting spaces been added */
21890 int n_format;
21891
21892 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21893 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21894 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021896 filename = gen_fileoutput(n_filename, 0);
21897 cur = gen_xmlDocPtr(n_cur, 1);
21898 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021899
21900 ret_val = xmlSaveFormatFile(filename, cur, format);
21901 desret_int(ret_val);
21902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021903 des_fileoutput(n_filename, filename, 0);
21904 des_xmlDocPtr(n_cur, cur, 1);
21905 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021906 xmlResetLastError();
21907 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021908 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021910 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021911 printf(" %d", n_filename);
21912 printf(" %d", n_cur);
21913 printf(" %d", n_format);
21914 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021915 }
21916 }
21917 }
21918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021919 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021920#endif
21921
Daniel Veillard42595322004-11-08 10:52:06 +000021922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021923}
21924
21925
21926static int
21927test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929
William M. Brack21e4ef22005-01-02 09:53:13 +000021930#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021931 int mem_base;
21932 int ret_val;
21933 const char * filename; /* the filename or URL to output */
21934 int n_filename;
21935 xmlDocPtr cur; /* the document being saved */
21936 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021937 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021938 int n_encoding;
21939 int format; /* should formatting spaces be added. */
21940 int n_format;
21941
21942 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21943 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21944 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21945 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021947 filename = gen_fileoutput(n_filename, 0);
21948 cur = gen_xmlDocPtr(n_cur, 1);
21949 encoding = gen_const_char_ptr(n_encoding, 2);
21950 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021951
William M. Brackf13f77f2004-11-12 16:03:48 +000021952 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953 desret_int(ret_val);
21954 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021955 des_fileoutput(n_filename, filename, 0);
21956 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021957 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021958 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021959 xmlResetLastError();
21960 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021961 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021963 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021964 printf(" %d", n_filename);
21965 printf(" %d", n_cur);
21966 printf(" %d", n_encoding);
21967 printf(" %d", n_format);
21968 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021969 }
21970 }
21971 }
21972 }
21973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021974 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021975#endif
21976
Daniel Veillard42595322004-11-08 10:52:06 +000021977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978}
21979
21980
21981static int
21982test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984
William M. Brack21e4ef22005-01-02 09:53:13 +000021985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021986 int mem_base;
21987 int ret_val;
21988 xmlOutputBufferPtr buf; /* an output I/O buffer */
21989 int n_buf;
21990 xmlDocPtr cur; /* the document */
21991 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021992 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021993 int n_encoding;
21994 int format; /* should formatting spaces been added */
21995 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021996
Daniel Veillard3d97e662004-11-04 10:49:00 +000021997 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21998 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21999 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22000 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22001 mem_base = xmlMemBlocks();
22002 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22003 cur = gen_xmlDocPtr(n_cur, 1);
22004 encoding = gen_const_char_ptr(n_encoding, 2);
22005 format = gen_int(n_format, 3);
22006
William M. Brackf13f77f2004-11-12 16:03:48 +000022007 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022008 buf = NULL;
22009 desret_int(ret_val);
22010 call_tests++;
22011 des_xmlOutputBufferPtr(n_buf, buf, 0);
22012 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022013 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022014 des_int(n_format, format, 3);
22015 xmlResetLastError();
22016 if (mem_base != xmlMemBlocks()) {
22017 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022019 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022020 printf(" %d", n_buf);
22021 printf(" %d", n_cur);
22022 printf(" %d", n_encoding);
22023 printf(" %d", n_format);
22024 printf("\n");
22025 }
22026 }
22027 }
22028 }
22029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022030 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022031#endif
22032
Daniel Veillard42595322004-11-08 10:52:06 +000022033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022034}
22035
22036
22037static int
22038test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022040
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022041 int mem_base;
22042 xmlNsPtr ret_val;
22043 xmlDocPtr doc; /* the document */
22044 int n_doc;
22045 xmlNodePtr node; /* the current node */
22046 int n_node;
22047 xmlChar * nameSpace; /* the namespace prefix */
22048 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022049
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022050 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22051 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22052 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22053 mem_base = xmlMemBlocks();
22054 doc = gen_xmlDocPtr(n_doc, 0);
22055 node = gen_xmlNodePtr(n_node, 1);
22056 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22057
William M. Brackf13f77f2004-11-12 16:03:48 +000022058 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022059 desret_xmlNsPtr(ret_val);
22060 call_tests++;
22061 des_xmlDocPtr(n_doc, doc, 0);
22062 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022063 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022064 xmlResetLastError();
22065 if (mem_base != xmlMemBlocks()) {
22066 printf("Leak of %d blocks found in xmlSearchNs",
22067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022068 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022069 printf(" %d", n_doc);
22070 printf(" %d", n_node);
22071 printf(" %d", n_nameSpace);
22072 printf("\n");
22073 }
22074 }
22075 }
22076 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022078
Daniel Veillard42595322004-11-08 10:52:06 +000022079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022080}
22081
22082
22083static int
22084test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022086
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022087 int mem_base;
22088 xmlNsPtr ret_val;
22089 xmlDocPtr doc; /* the document */
22090 int n_doc;
22091 xmlNodePtr node; /* the current node */
22092 int n_node;
22093 xmlChar * href; /* the namespace value */
22094 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022095
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022096 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22097 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22098 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22099 mem_base = xmlMemBlocks();
22100 doc = gen_xmlDocPtr(n_doc, 0);
22101 node = gen_xmlNodePtr(n_node, 1);
22102 href = gen_const_xmlChar_ptr(n_href, 2);
22103
William M. Brackf13f77f2004-11-12 16:03:48 +000022104 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022105 desret_xmlNsPtr(ret_val);
22106 call_tests++;
22107 des_xmlDocPtr(n_doc, doc, 0);
22108 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022109 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022110 xmlResetLastError();
22111 if (mem_base != xmlMemBlocks()) {
22112 printf("Leak of %d blocks found in xmlSearchNsByHref",
22113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022114 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022115 printf(" %d", n_doc);
22116 printf(" %d", n_node);
22117 printf(" %d", n_href);
22118 printf("\n");
22119 }
22120 }
22121 }
22122 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022123 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022124
Daniel Veillard42595322004-11-08 10:52:06 +000022125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022126}
22127
22128
22129static int
22130test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022132
Daniel Veillard57b25162004-11-06 14:50:18 +000022133 int mem_base;
22134 xmlBufferAllocationScheme scheme; /* allocation method to use */
22135 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022136
Daniel Veillard57b25162004-11-06 14:50:18 +000022137 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22138 mem_base = xmlMemBlocks();
22139 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22140
22141 xmlSetBufferAllocationScheme(scheme);
22142 call_tests++;
22143 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22144 xmlResetLastError();
22145 if (mem_base != xmlMemBlocks()) {
22146 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022148 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022149 printf(" %d", n_scheme);
22150 printf("\n");
22151 }
22152 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022153 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022154
Daniel Veillard42595322004-11-08 10:52:06 +000022155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022156}
22157
22158
22159static int
22160test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022162
22163 int mem_base;
22164 int mode; /* the compression ratio */
22165 int n_mode;
22166
22167 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022169 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022170
22171 xmlSetCompressMode(mode);
22172 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022173 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022174 xmlResetLastError();
22175 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022176 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022178 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022179 printf(" %d", n_mode);
22180 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022181 }
22182 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022183 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022184
Daniel Veillard42595322004-11-08 10:52:06 +000022185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022186}
22187
22188
22189static int
22190test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022192
22193 int mem_base;
22194 xmlDocPtr doc; /* the document */
22195 int n_doc;
22196 int mode; /* the compression ratio */
22197 int n_mode;
22198
22199 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22200 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022202 doc = gen_xmlDocPtr(n_doc, 0);
22203 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022204
22205 xmlSetDocCompressMode(doc, mode);
22206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022207 des_xmlDocPtr(n_doc, doc, 0);
22208 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022209 xmlResetLastError();
22210 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022211 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022213 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022214 printf(" %d", n_doc);
22215 printf(" %d", n_mode);
22216 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022217 }
22218 }
22219 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022220 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022221
Daniel Veillard42595322004-11-08 10:52:06 +000022222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022223}
22224
22225
22226static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022227test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022229
Daniel Veillard27f20102004-11-05 11:50:11 +000022230 int mem_base;
22231 xmlNodePtr node; /* a node in the document */
22232 int n_node;
22233 xmlNsPtr ns; /* a namespace pointer */
22234 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022235
Daniel Veillard27f20102004-11-05 11:50:11 +000022236 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22237 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22238 mem_base = xmlMemBlocks();
22239 node = gen_xmlNodePtr(n_node, 0);
22240 ns = gen_xmlNsPtr(n_ns, 1);
22241
22242 xmlSetNs(node, ns);
22243 call_tests++;
22244 des_xmlNodePtr(n_node, node, 0);
22245 des_xmlNsPtr(n_ns, ns, 1);
22246 xmlResetLastError();
22247 if (mem_base != xmlMemBlocks()) {
22248 printf("Leak of %d blocks found in xmlSetNs",
22249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022250 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022251 printf(" %d", n_node);
22252 printf(" %d", n_ns);
22253 printf("\n");
22254 }
22255 }
22256 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022257 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022258
Daniel Veillard42595322004-11-08 10:52:06 +000022259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022260}
22261
22262
22263static int
22264test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022266
William M. Brack21e4ef22005-01-02 09:53:13 +000022267#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022268 int mem_base;
22269 xmlAttrPtr ret_val;
22270 xmlNodePtr node; /* the node */
22271 int n_node;
22272 xmlNsPtr ns; /* the namespace definition */
22273 int n_ns;
22274 xmlChar * name; /* the attribute name */
22275 int n_name;
22276 xmlChar * value; /* the attribute value */
22277 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022278
Daniel Veillard57b25162004-11-06 14:50:18 +000022279 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22280 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22281 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22282 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22283 mem_base = xmlMemBlocks();
22284 node = gen_xmlNodePtr(n_node, 0);
22285 ns = gen_xmlNsPtr(n_ns, 1);
22286 name = gen_const_xmlChar_ptr(n_name, 2);
22287 value = gen_const_xmlChar_ptr(n_value, 3);
22288
William M. Brackf13f77f2004-11-12 16:03:48 +000022289 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022290 desret_xmlAttrPtr(ret_val);
22291 call_tests++;
22292 des_xmlNodePtr(n_node, node, 0);
22293 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022294 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22295 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022296 xmlResetLastError();
22297 if (mem_base != xmlMemBlocks()) {
22298 printf("Leak of %d blocks found in xmlSetNsProp",
22299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022300 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022301 printf(" %d", n_node);
22302 printf(" %d", n_ns);
22303 printf(" %d", n_name);
22304 printf(" %d", n_value);
22305 printf("\n");
22306 }
22307 }
22308 }
22309 }
22310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022311 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022312#endif
22313
Daniel Veillard42595322004-11-08 10:52:06 +000022314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022315}
22316
22317
22318static int
22319test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022321
William M. Brack21e4ef22005-01-02 09:53:13 +000022322#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022323 int mem_base;
22324 xmlAttrPtr ret_val;
22325 xmlNodePtr node; /* the node */
22326 int n_node;
22327 xmlChar * name; /* the attribute name */
22328 int n_name;
22329 xmlChar * value; /* the attribute value */
22330 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022331
Daniel Veillard57b25162004-11-06 14:50:18 +000022332 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22333 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22334 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22335 mem_base = xmlMemBlocks();
22336 node = gen_xmlNodePtr(n_node, 0);
22337 name = gen_const_xmlChar_ptr(n_name, 1);
22338 value = gen_const_xmlChar_ptr(n_value, 2);
22339
William M. Brackf13f77f2004-11-12 16:03:48 +000022340 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022341 desret_xmlAttrPtr(ret_val);
22342 call_tests++;
22343 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022344 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22345 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022346 xmlResetLastError();
22347 if (mem_base != xmlMemBlocks()) {
22348 printf("Leak of %d blocks found in xmlSetProp",
22349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022350 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022351 printf(" %d", n_node);
22352 printf(" %d", n_name);
22353 printf(" %d", n_value);
22354 printf("\n");
22355 }
22356 }
22357 }
22358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022359 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022360#endif
22361
Daniel Veillard42595322004-11-08 10:52:06 +000022362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022363}
22364
22365
22366static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022367test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022369
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022370 int mem_base;
22371 xmlChar * ret_val;
22372 xmlChar * name; /* the full QName */
22373 int n_name;
22374 xmlChar ** prefix; /* a xmlChar ** */
22375 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022376
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022377 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22378 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22379 mem_base = xmlMemBlocks();
22380 name = gen_const_xmlChar_ptr(n_name, 0);
22381 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22382
William M. Brackf13f77f2004-11-12 16:03:48 +000022383 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022384 desret_xmlChar_ptr(ret_val);
22385 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022386 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022387 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22388 xmlResetLastError();
22389 if (mem_base != xmlMemBlocks()) {
22390 printf("Leak of %d blocks found in xmlSplitQName2",
22391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022392 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022393 printf(" %d", n_name);
22394 printf(" %d", n_prefix);
22395 printf("\n");
22396 }
22397 }
22398 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022399 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022400
Daniel Veillard42595322004-11-08 10:52:06 +000022401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022402}
22403
22404
22405static int
22406test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022408
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022409 int mem_base;
22410 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022411 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022412 int n_name;
22413 int * len; /* an int * */
22414 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022415
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022416 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22417 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22418 mem_base = xmlMemBlocks();
22419 name = gen_const_xmlChar_ptr(n_name, 0);
22420 len = gen_int_ptr(n_len, 1);
22421
William M. Brackf13f77f2004-11-12 16:03:48 +000022422 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022423 desret_const_xmlChar_ptr(ret_val);
22424 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022425 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022426 des_int_ptr(n_len, len, 1);
22427 xmlResetLastError();
22428 if (mem_base != xmlMemBlocks()) {
22429 printf("Leak of %d blocks found in xmlSplitQName3",
22430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022431 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022432 printf(" %d", n_name);
22433 printf(" %d", n_len);
22434 printf("\n");
22435 }
22436 }
22437 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022439
Daniel Veillard42595322004-11-08 10:52:06 +000022440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022441}
22442
22443
22444static int
22445test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022447
22448 int mem_base;
22449 xmlNodePtr ret_val;
22450 xmlDocPtr doc; /* the document */
22451 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022452 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022453 int n_value;
22454
22455 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22456 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22457 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022458 doc = gen_xmlDocPtr(n_doc, 0);
22459 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022460
William M. Brackf13f77f2004-11-12 16:03:48 +000022461 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022462 desret_xmlNodePtr(ret_val);
22463 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022464 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022465 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022466 xmlResetLastError();
22467 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022468 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022470 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022471 printf(" %d", n_doc);
22472 printf(" %d", n_value);
22473 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022474 }
22475 }
22476 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022477 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022478
Daniel Veillard42595322004-11-08 10:52:06 +000022479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022480}
22481
22482
22483static int
22484test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022486
22487 int mem_base;
22488 xmlNodePtr ret_val;
22489 xmlDocPtr doc; /* the document */
22490 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022491 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022492 int n_value;
22493 int len; /* the length of the string value */
22494 int n_len;
22495
22496 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22497 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22498 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22499 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022500 doc = gen_xmlDocPtr(n_doc, 0);
22501 value = gen_const_xmlChar_ptr(n_value, 1);
22502 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503
William M. Brackf13f77f2004-11-12 16:03:48 +000022504 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022505 desret_xmlNodePtr(ret_val);
22506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022507 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022508 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022509 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022510 xmlResetLastError();
22511 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022512 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022514 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022515 printf(" %d", n_doc);
22516 printf(" %d", n_value);
22517 printf(" %d", n_len);
22518 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022519 }
22520 }
22521 }
22522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022524
Daniel Veillard42595322004-11-08 10:52:06 +000022525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022526}
22527
22528
22529static int
22530test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022532
22533 int mem_base;
22534 int ret_val;
22535 xmlNodePtr node; /* the node */
22536 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022537 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538 int n_content;
22539 int len; /* @content length */
22540 int n_len;
22541
22542 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22543 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22544 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022546 node = gen_xmlNodePtr(n_node, 0);
22547 content = gen_const_xmlChar_ptr(n_content, 1);
22548 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022549
William M. Brackf13f77f2004-11-12 16:03:48 +000022550 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022551 desret_int(ret_val);
22552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022553 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022554 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022555 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022556 xmlResetLastError();
22557 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022558 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022560 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022561 printf(" %d", n_node);
22562 printf(" %d", n_content);
22563 printf(" %d", n_len);
22564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022565 }
22566 }
22567 }
22568 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022569 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022570
Daniel Veillard42595322004-11-08 10:52:06 +000022571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022572}
22573
22574
22575static int
22576test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022578
22579 int mem_base;
22580 xmlNodePtr ret_val;
22581 xmlNodePtr first; /* the first text node */
22582 int n_first;
22583 xmlNodePtr second; /* the second text node being merged */
22584 int n_second;
22585
Daniel Veillarda03e3652004-11-02 18:45:30 +000022586 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22587 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022588 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022589 first = gen_xmlNodePtr_in(n_first, 0);
22590 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022591
22592 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022593 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022594 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022595 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022596 desret_xmlNodePtr(ret_val);
22597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022598 des_xmlNodePtr_in(n_first, first, 0);
22599 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022600 xmlResetLastError();
22601 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022602 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022604 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022605 printf(" %d", n_first);
22606 printf(" %d", n_second);
22607 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022608 }
22609 }
22610 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022612
Daniel Veillard42595322004-11-08 10:52:06 +000022613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022614}
22615
22616
22617static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022618test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022620
William M. Brack21e4ef22005-01-02 09:53:13 +000022621#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022622 int mem_base;
22623 int ret_val;
22624 xmlNodePtr node; /* the node */
22625 int n_node;
22626 xmlNsPtr ns; /* the namespace definition */
22627 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022628 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022629 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022630
Daniel Veillard27f20102004-11-05 11:50:11 +000022631 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22632 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22633 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22634 mem_base = xmlMemBlocks();
22635 node = gen_xmlNodePtr(n_node, 0);
22636 ns = gen_xmlNsPtr(n_ns, 1);
22637 name = gen_const_xmlChar_ptr(n_name, 2);
22638
William M. Brackf13f77f2004-11-12 16:03:48 +000022639 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022640 desret_int(ret_val);
22641 call_tests++;
22642 des_xmlNodePtr(n_node, node, 0);
22643 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022644 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022645 xmlResetLastError();
22646 if (mem_base != xmlMemBlocks()) {
22647 printf("Leak of %d blocks found in xmlUnsetNsProp",
22648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022649 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022650 printf(" %d", n_node);
22651 printf(" %d", n_ns);
22652 printf(" %d", n_name);
22653 printf("\n");
22654 }
22655 }
22656 }
22657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022658 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022659#endif
22660
Daniel Veillard42595322004-11-08 10:52:06 +000022661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022662}
22663
22664
22665static int
22666test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022668
William M. Brack21e4ef22005-01-02 09:53:13 +000022669#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022670 int mem_base;
22671 int ret_val;
22672 xmlNodePtr node; /* the node */
22673 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022674 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022675 int n_name;
22676
22677 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22678 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22679 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022680 node = gen_xmlNodePtr(n_node, 0);
22681 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682
William M. Brackf13f77f2004-11-12 16:03:48 +000022683 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022684 desret_int(ret_val);
22685 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022686 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022687 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688 xmlResetLastError();
22689 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022690 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022692 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022693 printf(" %d", n_node);
22694 printf(" %d", n_name);
22695 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022696 }
22697 }
22698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022699 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022700#endif
22701
Daniel Veillard42595322004-11-08 10:52:06 +000022702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022703}
22704
22705
22706static int
22707test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022709
William M. Brack21e4ef22005-01-02 09:53:13 +000022710#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022711#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022712 int mem_base;
22713 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022714 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022715 int n_value;
22716 int space; /* allow spaces in front and end of the string */
22717 int n_space;
22718
22719 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22720 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022722 value = gen_const_xmlChar_ptr(n_value, 0);
22723 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724
William M. Brackf13f77f2004-11-12 16:03:48 +000022725 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022726 desret_int(ret_val);
22727 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022728 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022729 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022730 xmlResetLastError();
22731 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022732 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022734 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022735 printf(" %d", n_value);
22736 printf(" %d", n_space);
22737 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022738 }
22739 }
22740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022741 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022742#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022743#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744
Daniel Veillard42595322004-11-08 10:52:06 +000022745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022746}
22747
22748
22749static int
22750test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022752
William M. Brack21e4ef22005-01-02 09:53:13 +000022753#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022754#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022755 int mem_base;
22756 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022757 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022758 int n_value;
22759 int space; /* allow spaces in front and end of the string */
22760 int n_space;
22761
22762 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22763 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022765 value = gen_const_xmlChar_ptr(n_value, 0);
22766 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022767
William M. Brackf13f77f2004-11-12 16:03:48 +000022768 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022769 desret_int(ret_val);
22770 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022771 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022772 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022773 xmlResetLastError();
22774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022775 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022778 printf(" %d", n_value);
22779 printf(" %d", n_space);
22780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022781 }
22782 }
22783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022784 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022785#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022786#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787
Daniel Veillard42595322004-11-08 10:52:06 +000022788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022789}
22790
22791
22792static int
22793test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022795
William M. Brack21e4ef22005-01-02 09:53:13 +000022796#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022797#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022798 int mem_base;
22799 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022800 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022801 int n_value;
22802 int space; /* allow spaces in front and end of the string */
22803 int n_space;
22804
22805 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22806 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022808 value = gen_const_xmlChar_ptr(n_value, 0);
22809 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810
William M. Brackf13f77f2004-11-12 16:03:48 +000022811 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022812 desret_int(ret_val);
22813 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022814 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022815 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022816 xmlResetLastError();
22817 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022818 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022820 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022821 printf(" %d", n_value);
22822 printf(" %d", n_space);
22823 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022824 }
22825 }
22826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022827 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022828#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022829#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022830
Daniel Veillard42595322004-11-08 10:52:06 +000022831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022832}
22833
22834
22835static int
22836test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022838
William M. Brack21e4ef22005-01-02 09:53:13 +000022839#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022840#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022841 int mem_base;
22842 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022843 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022844 int n_value;
22845 int space; /* allow spaces in front and end of the string */
22846 int n_space;
22847
22848 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22849 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022851 value = gen_const_xmlChar_ptr(n_value, 0);
22852 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022853
William M. Brackf13f77f2004-11-12 16:03:48 +000022854 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022855 desret_int(ret_val);
22856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022857 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022858 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022859 xmlResetLastError();
22860 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022861 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022863 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022864 printf(" %d", n_value);
22865 printf(" %d", n_space);
22866 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022867 }
22868 }
22869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022870 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022871#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022872#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022873
Daniel Veillard42595322004-11-08 10:52:06 +000022874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022875}
22876
22877static int
22878test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022880
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022881 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022882 test_ret += test_xmlAddChild();
22883 test_ret += test_xmlAddChildList();
22884 test_ret += test_xmlAddNextSibling();
22885 test_ret += test_xmlAddPrevSibling();
22886 test_ret += test_xmlAddSibling();
22887 test_ret += test_xmlAttrSerializeTxtContent();
22888 test_ret += test_xmlBufferAdd();
22889 test_ret += test_xmlBufferAddHead();
22890 test_ret += test_xmlBufferCCat();
22891 test_ret += test_xmlBufferCat();
22892 test_ret += test_xmlBufferContent();
22893 test_ret += test_xmlBufferCreate();
22894 test_ret += test_xmlBufferCreateSize();
22895 test_ret += test_xmlBufferCreateStatic();
22896 test_ret += test_xmlBufferEmpty();
22897 test_ret += test_xmlBufferGrow();
22898 test_ret += test_xmlBufferLength();
22899 test_ret += test_xmlBufferResize();
22900 test_ret += test_xmlBufferSetAllocationScheme();
22901 test_ret += test_xmlBufferShrink();
22902 test_ret += test_xmlBufferWriteCHAR();
22903 test_ret += test_xmlBufferWriteChar();
22904 test_ret += test_xmlBufferWriteQuotedString();
22905 test_ret += test_xmlBuildQName();
22906 test_ret += test_xmlCopyDoc();
22907 test_ret += test_xmlCopyDtd();
22908 test_ret += test_xmlCopyNamespace();
22909 test_ret += test_xmlCopyNamespaceList();
22910 test_ret += test_xmlCopyNode();
22911 test_ret += test_xmlCopyNodeList();
22912 test_ret += test_xmlCopyProp();
22913 test_ret += test_xmlCopyPropList();
22914 test_ret += test_xmlCreateIntSubset();
22915 test_ret += test_xmlDocCopyNode();
22916 test_ret += test_xmlDocCopyNodeList();
22917 test_ret += test_xmlDocDump();
22918 test_ret += test_xmlDocDumpFormatMemory();
22919 test_ret += test_xmlDocDumpFormatMemoryEnc();
22920 test_ret += test_xmlDocDumpMemory();
22921 test_ret += test_xmlDocDumpMemoryEnc();
22922 test_ret += test_xmlDocFormatDump();
22923 test_ret += test_xmlDocGetRootElement();
22924 test_ret += test_xmlDocSetRootElement();
22925 test_ret += test_xmlElemDump();
22926 test_ret += test_xmlGetBufferAllocationScheme();
22927 test_ret += test_xmlGetCompressMode();
22928 test_ret += test_xmlGetDocCompressMode();
22929 test_ret += test_xmlGetIntSubset();
22930 test_ret += test_xmlGetLastChild();
22931 test_ret += test_xmlGetLineNo();
22932 test_ret += test_xmlGetNoNsProp();
22933 test_ret += test_xmlGetNodePath();
22934 test_ret += test_xmlGetNsList();
22935 test_ret += test_xmlGetNsProp();
22936 test_ret += test_xmlGetProp();
22937 test_ret += test_xmlHasNsProp();
22938 test_ret += test_xmlHasProp();
22939 test_ret += test_xmlIsBlankNode();
22940 test_ret += test_xmlIsXHTML();
22941 test_ret += test_xmlNewCDataBlock();
22942 test_ret += test_xmlNewCharRef();
22943 test_ret += test_xmlNewChild();
22944 test_ret += test_xmlNewComment();
22945 test_ret += test_xmlNewDoc();
22946 test_ret += test_xmlNewDocComment();
22947 test_ret += test_xmlNewDocFragment();
22948 test_ret += test_xmlNewDocNode();
22949 test_ret += test_xmlNewDocNodeEatName();
22950 test_ret += test_xmlNewDocPI();
22951 test_ret += test_xmlNewDocProp();
22952 test_ret += test_xmlNewDocRawNode();
22953 test_ret += test_xmlNewDocText();
22954 test_ret += test_xmlNewDocTextLen();
22955 test_ret += test_xmlNewDtd();
22956 test_ret += test_xmlNewNode();
22957 test_ret += test_xmlNewNodeEatName();
22958 test_ret += test_xmlNewNs();
22959 test_ret += test_xmlNewNsProp();
22960 test_ret += test_xmlNewNsPropEatName();
22961 test_ret += test_xmlNewPI();
22962 test_ret += test_xmlNewProp();
22963 test_ret += test_xmlNewReference();
22964 test_ret += test_xmlNewText();
22965 test_ret += test_xmlNewTextChild();
22966 test_ret += test_xmlNewTextLen();
22967 test_ret += test_xmlNodeAddContent();
22968 test_ret += test_xmlNodeAddContentLen();
22969 test_ret += test_xmlNodeBufGetContent();
22970 test_ret += test_xmlNodeDump();
22971 test_ret += test_xmlNodeDumpOutput();
22972 test_ret += test_xmlNodeGetBase();
22973 test_ret += test_xmlNodeGetContent();
22974 test_ret += test_xmlNodeGetLang();
22975 test_ret += test_xmlNodeGetSpacePreserve();
22976 test_ret += test_xmlNodeIsText();
22977 test_ret += test_xmlNodeListGetRawString();
22978 test_ret += test_xmlNodeListGetString();
22979 test_ret += test_xmlNodeSetBase();
22980 test_ret += test_xmlNodeSetContent();
22981 test_ret += test_xmlNodeSetContentLen();
22982 test_ret += test_xmlNodeSetLang();
22983 test_ret += test_xmlNodeSetName();
22984 test_ret += test_xmlNodeSetSpacePreserve();
22985 test_ret += test_xmlReconciliateNs();
22986 test_ret += test_xmlRemoveProp();
22987 test_ret += test_xmlReplaceNode();
22988 test_ret += test_xmlSaveFile();
22989 test_ret += test_xmlSaveFileEnc();
22990 test_ret += test_xmlSaveFileTo();
22991 test_ret += test_xmlSaveFormatFile();
22992 test_ret += test_xmlSaveFormatFileEnc();
22993 test_ret += test_xmlSaveFormatFileTo();
22994 test_ret += test_xmlSearchNs();
22995 test_ret += test_xmlSearchNsByHref();
22996 test_ret += test_xmlSetBufferAllocationScheme();
22997 test_ret += test_xmlSetCompressMode();
22998 test_ret += test_xmlSetDocCompressMode();
22999 test_ret += test_xmlSetNs();
23000 test_ret += test_xmlSetNsProp();
23001 test_ret += test_xmlSetProp();
23002 test_ret += test_xmlSplitQName2();
23003 test_ret += test_xmlSplitQName3();
23004 test_ret += test_xmlStringGetNodeList();
23005 test_ret += test_xmlStringLenGetNodeList();
23006 test_ret += test_xmlTextConcat();
23007 test_ret += test_xmlTextMerge();
23008 test_ret += test_xmlUnsetNsProp();
23009 test_ret += test_xmlUnsetProp();
23010 test_ret += test_xmlValidateNCName();
23011 test_ret += test_xmlValidateNMToken();
23012 test_ret += test_xmlValidateName();
23013 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023014
Daniel Veillard42595322004-11-08 10:52:06 +000023015 if (test_ret != 0)
23016 printf("Module tree: %d errors\n", test_ret);
23017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023018}
23019
23020static int
23021test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023023
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023024 int mem_base;
23025 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023026 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023027 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023028 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023029 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023030
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023031 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23032 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23033 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023034 URI = gen_const_xmlChar_ptr(n_URI, 0);
23035 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023036
William M. Brackf13f77f2004-11-12 16:03:48 +000023037 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023038 desret_xmlChar_ptr(ret_val);
23039 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023040 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23041 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023042 xmlResetLastError();
23043 if (mem_base != xmlMemBlocks()) {
23044 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023046 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023047 printf(" %d", n_URI);
23048 printf(" %d", n_base);
23049 printf("\n");
23050 }
23051 }
23052 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023054
Daniel Veillard42595322004-11-08 10:52:06 +000023055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023056}
23057
23058
23059static int
23060test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023062
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023063 int mem_base;
23064 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023065 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023066 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023067 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023068 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023069
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023070 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23071 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23072 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023073 URI = gen_const_xmlChar_ptr(n_URI, 0);
23074 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023075
William M. Brackf13f77f2004-11-12 16:03:48 +000023076 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023077 desret_xmlChar_ptr(ret_val);
23078 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023079 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23080 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023081 xmlResetLastError();
23082 if (mem_base != xmlMemBlocks()) {
23083 printf("Leak of %d blocks found in xmlBuildURI",
23084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023085 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023086 printf(" %d", n_URI);
23087 printf(" %d", n_base);
23088 printf("\n");
23089 }
23090 }
23091 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023093
Daniel Veillard42595322004-11-08 10:52:06 +000023094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023095}
23096
23097
23098static int
23099test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023101
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023102 int mem_base;
23103 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023104 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023105 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023106
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023107 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23108 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023109 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110
William M. Brackf13f77f2004-11-12 16:03:48 +000023111 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023112 desret_xmlChar_ptr(ret_val);
23113 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023114 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023115 xmlResetLastError();
23116 if (mem_base != xmlMemBlocks()) {
23117 printf("Leak of %d blocks found in xmlCanonicPath",
23118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023119 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023120 printf(" %d", n_path);
23121 printf("\n");
23122 }
23123 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023125
Daniel Veillard42595322004-11-08 10:52:06 +000023126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023127}
23128
23129
23130static int
23131test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023133
23134
23135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023137}
23138
23139
23140static int
23141test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023143
Daniel Veillardce682bc2004-11-05 17:22:25 +000023144 int mem_base;
23145 int ret_val;
23146 char * path; /* pointer to the path string */
23147 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023148
Daniel Veillardce682bc2004-11-05 17:22:25 +000023149 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23150 mem_base = xmlMemBlocks();
23151 path = gen_char_ptr(n_path, 0);
23152
23153 ret_val = xmlNormalizeURIPath(path);
23154 desret_int(ret_val);
23155 call_tests++;
23156 des_char_ptr(n_path, path, 0);
23157 xmlResetLastError();
23158 if (mem_base != xmlMemBlocks()) {
23159 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023161 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023162 printf(" %d", n_path);
23163 printf("\n");
23164 }
23165 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023166 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023167
Daniel Veillard42595322004-11-08 10:52:06 +000023168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023169}
23170
23171
23172static int
23173test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023175
23176
23177 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023179}
23180
23181
Daniel Veillardce682bc2004-11-05 17:22:25 +000023182#define gen_nb_xmlURIPtr 1
23183static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23184 return(NULL);
23185}
23186static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23187}
23188
Daniel Veillardd93f6252004-11-02 15:53:51 +000023189static int
23190test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023192
Daniel Veillardce682bc2004-11-05 17:22:25 +000023193 int mem_base;
23194 int ret_val;
23195 xmlURIPtr uri; /* pointer to an URI structure */
23196 int n_uri;
23197 char * str; /* the string to analyze */
23198 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023199
Daniel Veillardce682bc2004-11-05 17:22:25 +000023200 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23201 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23202 mem_base = xmlMemBlocks();
23203 uri = gen_xmlURIPtr(n_uri, 0);
23204 str = gen_const_char_ptr(n_str, 1);
23205
William M. Brackf13f77f2004-11-12 16:03:48 +000023206 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023207 desret_int(ret_val);
23208 call_tests++;
23209 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023210 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023211 xmlResetLastError();
23212 if (mem_base != xmlMemBlocks()) {
23213 printf("Leak of %d blocks found in xmlParseURIReference",
23214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023215 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023216 printf(" %d", n_uri);
23217 printf(" %d", n_str);
23218 printf("\n");
23219 }
23220 }
23221 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023223
Daniel Veillard42595322004-11-08 10:52:06 +000023224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023225}
23226
23227
23228static int
23229test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023231
Daniel Veillardce682bc2004-11-05 17:22:25 +000023232 int mem_base;
23233 FILE * stream; /* a FILE* for the output */
23234 int n_stream;
23235 xmlURIPtr uri; /* pointer to an xmlURI */
23236 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023237
Daniel Veillardce682bc2004-11-05 17:22:25 +000023238 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23239 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23240 mem_base = xmlMemBlocks();
23241 stream = gen_FILE_ptr(n_stream, 0);
23242 uri = gen_xmlURIPtr(n_uri, 1);
23243
23244 xmlPrintURI(stream, uri);
23245 call_tests++;
23246 des_FILE_ptr(n_stream, stream, 0);
23247 des_xmlURIPtr(n_uri, uri, 1);
23248 xmlResetLastError();
23249 if (mem_base != xmlMemBlocks()) {
23250 printf("Leak of %d blocks found in xmlPrintURI",
23251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023252 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023253 printf(" %d", n_stream);
23254 printf(" %d", n_uri);
23255 printf("\n");
23256 }
23257 }
23258 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023260
Daniel Veillard42595322004-11-08 10:52:06 +000023261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023262}
23263
23264
23265static int
23266test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023268
Daniel Veillardce682bc2004-11-05 17:22:25 +000023269 int mem_base;
23270 xmlChar * ret_val;
23271 xmlURIPtr uri; /* pointer to an xmlURI */
23272 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023273
Daniel Veillardce682bc2004-11-05 17:22:25 +000023274 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23275 mem_base = xmlMemBlocks();
23276 uri = gen_xmlURIPtr(n_uri, 0);
23277
23278 ret_val = xmlSaveUri(uri);
23279 desret_xmlChar_ptr(ret_val);
23280 call_tests++;
23281 des_xmlURIPtr(n_uri, uri, 0);
23282 xmlResetLastError();
23283 if (mem_base != xmlMemBlocks()) {
23284 printf("Leak of %d blocks found in xmlSaveUri",
23285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023286 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023287 printf(" %d", n_uri);
23288 printf("\n");
23289 }
23290 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023291 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023292
Daniel Veillard42595322004-11-08 10:52:06 +000023293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023294}
23295
23296
23297static int
23298test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023300
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023301 int mem_base;
23302 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023303 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023305
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023306 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023308 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309
William M. Brackf13f77f2004-11-12 16:03:48 +000023310 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023311 desret_xmlChar_ptr(ret_val);
23312 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023313 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023314 xmlResetLastError();
23315 if (mem_base != xmlMemBlocks()) {
23316 printf("Leak of %d blocks found in xmlURIEscape",
23317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023318 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023319 printf(" %d", n_str);
23320 printf("\n");
23321 }
23322 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023323 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023324
Daniel Veillard42595322004-11-08 10:52:06 +000023325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023326}
23327
23328
23329static int
23330test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023332
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023333 int mem_base;
23334 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023336 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023337 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023338 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023339
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023340 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23341 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023343 str = gen_const_xmlChar_ptr(n_str, 0);
23344 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023345
William M. Brackf13f77f2004-11-12 16:03:48 +000023346 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023347 desret_xmlChar_ptr(ret_val);
23348 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023349 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23350 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023351 xmlResetLastError();
23352 if (mem_base != xmlMemBlocks()) {
23353 printf("Leak of %d blocks found in xmlURIEscapeStr",
23354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023355 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023356 printf(" %d", n_str);
23357 printf(" %d", n_list);
23358 printf("\n");
23359 }
23360 }
23361 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023362 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023363
Daniel Veillard42595322004-11-08 10:52:06 +000023364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023365}
23366
23367
23368static int
23369test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023371
23372
23373 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023375}
23376
23377static int
23378test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023380
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023381 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023382 test_ret += test_xmlBuildRelativeURI();
23383 test_ret += test_xmlBuildURI();
23384 test_ret += test_xmlCanonicPath();
23385 test_ret += test_xmlCreateURI();
23386 test_ret += test_xmlNormalizeURIPath();
23387 test_ret += test_xmlParseURI();
23388 test_ret += test_xmlParseURIReference();
23389 test_ret += test_xmlPrintURI();
23390 test_ret += test_xmlSaveUri();
23391 test_ret += test_xmlURIEscape();
23392 test_ret += test_xmlURIEscapeStr();
23393 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023394
Daniel Veillard42595322004-11-08 10:52:06 +000023395 if (test_ret != 0)
23396 printf("Module uri: %d errors\n", test_ret);
23397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023398}
23399
23400static int
23401test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023403
Daniel Veillard42595322004-11-08 10:52:06 +000023404 int mem_base;
23405 xmlAttributePtr ret_val;
23406 xmlValidCtxtPtr ctxt; /* the validation context */
23407 int n_ctxt;
23408 xmlDtdPtr dtd; /* pointer to the DTD */
23409 int n_dtd;
23410 xmlChar * elem; /* the element name */
23411 int n_elem;
23412 xmlChar * name; /* the attribute name */
23413 int n_name;
23414 xmlChar * ns; /* the attribute namespace prefix */
23415 int n_ns;
23416 xmlAttributeType type; /* the attribute type */
23417 int n_type;
23418 xmlAttributeDefault def; /* the attribute default type */
23419 int n_def;
23420 xmlChar * defaultValue; /* the attribute default value */
23421 int n_defaultValue;
23422 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23423 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023424
Daniel Veillard42595322004-11-08 10:52:06 +000023425 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23426 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23427 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23428 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23429 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23430 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23431 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23432 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23433 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23434 mem_base = xmlMemBlocks();
23435 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23436 dtd = gen_xmlDtdPtr(n_dtd, 1);
23437 elem = gen_const_xmlChar_ptr(n_elem, 2);
23438 name = gen_const_xmlChar_ptr(n_name, 3);
23439 ns = gen_const_xmlChar_ptr(n_ns, 4);
23440 type = gen_xmlAttributeType(n_type, 5);
23441 def = gen_xmlAttributeDefault(n_def, 6);
23442 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23443 tree = gen_xmlEnumerationPtr(n_tree, 8);
23444
William M. Brackf13f77f2004-11-12 16:03:48 +000023445 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 +000023446 desret_xmlAttributePtr(ret_val);
23447 call_tests++;
23448 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23449 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023450 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23451 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23452 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023453 des_xmlAttributeType(n_type, type, 5);
23454 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023455 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023456 des_xmlEnumerationPtr(n_tree, tree, 8);
23457 xmlResetLastError();
23458 if (mem_base != xmlMemBlocks()) {
23459 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23460 xmlMemBlocks() - mem_base);
23461 test_ret++;
23462 printf(" %d", n_ctxt);
23463 printf(" %d", n_dtd);
23464 printf(" %d", n_elem);
23465 printf(" %d", n_name);
23466 printf(" %d", n_ns);
23467 printf(" %d", n_type);
23468 printf(" %d", n_def);
23469 printf(" %d", n_defaultValue);
23470 printf(" %d", n_tree);
23471 printf("\n");
23472 }
23473 }
23474 }
23475 }
23476 }
23477 }
23478 }
23479 }
23480 }
23481 }
Daniel Veillard42595322004-11-08 10:52:06 +000023482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023483
Daniel Veillard42595322004-11-08 10:52:06 +000023484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023485}
23486
23487
23488static int
23489test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023491
Daniel Veillard42595322004-11-08 10:52:06 +000023492 int mem_base;
23493 xmlElementPtr ret_val;
23494 xmlValidCtxtPtr ctxt; /* the validation context */
23495 int n_ctxt;
23496 xmlDtdPtr dtd; /* pointer to the DTD */
23497 int n_dtd;
23498 xmlChar * name; /* the entity name */
23499 int n_name;
23500 xmlElementTypeVal type; /* the element type */
23501 int n_type;
23502 xmlElementContentPtr content; /* the element content tree or NULL */
23503 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023504
Daniel Veillard42595322004-11-08 10:52:06 +000023505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23506 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23507 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23508 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23509 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23510 mem_base = xmlMemBlocks();
23511 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23512 dtd = gen_xmlDtdPtr(n_dtd, 1);
23513 name = gen_const_xmlChar_ptr(n_name, 2);
23514 type = gen_xmlElementTypeVal(n_type, 3);
23515 content = gen_xmlElementContentPtr(n_content, 4);
23516
William M. Brackf13f77f2004-11-12 16:03:48 +000023517 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023518 desret_xmlElementPtr(ret_val);
23519 call_tests++;
23520 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23521 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023522 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023523 des_xmlElementTypeVal(n_type, type, 3);
23524 des_xmlElementContentPtr(n_content, content, 4);
23525 xmlResetLastError();
23526 if (mem_base != xmlMemBlocks()) {
23527 printf("Leak of %d blocks found in xmlAddElementDecl",
23528 xmlMemBlocks() - mem_base);
23529 test_ret++;
23530 printf(" %d", n_ctxt);
23531 printf(" %d", n_dtd);
23532 printf(" %d", n_name);
23533 printf(" %d", n_type);
23534 printf(" %d", n_content);
23535 printf("\n");
23536 }
23537 }
23538 }
23539 }
23540 }
23541 }
Daniel Veillard42595322004-11-08 10:52:06 +000023542 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023543
Daniel Veillard42595322004-11-08 10:52:06 +000023544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023545}
23546
23547
23548static int
23549test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023551
23552
23553 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023555}
23556
23557
23558static int
23559test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023560 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023561
23562
23563 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023565}
23566
23567
23568static int
23569test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023571
23572
23573 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023575}
23576
23577
Daniel Veillardce682bc2004-11-05 17:22:25 +000023578#define gen_nb_xmlAttributeTablePtr 1
23579static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23580 return(NULL);
23581}
23582static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23583}
23584
Daniel Veillardd93f6252004-11-02 15:53:51 +000023585static int
23586test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023588
23589
23590 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023592}
23593
23594
23595static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023596test_xmlCopyDocElementContent(void) {
23597 int test_ret = 0;
23598
23599 int mem_base;
23600 xmlElementContentPtr ret_val;
23601 xmlDocPtr doc; /* the document owning the element declaration */
23602 int n_doc;
23603 xmlElementContentPtr cur; /* An element content pointer. */
23604 int n_cur;
23605
23606 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23607 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23608 mem_base = xmlMemBlocks();
23609 doc = gen_xmlDocPtr(n_doc, 0);
23610 cur = gen_xmlElementContentPtr(n_cur, 1);
23611
23612 ret_val = xmlCopyDocElementContent(doc, cur);
23613 desret_xmlElementContentPtr(ret_val);
23614 call_tests++;
23615 des_xmlDocPtr(n_doc, doc, 0);
23616 des_xmlElementContentPtr(n_cur, cur, 1);
23617 xmlResetLastError();
23618 if (mem_base != xmlMemBlocks()) {
23619 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23620 xmlMemBlocks() - mem_base);
23621 test_ret++;
23622 printf(" %d", n_doc);
23623 printf(" %d", n_cur);
23624 printf("\n");
23625 }
23626 }
23627 }
23628 function_tests++;
23629
23630 return(test_ret);
23631}
23632
23633
23634static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023635test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023637
William M. Brack094dd862004-11-14 14:28:34 +000023638 int mem_base;
23639 xmlElementContentPtr ret_val;
23640 xmlElementContentPtr cur; /* An element content pointer. */
23641 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023642
William M. Brack094dd862004-11-14 14:28:34 +000023643 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23644 mem_base = xmlMemBlocks();
23645 cur = gen_xmlElementContentPtr(n_cur, 0);
23646
23647 ret_val = xmlCopyElementContent(cur);
23648 desret_xmlElementContentPtr(ret_val);
23649 call_tests++;
23650 des_xmlElementContentPtr(n_cur, cur, 0);
23651 xmlResetLastError();
23652 if (mem_base != xmlMemBlocks()) {
23653 printf("Leak of %d blocks found in xmlCopyElementContent",
23654 xmlMemBlocks() - mem_base);
23655 test_ret++;
23656 printf(" %d", n_cur);
23657 printf("\n");
23658 }
23659 }
23660 function_tests++;
23661
Daniel Veillard42595322004-11-08 10:52:06 +000023662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023663}
23664
23665
Daniel Veillardce682bc2004-11-05 17:22:25 +000023666#define gen_nb_xmlElementTablePtr 1
23667static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23668 return(NULL);
23669}
23670static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23671}
23672
Daniel Veillardd93f6252004-11-02 15:53:51 +000023673static int
23674test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023676
23677
23678 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023680}
23681
23682
23683static int
23684test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686
23687
23688 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023690}
23691
23692
Daniel Veillardce682bc2004-11-05 17:22:25 +000023693#define gen_nb_xmlNotationTablePtr 1
23694static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23695 return(NULL);
23696}
23697static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23698}
23699
Daniel Veillardd93f6252004-11-02 15:53:51 +000023700static int
23701test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023703
23704
23705 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023707}
23708
23709
23710static int
23711test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023713
23714
23715 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023717}
23718
23719
Daniel Veillardce682bc2004-11-05 17:22:25 +000023720#define gen_nb_xmlAttributePtr 1
23721static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23722 return(NULL);
23723}
23724static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23725}
23726
Daniel Veillardd93f6252004-11-02 15:53:51 +000023727static int
23728test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023730
William M. Brack21e4ef22005-01-02 09:53:13 +000023731#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023732 int mem_base;
23733 xmlBufferPtr buf; /* the XML buffer output */
23734 int n_buf;
23735 xmlAttributePtr attr; /* An attribute declaration */
23736 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023737
Daniel Veillardce682bc2004-11-05 17:22:25 +000023738 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23739 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23740 mem_base = xmlMemBlocks();
23741 buf = gen_xmlBufferPtr(n_buf, 0);
23742 attr = gen_xmlAttributePtr(n_attr, 1);
23743
23744 xmlDumpAttributeDecl(buf, attr);
23745 call_tests++;
23746 des_xmlBufferPtr(n_buf, buf, 0);
23747 des_xmlAttributePtr(n_attr, attr, 1);
23748 xmlResetLastError();
23749 if (mem_base != xmlMemBlocks()) {
23750 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023752 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023753 printf(" %d", n_buf);
23754 printf(" %d", n_attr);
23755 printf("\n");
23756 }
23757 }
23758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023759 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023760#endif
23761
Daniel Veillard42595322004-11-08 10:52:06 +000023762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023763}
23764
23765
23766static int
23767test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023769
William M. Brack21e4ef22005-01-02 09:53:13 +000023770#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023771 int mem_base;
23772 xmlBufferPtr buf; /* the XML buffer output */
23773 int n_buf;
23774 xmlAttributeTablePtr table; /* An attribute table */
23775 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023776
Daniel Veillardce682bc2004-11-05 17:22:25 +000023777 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23778 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23779 mem_base = xmlMemBlocks();
23780 buf = gen_xmlBufferPtr(n_buf, 0);
23781 table = gen_xmlAttributeTablePtr(n_table, 1);
23782
23783 xmlDumpAttributeTable(buf, table);
23784 call_tests++;
23785 des_xmlBufferPtr(n_buf, buf, 0);
23786 des_xmlAttributeTablePtr(n_table, table, 1);
23787 xmlResetLastError();
23788 if (mem_base != xmlMemBlocks()) {
23789 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023791 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023792 printf(" %d", n_buf);
23793 printf(" %d", n_table);
23794 printf("\n");
23795 }
23796 }
23797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023798 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023799#endif
23800
Daniel Veillard42595322004-11-08 10:52:06 +000023801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023802}
23803
23804
Daniel Veillardce682bc2004-11-05 17:22:25 +000023805#define gen_nb_xmlElementPtr 1
23806static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23807 return(NULL);
23808}
23809static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23810}
23811
Daniel Veillardd93f6252004-11-02 15:53:51 +000023812static int
23813test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023815
William M. Brack21e4ef22005-01-02 09:53:13 +000023816#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023817 int mem_base;
23818 xmlBufferPtr buf; /* the XML buffer output */
23819 int n_buf;
23820 xmlElementPtr elem; /* An element table */
23821 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023822
Daniel Veillardce682bc2004-11-05 17:22:25 +000023823 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23824 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23825 mem_base = xmlMemBlocks();
23826 buf = gen_xmlBufferPtr(n_buf, 0);
23827 elem = gen_xmlElementPtr(n_elem, 1);
23828
23829 xmlDumpElementDecl(buf, elem);
23830 call_tests++;
23831 des_xmlBufferPtr(n_buf, buf, 0);
23832 des_xmlElementPtr(n_elem, elem, 1);
23833 xmlResetLastError();
23834 if (mem_base != xmlMemBlocks()) {
23835 printf("Leak of %d blocks found in xmlDumpElementDecl",
23836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023837 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023838 printf(" %d", n_buf);
23839 printf(" %d", n_elem);
23840 printf("\n");
23841 }
23842 }
23843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023844 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023845#endif
23846
Daniel Veillard42595322004-11-08 10:52:06 +000023847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848}
23849
23850
23851static int
23852test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023854
William M. Brack21e4ef22005-01-02 09:53:13 +000023855#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023856 int mem_base;
23857 xmlBufferPtr buf; /* the XML buffer output */
23858 int n_buf;
23859 xmlElementTablePtr table; /* An element table */
23860 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023861
Daniel Veillardce682bc2004-11-05 17:22:25 +000023862 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23863 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23864 mem_base = xmlMemBlocks();
23865 buf = gen_xmlBufferPtr(n_buf, 0);
23866 table = gen_xmlElementTablePtr(n_table, 1);
23867
23868 xmlDumpElementTable(buf, table);
23869 call_tests++;
23870 des_xmlBufferPtr(n_buf, buf, 0);
23871 des_xmlElementTablePtr(n_table, table, 1);
23872 xmlResetLastError();
23873 if (mem_base != xmlMemBlocks()) {
23874 printf("Leak of %d blocks found in xmlDumpElementTable",
23875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023876 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023877 printf(" %d", n_buf);
23878 printf(" %d", n_table);
23879 printf("\n");
23880 }
23881 }
23882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023883 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023884#endif
23885
Daniel Veillard42595322004-11-08 10:52:06 +000023886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023887}
23888
23889
Daniel Veillardce682bc2004-11-05 17:22:25 +000023890#define gen_nb_xmlNotationPtr 1
23891static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23892 return(NULL);
23893}
23894static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23895}
23896
Daniel Veillardd93f6252004-11-02 15:53:51 +000023897static int
23898test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023900
William M. Brack21e4ef22005-01-02 09:53:13 +000023901#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023902 int mem_base;
23903 xmlBufferPtr buf; /* the XML buffer output */
23904 int n_buf;
23905 xmlNotationPtr nota; /* A notation declaration */
23906 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023907
Daniel Veillardce682bc2004-11-05 17:22:25 +000023908 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23909 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23910 mem_base = xmlMemBlocks();
23911 buf = gen_xmlBufferPtr(n_buf, 0);
23912 nota = gen_xmlNotationPtr(n_nota, 1);
23913
23914 xmlDumpNotationDecl(buf, nota);
23915 call_tests++;
23916 des_xmlBufferPtr(n_buf, buf, 0);
23917 des_xmlNotationPtr(n_nota, nota, 1);
23918 xmlResetLastError();
23919 if (mem_base != xmlMemBlocks()) {
23920 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023922 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023923 printf(" %d", n_buf);
23924 printf(" %d", n_nota);
23925 printf("\n");
23926 }
23927 }
23928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023929 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023930#endif
23931
Daniel Veillard42595322004-11-08 10:52:06 +000023932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023933}
23934
23935
23936static int
23937test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023939
William M. Brack21e4ef22005-01-02 09:53:13 +000023940#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023941 int mem_base;
23942 xmlBufferPtr buf; /* the XML buffer output */
23943 int n_buf;
23944 xmlNotationTablePtr table; /* A notation table */
23945 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023946
Daniel Veillardce682bc2004-11-05 17:22:25 +000023947 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23948 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23949 mem_base = xmlMemBlocks();
23950 buf = gen_xmlBufferPtr(n_buf, 0);
23951 table = gen_xmlNotationTablePtr(n_table, 1);
23952
23953 xmlDumpNotationTable(buf, table);
23954 call_tests++;
23955 des_xmlBufferPtr(n_buf, buf, 0);
23956 des_xmlNotationTablePtr(n_table, table, 1);
23957 xmlResetLastError();
23958 if (mem_base != xmlMemBlocks()) {
23959 printf("Leak of %d blocks found in xmlDumpNotationTable",
23960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023961 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023962 printf(" %d", n_buf);
23963 printf(" %d", n_table);
23964 printf("\n");
23965 }
23966 }
23967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023968 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023969#endif
23970
Daniel Veillard42595322004-11-08 10:52:06 +000023971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023972}
23973
23974
23975static int
23976test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023978
Daniel Veillard42595322004-11-08 10:52:06 +000023979 int mem_base;
23980 xmlAttributePtr ret_val;
23981 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23982 int n_dtd;
23983 xmlChar * elem; /* the element name */
23984 int n_elem;
23985 xmlChar * name; /* the attribute name */
23986 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023987
Daniel Veillard42595322004-11-08 10:52:06 +000023988 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23989 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23990 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23991 mem_base = xmlMemBlocks();
23992 dtd = gen_xmlDtdPtr(n_dtd, 0);
23993 elem = gen_const_xmlChar_ptr(n_elem, 1);
23994 name = gen_const_xmlChar_ptr(n_name, 2);
23995
William M. Brackf13f77f2004-11-12 16:03:48 +000023996 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023997 desret_xmlAttributePtr(ret_val);
23998 call_tests++;
23999 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024000 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24001 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024002 xmlResetLastError();
24003 if (mem_base != xmlMemBlocks()) {
24004 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24005 xmlMemBlocks() - mem_base);
24006 test_ret++;
24007 printf(" %d", n_dtd);
24008 printf(" %d", n_elem);
24009 printf(" %d", n_name);
24010 printf("\n");
24011 }
24012 }
24013 }
24014 }
Daniel Veillard42595322004-11-08 10:52:06 +000024015 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024016
Daniel Veillard42595322004-11-08 10:52:06 +000024017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024018}
24019
24020
24021static int
24022test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024024
Daniel Veillard42595322004-11-08 10:52:06 +000024025 int mem_base;
24026 xmlElementPtr ret_val;
24027 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24028 int n_dtd;
24029 xmlChar * name; /* the element name */
24030 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024031
Daniel Veillard42595322004-11-08 10:52:06 +000024032 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24034 mem_base = xmlMemBlocks();
24035 dtd = gen_xmlDtdPtr(n_dtd, 0);
24036 name = gen_const_xmlChar_ptr(n_name, 1);
24037
William M. Brackf13f77f2004-11-12 16:03:48 +000024038 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024039 desret_xmlElementPtr(ret_val);
24040 call_tests++;
24041 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024042 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024043 xmlResetLastError();
24044 if (mem_base != xmlMemBlocks()) {
24045 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24046 xmlMemBlocks() - mem_base);
24047 test_ret++;
24048 printf(" %d", n_dtd);
24049 printf(" %d", n_name);
24050 printf("\n");
24051 }
24052 }
24053 }
Daniel Veillard42595322004-11-08 10:52:06 +000024054 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024055
Daniel Veillard42595322004-11-08 10:52:06 +000024056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024057}
24058
24059
24060static int
24061test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024063
24064
24065 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024067}
24068
24069
24070static int
24071test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024073
Daniel Veillard42595322004-11-08 10:52:06 +000024074 int mem_base;
24075 xmlAttributePtr ret_val;
24076 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24077 int n_dtd;
24078 xmlChar * elem; /* the element name */
24079 int n_elem;
24080 xmlChar * name; /* the attribute name */
24081 int n_name;
24082 xmlChar * prefix; /* the attribute namespace prefix */
24083 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024084
Daniel Veillard42595322004-11-08 10:52:06 +000024085 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24086 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24087 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24088 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24089 mem_base = xmlMemBlocks();
24090 dtd = gen_xmlDtdPtr(n_dtd, 0);
24091 elem = gen_const_xmlChar_ptr(n_elem, 1);
24092 name = gen_const_xmlChar_ptr(n_name, 2);
24093 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24094
William M. Brackf13f77f2004-11-12 16:03:48 +000024095 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024096 desret_xmlAttributePtr(ret_val);
24097 call_tests++;
24098 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024099 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24100 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24101 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024102 xmlResetLastError();
24103 if (mem_base != xmlMemBlocks()) {
24104 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24105 xmlMemBlocks() - mem_base);
24106 test_ret++;
24107 printf(" %d", n_dtd);
24108 printf(" %d", n_elem);
24109 printf(" %d", n_name);
24110 printf(" %d", n_prefix);
24111 printf("\n");
24112 }
24113 }
24114 }
24115 }
24116 }
Daniel Veillard42595322004-11-08 10:52:06 +000024117 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024118
Daniel Veillard42595322004-11-08 10:52:06 +000024119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024120}
24121
24122
24123static int
24124test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024126
Daniel Veillard42595322004-11-08 10:52:06 +000024127 int mem_base;
24128 xmlElementPtr ret_val;
24129 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24130 int n_dtd;
24131 xmlChar * name; /* the element name */
24132 int n_name;
24133 xmlChar * prefix; /* the element namespace prefix */
24134 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024135
Daniel Veillard42595322004-11-08 10:52:06 +000024136 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24138 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24139 mem_base = xmlMemBlocks();
24140 dtd = gen_xmlDtdPtr(n_dtd, 0);
24141 name = gen_const_xmlChar_ptr(n_name, 1);
24142 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24143
William M. Brackf13f77f2004-11-12 16:03:48 +000024144 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024145 desret_xmlElementPtr(ret_val);
24146 call_tests++;
24147 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024148 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24149 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024150 xmlResetLastError();
24151 if (mem_base != xmlMemBlocks()) {
24152 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24153 xmlMemBlocks() - mem_base);
24154 test_ret++;
24155 printf(" %d", n_dtd);
24156 printf(" %d", n_name);
24157 printf(" %d", n_prefix);
24158 printf("\n");
24159 }
24160 }
24161 }
24162 }
Daniel Veillard42595322004-11-08 10:52:06 +000024163 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024164
Daniel Veillard42595322004-11-08 10:52:06 +000024165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024166}
24167
24168
24169static int
24170test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024172
Daniel Veillard57b25162004-11-06 14:50:18 +000024173 int mem_base;
24174 xmlAttrPtr ret_val;
24175 xmlDocPtr doc; /* pointer to the document */
24176 int n_doc;
24177 xmlChar * ID; /* the ID value */
24178 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024179
Daniel Veillard57b25162004-11-06 14:50:18 +000024180 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24181 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24182 mem_base = xmlMemBlocks();
24183 doc = gen_xmlDocPtr(n_doc, 0);
24184 ID = gen_const_xmlChar_ptr(n_ID, 1);
24185
William M. Brackf13f77f2004-11-12 16:03:48 +000024186 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024187 desret_xmlAttrPtr(ret_val);
24188 call_tests++;
24189 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024190 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024191 xmlResetLastError();
24192 if (mem_base != xmlMemBlocks()) {
24193 printf("Leak of %d blocks found in xmlGetID",
24194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024195 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024196 printf(" %d", n_doc);
24197 printf(" %d", n_ID);
24198 printf("\n");
24199 }
24200 }
24201 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024203
Daniel Veillard42595322004-11-08 10:52:06 +000024204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024205}
24206
24207
24208static int
24209test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024211
24212
24213 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024215}
24216
24217
24218static int
24219test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024221
Daniel Veillardce244ad2004-11-05 10:03:46 +000024222 int mem_base;
24223 int ret_val;
24224 xmlDocPtr doc; /* the document */
24225 int n_doc;
24226 xmlNodePtr elem; /* the element carrying the attribute */
24227 int n_elem;
24228 xmlAttrPtr attr; /* the attribute */
24229 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024230
Daniel Veillardce244ad2004-11-05 10:03:46 +000024231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24232 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24233 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24234 mem_base = xmlMemBlocks();
24235 doc = gen_xmlDocPtr(n_doc, 0);
24236 elem = gen_xmlNodePtr(n_elem, 1);
24237 attr = gen_xmlAttrPtr(n_attr, 2);
24238
24239 ret_val = xmlIsID(doc, elem, attr);
24240 desret_int(ret_val);
24241 call_tests++;
24242 des_xmlDocPtr(n_doc, doc, 0);
24243 des_xmlNodePtr(n_elem, elem, 1);
24244 des_xmlAttrPtr(n_attr, attr, 2);
24245 xmlResetLastError();
24246 if (mem_base != xmlMemBlocks()) {
24247 printf("Leak of %d blocks found in xmlIsID",
24248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024249 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024250 printf(" %d", n_doc);
24251 printf(" %d", n_elem);
24252 printf(" %d", n_attr);
24253 printf("\n");
24254 }
24255 }
24256 }
24257 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024259
Daniel Veillard42595322004-11-08 10:52:06 +000024260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024261}
24262
24263
24264static int
24265test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024267
24268 int mem_base;
24269 int ret_val;
24270 xmlDocPtr doc; /* the document */
24271 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024272 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024273 int n_name;
24274
24275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24276 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024278 doc = gen_xmlDocPtr(n_doc, 0);
24279 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024280
William M. Brackf13f77f2004-11-12 16:03:48 +000024281 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024282 desret_int(ret_val);
24283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024284 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024286 xmlResetLastError();
24287 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024288 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024290 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024291 printf(" %d", n_doc);
24292 printf(" %d", n_name);
24293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024294 }
24295 }
24296 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024298
Daniel Veillard42595322004-11-08 10:52:06 +000024299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024300}
24301
24302
24303static int
24304test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024306
Daniel Veillardce244ad2004-11-05 10:03:46 +000024307 int mem_base;
24308 int ret_val;
24309 xmlDocPtr doc; /* the document */
24310 int n_doc;
24311 xmlNodePtr elem; /* the element carrying the attribute */
24312 int n_elem;
24313 xmlAttrPtr attr; /* the attribute */
24314 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024315
Daniel Veillardce244ad2004-11-05 10:03:46 +000024316 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24317 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24318 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24319 mem_base = xmlMemBlocks();
24320 doc = gen_xmlDocPtr(n_doc, 0);
24321 elem = gen_xmlNodePtr(n_elem, 1);
24322 attr = gen_xmlAttrPtr(n_attr, 2);
24323
24324 ret_val = xmlIsRef(doc, elem, attr);
24325 desret_int(ret_val);
24326 call_tests++;
24327 des_xmlDocPtr(n_doc, doc, 0);
24328 des_xmlNodePtr(n_elem, elem, 1);
24329 des_xmlAttrPtr(n_attr, attr, 2);
24330 xmlResetLastError();
24331 if (mem_base != xmlMemBlocks()) {
24332 printf("Leak of %d blocks found in xmlIsRef",
24333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024334 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024335 printf(" %d", n_doc);
24336 printf(" %d", n_elem);
24337 printf(" %d", n_attr);
24338 printf("\n");
24339 }
24340 }
24341 }
24342 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024343 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024344
Daniel Veillard42595322004-11-08 10:52:06 +000024345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024346}
24347
24348
24349static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024350test_xmlNewDocElementContent(void) {
24351 int test_ret = 0;
24352
24353 int mem_base;
24354 xmlElementContentPtr ret_val;
24355 xmlDocPtr doc; /* the document */
24356 int n_doc;
24357 xmlChar * name; /* the subelement name or NULL */
24358 int n_name;
24359 xmlElementContentType type; /* the type of element content decl */
24360 int n_type;
24361
24362 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24363 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24364 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24365 mem_base = xmlMemBlocks();
24366 doc = gen_xmlDocPtr(n_doc, 0);
24367 name = gen_const_xmlChar_ptr(n_name, 1);
24368 type = gen_xmlElementContentType(n_type, 2);
24369
24370 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024371 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024372 desret_xmlElementContentPtr(ret_val);
24373 call_tests++;
24374 des_xmlDocPtr(n_doc, doc, 0);
24375 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24376 des_xmlElementContentType(n_type, type, 2);
24377 xmlResetLastError();
24378 if (mem_base != xmlMemBlocks()) {
24379 printf("Leak of %d blocks found in xmlNewDocElementContent",
24380 xmlMemBlocks() - mem_base);
24381 test_ret++;
24382 printf(" %d", n_doc);
24383 printf(" %d", n_name);
24384 printf(" %d", n_type);
24385 printf("\n");
24386 }
24387 }
24388 }
24389 }
24390 function_tests++;
24391
24392 return(test_ret);
24393}
24394
24395
24396static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024397test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399
William M. Brack094dd862004-11-14 14:28:34 +000024400 int mem_base;
24401 xmlElementContentPtr ret_val;
24402 xmlChar * name; /* the subelement name or NULL */
24403 int n_name;
24404 xmlElementContentType type; /* the type of element content decl */
24405 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024406
William M. Brack094dd862004-11-14 14:28:34 +000024407 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24408 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24409 mem_base = xmlMemBlocks();
24410 name = gen_const_xmlChar_ptr(n_name, 0);
24411 type = gen_xmlElementContentType(n_type, 1);
24412
24413 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24414 desret_xmlElementContentPtr(ret_val);
24415 call_tests++;
24416 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24417 des_xmlElementContentType(n_type, type, 1);
24418 xmlResetLastError();
24419 if (mem_base != xmlMemBlocks()) {
24420 printf("Leak of %d blocks found in xmlNewElementContent",
24421 xmlMemBlocks() - mem_base);
24422 test_ret++;
24423 printf(" %d", n_name);
24424 printf(" %d", n_type);
24425 printf("\n");
24426 }
24427 }
24428 }
24429 function_tests++;
24430
Daniel Veillard42595322004-11-08 10:52:06 +000024431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432}
24433
24434
24435static int
24436test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024438
24439
24440 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024442}
24443
24444
24445static int
24446test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024448
Daniel Veillardce244ad2004-11-05 10:03:46 +000024449 int mem_base;
24450 int ret_val;
24451 xmlDocPtr doc; /* the document */
24452 int n_doc;
24453 xmlAttrPtr attr; /* the attribute */
24454 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024455
Daniel Veillardce244ad2004-11-05 10:03:46 +000024456 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24457 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24458 mem_base = xmlMemBlocks();
24459 doc = gen_xmlDocPtr(n_doc, 0);
24460 attr = gen_xmlAttrPtr(n_attr, 1);
24461
24462 ret_val = xmlRemoveID(doc, attr);
24463 desret_int(ret_val);
24464 call_tests++;
24465 des_xmlDocPtr(n_doc, doc, 0);
24466 des_xmlAttrPtr(n_attr, attr, 1);
24467 xmlResetLastError();
24468 if (mem_base != xmlMemBlocks()) {
24469 printf("Leak of %d blocks found in xmlRemoveID",
24470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024471 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024472 printf(" %d", n_doc);
24473 printf(" %d", n_attr);
24474 printf("\n");
24475 }
24476 }
24477 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024478 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024479
Daniel Veillard42595322004-11-08 10:52:06 +000024480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024481}
24482
24483
24484static int
24485test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024487
Daniel Veillardce244ad2004-11-05 10:03:46 +000024488 int mem_base;
24489 int ret_val;
24490 xmlDocPtr doc; /* the document */
24491 int n_doc;
24492 xmlAttrPtr attr; /* the attribute */
24493 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024494
Daniel Veillardce244ad2004-11-05 10:03:46 +000024495 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24496 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24497 mem_base = xmlMemBlocks();
24498 doc = gen_xmlDocPtr(n_doc, 0);
24499 attr = gen_xmlAttrPtr(n_attr, 1);
24500
24501 ret_val = xmlRemoveRef(doc, attr);
24502 desret_int(ret_val);
24503 call_tests++;
24504 des_xmlDocPtr(n_doc, doc, 0);
24505 des_xmlAttrPtr(n_attr, attr, 1);
24506 xmlResetLastError();
24507 if (mem_base != xmlMemBlocks()) {
24508 printf("Leak of %d blocks found in xmlRemoveRef",
24509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024510 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024511 printf(" %d", n_doc);
24512 printf(" %d", n_attr);
24513 printf("\n");
24514 }
24515 }
24516 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024517 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024518
Daniel Veillard42595322004-11-08 10:52:06 +000024519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024520}
24521
24522
24523static int
24524test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024526
Daniel Veillardce682bc2004-11-05 17:22:25 +000024527 int mem_base;
24528 char * buf; /* an output buffer */
24529 int n_buf;
24530 int size; /* the buffer size */
24531 int n_size;
24532 xmlElementContentPtr content; /* An element table */
24533 int n_content;
24534 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24535 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024536
Daniel Veillardce682bc2004-11-05 17:22:25 +000024537 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24538 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24539 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24540 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24541 mem_base = xmlMemBlocks();
24542 buf = gen_char_ptr(n_buf, 0);
24543 size = gen_int(n_size, 1);
24544 content = gen_xmlElementContentPtr(n_content, 2);
24545 glob = gen_int(n_glob, 3);
24546
24547 xmlSnprintfElementContent(buf, size, content, glob);
24548 call_tests++;
24549 des_char_ptr(n_buf, buf, 0);
24550 des_int(n_size, size, 1);
24551 des_xmlElementContentPtr(n_content, content, 2);
24552 des_int(n_glob, glob, 3);
24553 xmlResetLastError();
24554 if (mem_base != xmlMemBlocks()) {
24555 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024557 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024558 printf(" %d", n_buf);
24559 printf(" %d", n_size);
24560 printf(" %d", n_content);
24561 printf(" %d", n_glob);
24562 printf("\n");
24563 }
24564 }
24565 }
24566 }
24567 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024569
Daniel Veillard42595322004-11-08 10:52:06 +000024570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024571}
24572
24573
24574static int
24575test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024577
William M. Brack21e4ef22005-01-02 09:53:13 +000024578#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024579#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024580 int mem_base;
24581 char * buf; /* an output buffer */
24582 int n_buf;
24583 xmlElementContentPtr content; /* An element table */
24584 int n_content;
24585 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24586 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024587
Daniel Veillardce682bc2004-11-05 17:22:25 +000024588 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24589 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24590 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24591 mem_base = xmlMemBlocks();
24592 buf = gen_char_ptr(n_buf, 0);
24593 content = gen_xmlElementContentPtr(n_content, 1);
24594 glob = gen_int(n_glob, 2);
24595
24596 xmlSprintfElementContent(buf, content, glob);
24597 call_tests++;
24598 des_char_ptr(n_buf, buf, 0);
24599 des_xmlElementContentPtr(n_content, content, 1);
24600 des_int(n_glob, glob, 2);
24601 xmlResetLastError();
24602 if (mem_base != xmlMemBlocks()) {
24603 printf("Leak of %d blocks found in xmlSprintfElementContent",
24604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024605 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024606 printf(" %d", n_buf);
24607 printf(" %d", n_content);
24608 printf(" %d", n_glob);
24609 printf("\n");
24610 }
24611 }
24612 }
24613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024614 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024615#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024616#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024617
Daniel Veillard42595322004-11-08 10:52:06 +000024618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024619}
24620
24621
24622static int
24623test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024625
William M. Brack21e4ef22005-01-02 09:53:13 +000024626#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024627 int mem_base;
24628 int ret_val;
24629 xmlValidCtxtPtr ctxt; /* a validation context */
24630 int n_ctxt;
24631 xmlElementPtr elem; /* an element declaration node */
24632 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024633
Daniel Veillardce682bc2004-11-05 17:22:25 +000024634 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24635 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24636 mem_base = xmlMemBlocks();
24637 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24638 elem = gen_xmlElementPtr(n_elem, 1);
24639
24640 ret_val = xmlValidBuildContentModel(ctxt, elem);
24641 desret_int(ret_val);
24642 call_tests++;
24643 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24644 des_xmlElementPtr(n_elem, elem, 1);
24645 xmlResetLastError();
24646 if (mem_base != xmlMemBlocks()) {
24647 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024649 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024650 printf(" %d", n_ctxt);
24651 printf(" %d", n_elem);
24652 printf("\n");
24653 }
24654 }
24655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024656 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024657#endif
24658
Daniel Veillard42595322004-11-08 10:52:06 +000024659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024660}
24661
24662
24663static int
24664test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024666
William M. Brack21e4ef22005-01-02 09:53:13 +000024667#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024668 int mem_base;
24669 xmlChar * ret_val;
24670 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24671 int n_ctxt;
24672 xmlDocPtr doc; /* the document */
24673 int n_doc;
24674 xmlNodePtr elem; /* the parent */
24675 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024676 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024677 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024678 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024679 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024680
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024681 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24682 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24683 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24684 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24685 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24686 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024687 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24688 doc = gen_xmlDocPtr(n_doc, 1);
24689 elem = gen_xmlNodePtr(n_elem, 2);
24690 name = gen_const_xmlChar_ptr(n_name, 3);
24691 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024692
William M. Brackf13f77f2004-11-12 16:03:48 +000024693 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024694 desret_xmlChar_ptr(ret_val);
24695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024696 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24697 des_xmlDocPtr(n_doc, doc, 1);
24698 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024699 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24700 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024701 xmlResetLastError();
24702 if (mem_base != xmlMemBlocks()) {
24703 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024705 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024706 printf(" %d", n_ctxt);
24707 printf(" %d", n_doc);
24708 printf(" %d", n_elem);
24709 printf(" %d", n_name);
24710 printf(" %d", n_value);
24711 printf("\n");
24712 }
24713 }
24714 }
24715 }
24716 }
24717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024718 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024719#endif
24720
Daniel Veillard42595322004-11-08 10:52:06 +000024721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024722}
24723
24724
Daniel Veillardce682bc2004-11-05 17:22:25 +000024725#define gen_nb_xmlElementContent_ptr 1
24726static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24727 return(NULL);
24728}
24729static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24730}
24731
Daniel Veillardd93f6252004-11-02 15:53:51 +000024732static int
24733test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024735
William M. Brack21e4ef22005-01-02 09:53:13 +000024736#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024737#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024738 int mem_base;
24739 int ret_val;
24740 xmlElementContent * ctree; /* an element content tree */
24741 int n_ctree;
24742 xmlChar ** list; /* an array to store the list of child names */
24743 int n_list;
24744 int * len; /* a pointer to the number of element in the list */
24745 int n_len;
24746 int max; /* the size of the array */
24747 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024748
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024749 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24750 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24751 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24752 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24753 mem_base = xmlMemBlocks();
24754 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24755 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24756 len = gen_int_ptr(n_len, 2);
24757 max = gen_int(n_max, 3);
24758
William M. Brackf13f77f2004-11-12 16:03:48 +000024759 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024760 desret_int(ret_val);
24761 call_tests++;
24762 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024763 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024764 des_int_ptr(n_len, len, 2);
24765 des_int(n_max, max, 3);
24766 xmlResetLastError();
24767 if (mem_base != xmlMemBlocks()) {
24768 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024770 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024771 printf(" %d", n_ctree);
24772 printf(" %d", n_list);
24773 printf(" %d", n_len);
24774 printf(" %d", n_max);
24775 printf("\n");
24776 }
24777 }
24778 }
24779 }
24780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024781 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024782#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024783#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024784
Daniel Veillard42595322004-11-08 10:52:06 +000024785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024786}
24787
24788
24789static int
24790test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024792
William M. Brack21e4ef22005-01-02 09:53:13 +000024793#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024794#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024795 int mem_base;
24796 int ret_val;
24797 xmlNode * prev; /* an element to insert after */
24798 int n_prev;
24799 xmlNode * next; /* an element to insert next */
24800 int n_next;
24801 xmlChar ** names; /* an array to store the list of child names */
24802 int n_names;
24803 int max; /* the size of the array */
24804 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024805
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024806 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24807 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24808 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24809 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24810 mem_base = xmlMemBlocks();
24811 prev = gen_xmlNodePtr(n_prev, 0);
24812 next = gen_xmlNodePtr(n_next, 1);
24813 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24814 max = gen_int(n_max, 3);
24815
William M. Brackf13f77f2004-11-12 16:03:48 +000024816 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024817 desret_int(ret_val);
24818 call_tests++;
24819 des_xmlNodePtr(n_prev, prev, 0);
24820 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024821 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024822 des_int(n_max, max, 3);
24823 xmlResetLastError();
24824 if (mem_base != xmlMemBlocks()) {
24825 printf("Leak of %d blocks found in xmlValidGetValidElements",
24826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024827 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024828 printf(" %d", n_prev);
24829 printf(" %d", n_next);
24830 printf(" %d", n_names);
24831 printf(" %d", n_max);
24832 printf("\n");
24833 }
24834 }
24835 }
24836 }
24837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024838 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024839#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024840#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024841
Daniel Veillard42595322004-11-08 10:52:06 +000024842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024843}
24844
24845
24846static int
24847test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024849
William M. Brack21e4ef22005-01-02 09:53:13 +000024850#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024851 int mem_base;
24852 xmlChar * ret_val;
24853 xmlDocPtr doc; /* the document */
24854 int n_doc;
24855 xmlNodePtr elem; /* the parent */
24856 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024857 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024858 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024859 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024860 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024861
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024862 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24863 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24864 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24865 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024867 doc = gen_xmlDocPtr(n_doc, 0);
24868 elem = gen_xmlNodePtr(n_elem, 1);
24869 name = gen_const_xmlChar_ptr(n_name, 2);
24870 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024871
William M. Brackf13f77f2004-11-12 16:03:48 +000024872 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024873 desret_xmlChar_ptr(ret_val);
24874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024875 des_xmlDocPtr(n_doc, doc, 0);
24876 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024877 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24878 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024879 xmlResetLastError();
24880 if (mem_base != xmlMemBlocks()) {
24881 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024883 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024884 printf(" %d", n_doc);
24885 printf(" %d", n_elem);
24886 printf(" %d", n_name);
24887 printf(" %d", n_value);
24888 printf("\n");
24889 }
24890 }
24891 }
24892 }
24893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024894 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024895#endif
24896
Daniel Veillard42595322004-11-08 10:52:06 +000024897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024898}
24899
24900
24901static int
24902test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024904
William M. Brack21e4ef22005-01-02 09:53:13 +000024905#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024906 int mem_base;
24907 int ret_val;
24908 xmlValidCtxtPtr ctxt; /* the validation context */
24909 int n_ctxt;
24910 xmlDocPtr doc; /* a document instance */
24911 int n_doc;
24912 xmlAttributePtr attr; /* an attribute definition */
24913 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024914
Daniel Veillardce682bc2004-11-05 17:22:25 +000024915 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24916 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24917 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24918 mem_base = xmlMemBlocks();
24919 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24920 doc = gen_xmlDocPtr(n_doc, 1);
24921 attr = gen_xmlAttributePtr(n_attr, 2);
24922
24923 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24924 desret_int(ret_val);
24925 call_tests++;
24926 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24927 des_xmlDocPtr(n_doc, doc, 1);
24928 des_xmlAttributePtr(n_attr, attr, 2);
24929 xmlResetLastError();
24930 if (mem_base != xmlMemBlocks()) {
24931 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024933 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024934 printf(" %d", n_ctxt);
24935 printf(" %d", n_doc);
24936 printf(" %d", n_attr);
24937 printf("\n");
24938 }
24939 }
24940 }
24941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024942 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024943#endif
24944
Daniel Veillard42595322004-11-08 10:52:06 +000024945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024946}
24947
24948
24949static int
24950test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024952
William M. Brack21e4ef22005-01-02 09:53:13 +000024953#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000024954 int mem_base;
24955 int ret_val;
24956 xmlAttributeType type; /* an attribute type */
24957 int n_type;
24958 xmlChar * value; /* an attribute value */
24959 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024960
Daniel Veillard57b25162004-11-06 14:50:18 +000024961 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24962 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24963 mem_base = xmlMemBlocks();
24964 type = gen_xmlAttributeType(n_type, 0);
24965 value = gen_const_xmlChar_ptr(n_value, 1);
24966
William M. Brackf13f77f2004-11-12 16:03:48 +000024967 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024968 desret_int(ret_val);
24969 call_tests++;
24970 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024971 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024972 xmlResetLastError();
24973 if (mem_base != xmlMemBlocks()) {
24974 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024976 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024977 printf(" %d", n_type);
24978 printf(" %d", n_value);
24979 printf("\n");
24980 }
24981 }
24982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024983 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024984#endif
24985
Daniel Veillard42595322004-11-08 10:52:06 +000024986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024987}
24988
24989
24990static int
24991test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024993
William M. Brack21e4ef22005-01-02 09:53:13 +000024994#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024995 int mem_base;
24996 int ret_val;
24997 xmlValidCtxtPtr ctxt; /* the validation context */
24998 int n_ctxt;
24999 xmlDocPtr doc; /* a document instance */
25000 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025001
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025002 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25003 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025005 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25006 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025007
25008 ret_val = xmlValidateDocument(ctxt, doc);
25009 desret_int(ret_val);
25010 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025011 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25012 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025013 xmlResetLastError();
25014 if (mem_base != xmlMemBlocks()) {
25015 printf("Leak of %d blocks found in xmlValidateDocument",
25016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025017 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025018 printf(" %d", n_ctxt);
25019 printf(" %d", n_doc);
25020 printf("\n");
25021 }
25022 }
25023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025024 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025025#endif
25026
Daniel Veillard42595322004-11-08 10:52:06 +000025027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025028}
25029
25030
25031static int
25032test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025034
William M. Brack21e4ef22005-01-02 09:53:13 +000025035#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025036 int mem_base;
25037 int ret_val;
25038 xmlValidCtxtPtr ctxt; /* the validation context */
25039 int n_ctxt;
25040 xmlDocPtr doc; /* a document instance */
25041 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025042
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025043 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25044 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25045 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025046 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25047 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025048
25049 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25050 desret_int(ret_val);
25051 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025052 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25053 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025054 xmlResetLastError();
25055 if (mem_base != xmlMemBlocks()) {
25056 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025058 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025059 printf(" %d", n_ctxt);
25060 printf(" %d", n_doc);
25061 printf("\n");
25062 }
25063 }
25064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025065 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025066#endif
25067
Daniel Veillard42595322004-11-08 10:52:06 +000025068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025069}
25070
25071
25072static int
25073test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025075
William M. Brack21e4ef22005-01-02 09:53:13 +000025076#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025077 int mem_base;
25078 int ret_val;
25079 xmlValidCtxtPtr ctxt; /* the validation context */
25080 int n_ctxt;
25081 xmlDocPtr doc; /* a document instance */
25082 int n_doc;
25083 xmlDtdPtr dtd; /* a dtd instance */
25084 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025085
Daniel Veillard27f20102004-11-05 11:50:11 +000025086 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25087 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25088 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25089 mem_base = xmlMemBlocks();
25090 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25091 doc = gen_xmlDocPtr(n_doc, 1);
25092 dtd = gen_xmlDtdPtr(n_dtd, 2);
25093
25094 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25095 desret_int(ret_val);
25096 call_tests++;
25097 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25098 des_xmlDocPtr(n_doc, doc, 1);
25099 des_xmlDtdPtr(n_dtd, dtd, 2);
25100 xmlResetLastError();
25101 if (mem_base != xmlMemBlocks()) {
25102 printf("Leak of %d blocks found in xmlValidateDtd",
25103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025104 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025105 printf(" %d", n_ctxt);
25106 printf(" %d", n_doc);
25107 printf(" %d", n_dtd);
25108 printf("\n");
25109 }
25110 }
25111 }
25112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025113 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025114#endif
25115
Daniel Veillard42595322004-11-08 10:52:06 +000025116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025117}
25118
25119
25120static int
25121test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025123
William M. Brack21e4ef22005-01-02 09:53:13 +000025124#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025125 int mem_base;
25126 int ret_val;
25127 xmlValidCtxtPtr ctxt; /* the validation context */
25128 int n_ctxt;
25129 xmlDocPtr doc; /* a document instance */
25130 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025131
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025132 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25134 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025135 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25136 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025137
25138 ret_val = xmlValidateDtdFinal(ctxt, doc);
25139 desret_int(ret_val);
25140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025141 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25142 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025143 xmlResetLastError();
25144 if (mem_base != xmlMemBlocks()) {
25145 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025147 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025148 printf(" %d", n_ctxt);
25149 printf(" %d", n_doc);
25150 printf("\n");
25151 }
25152 }
25153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025154 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025155#endif
25156
Daniel Veillard42595322004-11-08 10:52:06 +000025157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025158}
25159
25160
25161static int
25162test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025164
William M. Brack21e4ef22005-01-02 09:53:13 +000025165#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025166 int mem_base;
25167 int ret_val;
25168 xmlValidCtxtPtr ctxt; /* the validation context */
25169 int n_ctxt;
25170 xmlDocPtr doc; /* a document instance */
25171 int n_doc;
25172 xmlNodePtr elem; /* an element instance */
25173 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025174
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025175 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25176 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25177 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25178 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025179 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25180 doc = gen_xmlDocPtr(n_doc, 1);
25181 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025182
25183 ret_val = xmlValidateElement(ctxt, doc, elem);
25184 desret_int(ret_val);
25185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025186 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25187 des_xmlDocPtr(n_doc, doc, 1);
25188 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025189 xmlResetLastError();
25190 if (mem_base != xmlMemBlocks()) {
25191 printf("Leak of %d blocks found in xmlValidateElement",
25192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025193 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025194 printf(" %d", n_ctxt);
25195 printf(" %d", n_doc);
25196 printf(" %d", n_elem);
25197 printf("\n");
25198 }
25199 }
25200 }
25201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025202 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025203#endif
25204
Daniel Veillard42595322004-11-08 10:52:06 +000025205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025206}
25207
25208
25209static int
25210test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025212
William M. Brack21e4ef22005-01-02 09:53:13 +000025213#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025214 int mem_base;
25215 int ret_val;
25216 xmlValidCtxtPtr ctxt; /* the validation context */
25217 int n_ctxt;
25218 xmlDocPtr doc; /* a document instance */
25219 int n_doc;
25220 xmlElementPtr elem; /* an element definition */
25221 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025222
Daniel Veillardce682bc2004-11-05 17:22:25 +000025223 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25224 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25225 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25226 mem_base = xmlMemBlocks();
25227 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25228 doc = gen_xmlDocPtr(n_doc, 1);
25229 elem = gen_xmlElementPtr(n_elem, 2);
25230
25231 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25232 desret_int(ret_val);
25233 call_tests++;
25234 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25235 des_xmlDocPtr(n_doc, doc, 1);
25236 des_xmlElementPtr(n_elem, elem, 2);
25237 xmlResetLastError();
25238 if (mem_base != xmlMemBlocks()) {
25239 printf("Leak of %d blocks found in xmlValidateElementDecl",
25240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025241 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025242 printf(" %d", n_ctxt);
25243 printf(" %d", n_doc);
25244 printf(" %d", n_elem);
25245 printf("\n");
25246 }
25247 }
25248 }
25249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025250 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025251#endif
25252
Daniel Veillard42595322004-11-08 10:52:06 +000025253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025254}
25255
25256
25257static int
25258test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025260
William M. Brack21e4ef22005-01-02 09:53:13 +000025261#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262 int mem_base;
25263 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025264 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025265 int n_value;
25266
25267 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025269 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025270
William M. Brackf13f77f2004-11-12 16:03:48 +000025271 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025272 desret_int(ret_val);
25273 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025274 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025275 xmlResetLastError();
25276 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025277 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025279 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025280 printf(" %d", n_value);
25281 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025282 }
25283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025284 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025285#endif
25286
Daniel Veillard42595322004-11-08 10:52:06 +000025287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025288}
25289
25290
25291static int
25292test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025294
William M. Brack21e4ef22005-01-02 09:53:13 +000025295#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296 int mem_base;
25297 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025298 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025299 int n_value;
25300
25301 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25302 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025303 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025304
William M. Brackf13f77f2004-11-12 16:03:48 +000025305 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025306 desret_int(ret_val);
25307 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025308 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025309 xmlResetLastError();
25310 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025311 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025313 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025314 printf(" %d", n_value);
25315 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025316 }
25317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025318 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025319#endif
25320
Daniel Veillard42595322004-11-08 10:52:06 +000025321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025322}
25323
25324
25325static int
25326test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025328
William M. Brack21e4ef22005-01-02 09:53:13 +000025329#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025330 int mem_base;
25331 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025332 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025333 int n_value;
25334
25335 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25336 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025337 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025338
William M. Brackf13f77f2004-11-12 16:03:48 +000025339 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025340 desret_int(ret_val);
25341 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025342 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025343 xmlResetLastError();
25344 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025345 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025347 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025348 printf(" %d", n_value);
25349 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350 }
25351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025352 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025353#endif
25354
Daniel Veillard42595322004-11-08 10:52:06 +000025355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356}
25357
25358
25359static int
25360test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025362
William M. Brack21e4ef22005-01-02 09:53:13 +000025363#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025364 int mem_base;
25365 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025366 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025367 int n_value;
25368
25369 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025371 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025372
William M. Brackf13f77f2004-11-12 16:03:48 +000025373 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025374 desret_int(ret_val);
25375 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025376 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025377 xmlResetLastError();
25378 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025379 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025381 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025382 printf(" %d", n_value);
25383 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025384 }
25385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025386 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025387#endif
25388
Daniel Veillard42595322004-11-08 10:52:06 +000025389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025390}
25391
25392
25393static int
25394test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025396
William M. Brack21e4ef22005-01-02 09:53:13 +000025397#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025398 int mem_base;
25399 int ret_val;
25400 xmlValidCtxtPtr ctxt; /* the validation context */
25401 int n_ctxt;
25402 xmlDocPtr doc; /* a document instance */
25403 int n_doc;
25404 xmlNotationPtr nota; /* a notation definition */
25405 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025406
Daniel Veillardce682bc2004-11-05 17:22:25 +000025407 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25408 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25409 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25410 mem_base = xmlMemBlocks();
25411 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25412 doc = gen_xmlDocPtr(n_doc, 1);
25413 nota = gen_xmlNotationPtr(n_nota, 2);
25414
25415 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25416 desret_int(ret_val);
25417 call_tests++;
25418 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25419 des_xmlDocPtr(n_doc, doc, 1);
25420 des_xmlNotationPtr(n_nota, nota, 2);
25421 xmlResetLastError();
25422 if (mem_base != xmlMemBlocks()) {
25423 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025425 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025426 printf(" %d", n_ctxt);
25427 printf(" %d", n_doc);
25428 printf(" %d", n_nota);
25429 printf("\n");
25430 }
25431 }
25432 }
25433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025434 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025435#endif
25436
Daniel Veillard42595322004-11-08 10:52:06 +000025437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025438}
25439
25440
25441static int
25442test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025444
William M. Brack21e4ef22005-01-02 09:53:13 +000025445#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025446 int mem_base;
25447 int ret_val;
25448 xmlValidCtxtPtr ctxt; /* the validation context */
25449 int n_ctxt;
25450 xmlDocPtr doc; /* the document */
25451 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025452 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025453 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025455 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25456 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25457 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25458 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025459 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25460 doc = gen_xmlDocPtr(n_doc, 1);
25461 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025462
William M. Brackf13f77f2004-11-12 16:03:48 +000025463 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025464 desret_int(ret_val);
25465 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025466 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25467 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025468 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025469 xmlResetLastError();
25470 if (mem_base != xmlMemBlocks()) {
25471 printf("Leak of %d blocks found in xmlValidateNotationUse",
25472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025473 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025474 printf(" %d", n_ctxt);
25475 printf(" %d", n_doc);
25476 printf(" %d", n_notationName);
25477 printf("\n");
25478 }
25479 }
25480 }
25481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025482 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025483#endif
25484
Daniel Veillard42595322004-11-08 10:52:06 +000025485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025486}
25487
25488
25489static int
25490test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025492
William M. Brack21e4ef22005-01-02 09:53:13 +000025493#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025494 int mem_base;
25495 int ret_val;
25496 xmlValidCtxtPtr ctxt; /* the validation context */
25497 int n_ctxt;
25498 xmlDocPtr doc; /* a document instance */
25499 int n_doc;
25500 xmlNodePtr elem; /* an element instance */
25501 int n_elem;
25502 xmlAttrPtr attr; /* an attribute instance */
25503 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025504 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025505 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025506
Daniel Veillardce244ad2004-11-05 10:03:46 +000025507 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25508 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25509 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25510 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25511 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25512 mem_base = xmlMemBlocks();
25513 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25514 doc = gen_xmlDocPtr(n_doc, 1);
25515 elem = gen_xmlNodePtr(n_elem, 2);
25516 attr = gen_xmlAttrPtr(n_attr, 3);
25517 value = gen_const_xmlChar_ptr(n_value, 4);
25518
William M. Brackf13f77f2004-11-12 16:03:48 +000025519 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025520 desret_int(ret_val);
25521 call_tests++;
25522 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25523 des_xmlDocPtr(n_doc, doc, 1);
25524 des_xmlNodePtr(n_elem, elem, 2);
25525 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025526 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025527 xmlResetLastError();
25528 if (mem_base != xmlMemBlocks()) {
25529 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025531 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025532 printf(" %d", n_ctxt);
25533 printf(" %d", n_doc);
25534 printf(" %d", n_elem);
25535 printf(" %d", n_attr);
25536 printf(" %d", n_value);
25537 printf("\n");
25538 }
25539 }
25540 }
25541 }
25542 }
25543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025544 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025545#endif
25546
Daniel Veillard42595322004-11-08 10:52:06 +000025547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025548}
25549
25550
25551static int
25552test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025554
William M. Brack21e4ef22005-01-02 09:53:13 +000025555#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025556 int mem_base;
25557 int ret_val;
25558 xmlValidCtxtPtr ctxt; /* the validation context */
25559 int n_ctxt;
25560 xmlDocPtr doc; /* a document instance */
25561 int n_doc;
25562 xmlNodePtr elem; /* an element instance */
25563 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025564
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025565 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25566 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25567 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025569 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25570 doc = gen_xmlDocPtr(n_doc, 1);
25571 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025572
25573 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25574 desret_int(ret_val);
25575 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025576 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25577 des_xmlDocPtr(n_doc, doc, 1);
25578 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025579 xmlResetLastError();
25580 if (mem_base != xmlMemBlocks()) {
25581 printf("Leak of %d blocks found in xmlValidateOneElement",
25582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025583 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025584 printf(" %d", n_ctxt);
25585 printf(" %d", n_doc);
25586 printf(" %d", n_elem);
25587 printf("\n");
25588 }
25589 }
25590 }
25591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025592 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025593#endif
25594
Daniel Veillard42595322004-11-08 10:52:06 +000025595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025596}
25597
25598
25599static int
25600test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025602
William M. Brack21e4ef22005-01-02 09:53:13 +000025603#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025604 int mem_base;
25605 int ret_val;
25606 xmlValidCtxtPtr ctxt; /* the validation context */
25607 int n_ctxt;
25608 xmlDocPtr doc; /* a document instance */
25609 int n_doc;
25610 xmlNodePtr elem; /* an element instance */
25611 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025612 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025613 int n_prefix;
25614 xmlNsPtr ns; /* an namespace declaration instance */
25615 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025616 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025617 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025618
Daniel Veillard27f20102004-11-05 11:50:11 +000025619 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25620 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25621 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25622 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25623 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25624 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25625 mem_base = xmlMemBlocks();
25626 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25627 doc = gen_xmlDocPtr(n_doc, 1);
25628 elem = gen_xmlNodePtr(n_elem, 2);
25629 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25630 ns = gen_xmlNsPtr(n_ns, 4);
25631 value = gen_const_xmlChar_ptr(n_value, 5);
25632
William M. Brackf13f77f2004-11-12 16:03:48 +000025633 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025634 desret_int(ret_val);
25635 call_tests++;
25636 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25637 des_xmlDocPtr(n_doc, doc, 1);
25638 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025639 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025640 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025641 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025642 xmlResetLastError();
25643 if (mem_base != xmlMemBlocks()) {
25644 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025646 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025647 printf(" %d", n_ctxt);
25648 printf(" %d", n_doc);
25649 printf(" %d", n_elem);
25650 printf(" %d", n_prefix);
25651 printf(" %d", n_ns);
25652 printf(" %d", n_value);
25653 printf("\n");
25654 }
25655 }
25656 }
25657 }
25658 }
25659 }
25660 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025661 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025662#endif
25663
Daniel Veillard42595322004-11-08 10:52:06 +000025664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025665}
25666
25667
25668static int
25669test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025671
William M. Brack21e4ef22005-01-02 09:53:13 +000025672#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025673 int mem_base;
25674 int ret_val;
25675 xmlValidCtxtPtr ctxt; /* the validation context */
25676 int n_ctxt;
25677 xmlDocPtr doc; /* a document instance */
25678 int n_doc;
25679 xmlNodePtr elem; /* an element instance */
25680 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025681 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025682 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025683
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025684 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25685 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25686 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25687 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025689 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25690 doc = gen_xmlDocPtr(n_doc, 1);
25691 elem = gen_xmlNodePtr(n_elem, 2);
25692 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025693
William M. Brackf13f77f2004-11-12 16:03:48 +000025694 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025695 desret_int(ret_val);
25696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025697 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25698 des_xmlDocPtr(n_doc, doc, 1);
25699 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025700 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025701 xmlResetLastError();
25702 if (mem_base != xmlMemBlocks()) {
25703 printf("Leak of %d blocks found in xmlValidatePopElement",
25704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025705 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025706 printf(" %d", n_ctxt);
25707 printf(" %d", n_doc);
25708 printf(" %d", n_elem);
25709 printf(" %d", n_qname);
25710 printf("\n");
25711 }
25712 }
25713 }
25714 }
25715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025716 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025717#endif
25718
Daniel Veillard42595322004-11-08 10:52:06 +000025719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025720}
25721
25722
25723static int
25724test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025726
William M. Brack21e4ef22005-01-02 09:53:13 +000025727#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025728 int mem_base;
25729 int ret_val;
25730 xmlValidCtxtPtr ctxt; /* the validation context */
25731 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025732 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025733 int n_data;
25734 int len; /* the lenght of the data */
25735 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025736
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025737 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25738 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25739 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025741 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25742 data = gen_const_xmlChar_ptr(n_data, 1);
25743 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025744
William M. Brackf13f77f2004-11-12 16:03:48 +000025745 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025746 desret_int(ret_val);
25747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025748 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025749 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025750 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025751 xmlResetLastError();
25752 if (mem_base != xmlMemBlocks()) {
25753 printf("Leak of %d blocks found in xmlValidatePushCData",
25754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025755 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025756 printf(" %d", n_ctxt);
25757 printf(" %d", n_data);
25758 printf(" %d", n_len);
25759 printf("\n");
25760 }
25761 }
25762 }
25763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025764 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025765#endif
25766
Daniel Veillard42595322004-11-08 10:52:06 +000025767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025768}
25769
25770
25771static int
25772test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025774
William M. Brack21e4ef22005-01-02 09:53:13 +000025775#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025776 int mem_base;
25777 int ret_val;
25778 xmlValidCtxtPtr ctxt; /* the validation context */
25779 int n_ctxt;
25780 xmlDocPtr doc; /* a document instance */
25781 int n_doc;
25782 xmlNodePtr elem; /* an element instance */
25783 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025784 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025785 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025786
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025787 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25788 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25789 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25790 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025792 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25793 doc = gen_xmlDocPtr(n_doc, 1);
25794 elem = gen_xmlNodePtr(n_elem, 2);
25795 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025796
William M. Brackf13f77f2004-11-12 16:03:48 +000025797 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025798 desret_int(ret_val);
25799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025800 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25801 des_xmlDocPtr(n_doc, doc, 1);
25802 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025803 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025804 xmlResetLastError();
25805 if (mem_base != xmlMemBlocks()) {
25806 printf("Leak of %d blocks found in xmlValidatePushElement",
25807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025808 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025809 printf(" %d", n_ctxt);
25810 printf(" %d", n_doc);
25811 printf(" %d", n_elem);
25812 printf(" %d", n_qname);
25813 printf("\n");
25814 }
25815 }
25816 }
25817 }
25818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025819 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025820#endif
25821
Daniel Veillard42595322004-11-08 10:52:06 +000025822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025823}
25824
25825
25826static int
25827test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025829
William M. Brack21e4ef22005-01-02 09:53:13 +000025830#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025831 int mem_base;
25832 int ret_val;
25833 xmlValidCtxtPtr ctxt; /* the validation context */
25834 int n_ctxt;
25835 xmlDocPtr doc; /* a document instance */
25836 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025837
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25839 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025841 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25842 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025843
25844 ret_val = xmlValidateRoot(ctxt, doc);
25845 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);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025849 xmlResetLastError();
25850 if (mem_base != xmlMemBlocks()) {
25851 printf("Leak of %d blocks found in xmlValidateRoot",
25852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025853 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025854 printf(" %d", n_ctxt);
25855 printf(" %d", n_doc);
25856 printf("\n");
25857 }
25858 }
25859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025860 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025861#endif
25862
Daniel Veillard42595322004-11-08 10:52:06 +000025863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025864}
25865
25866static int
25867test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025869
Daniel Veillard2ae13382005-01-25 23:45:06 +000025870 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025871 test_ret += test_xmlAddAttributeDecl();
25872 test_ret += test_xmlAddElementDecl();
25873 test_ret += test_xmlAddID();
25874 test_ret += test_xmlAddNotationDecl();
25875 test_ret += test_xmlAddRef();
25876 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000025877 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000025878 test_ret += test_xmlCopyElementContent();
25879 test_ret += test_xmlCopyElementTable();
25880 test_ret += test_xmlCopyEnumeration();
25881 test_ret += test_xmlCopyNotationTable();
25882 test_ret += test_xmlCreateEnumeration();
25883 test_ret += test_xmlDumpAttributeDecl();
25884 test_ret += test_xmlDumpAttributeTable();
25885 test_ret += test_xmlDumpElementDecl();
25886 test_ret += test_xmlDumpElementTable();
25887 test_ret += test_xmlDumpNotationDecl();
25888 test_ret += test_xmlDumpNotationTable();
25889 test_ret += test_xmlGetDtdAttrDesc();
25890 test_ret += test_xmlGetDtdElementDesc();
25891 test_ret += test_xmlGetDtdNotationDesc();
25892 test_ret += test_xmlGetDtdQAttrDesc();
25893 test_ret += test_xmlGetDtdQElementDesc();
25894 test_ret += test_xmlGetID();
25895 test_ret += test_xmlGetRefs();
25896 test_ret += test_xmlIsID();
25897 test_ret += test_xmlIsMixedElement();
25898 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000025899 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000025900 test_ret += test_xmlNewElementContent();
25901 test_ret += test_xmlNewValidCtxt();
25902 test_ret += test_xmlRemoveID();
25903 test_ret += test_xmlRemoveRef();
25904 test_ret += test_xmlSnprintfElementContent();
25905 test_ret += test_xmlSprintfElementContent();
25906 test_ret += test_xmlValidBuildContentModel();
25907 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25908 test_ret += test_xmlValidGetPotentialChildren();
25909 test_ret += test_xmlValidGetValidElements();
25910 test_ret += test_xmlValidNormalizeAttributeValue();
25911 test_ret += test_xmlValidateAttributeDecl();
25912 test_ret += test_xmlValidateAttributeValue();
25913 test_ret += test_xmlValidateDocument();
25914 test_ret += test_xmlValidateDocumentFinal();
25915 test_ret += test_xmlValidateDtd();
25916 test_ret += test_xmlValidateDtdFinal();
25917 test_ret += test_xmlValidateElement();
25918 test_ret += test_xmlValidateElementDecl();
25919 test_ret += test_xmlValidateNameValue();
25920 test_ret += test_xmlValidateNamesValue();
25921 test_ret += test_xmlValidateNmtokenValue();
25922 test_ret += test_xmlValidateNmtokensValue();
25923 test_ret += test_xmlValidateNotationDecl();
25924 test_ret += test_xmlValidateNotationUse();
25925 test_ret += test_xmlValidateOneAttribute();
25926 test_ret += test_xmlValidateOneElement();
25927 test_ret += test_xmlValidateOneNamespace();
25928 test_ret += test_xmlValidatePopElement();
25929 test_ret += test_xmlValidatePushCData();
25930 test_ret += test_xmlValidatePushElement();
25931 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025932
Daniel Veillard42595322004-11-08 10:52:06 +000025933 if (test_ret != 0)
25934 printf("Module valid: %d errors\n", test_ret);
25935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025936}
25937
25938static int
25939test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025941
25942
25943 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025945}
25946
25947
25948static int
25949test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025951
William M. Brack21e4ef22005-01-02 09:53:13 +000025952#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025953 int mem_base;
25954 int ret_val;
25955 xmlDocPtr doc; /* an XML document */
25956 int n_doc;
25957
25958 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25959 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025960 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025961
25962 ret_val = xmlXIncludeProcess(doc);
25963 desret_int(ret_val);
25964 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025965 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025966 xmlResetLastError();
25967 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025968 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025970 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025971 printf(" %d", n_doc);
25972 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025973 }
25974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025975 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025976#endif
25977
Daniel Veillard42595322004-11-08 10:52:06 +000025978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025979}
25980
25981
25982static int
25983test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025985
William M. Brack21e4ef22005-01-02 09:53:13 +000025986#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025987 int mem_base;
25988 int ret_val;
25989 xmlDocPtr doc; /* an XML document */
25990 int n_doc;
25991 int flags; /* a set of xmlParserOption used for parsing XML includes */
25992 int n_flags;
25993
25994 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25995 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025997 doc = gen_xmlDocPtr(n_doc, 0);
25998 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999
26000 ret_val = xmlXIncludeProcessFlags(doc, flags);
26001 desret_int(ret_val);
26002 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026003 des_xmlDocPtr(n_doc, doc, 0);
26004 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026005 xmlResetLastError();
26006 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026007 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026009 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026010 printf(" %d", n_doc);
26011 printf(" %d", n_flags);
26012 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026013 }
26014 }
26015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026016 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026017#endif
26018
Daniel Veillard42595322004-11-08 10:52:06 +000026019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020}
26021
Daniel Veillarda521d282004-11-09 14:59:59 +000026022#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026023
Daniel Veillardce682bc2004-11-05 17:22:25 +000026024#define gen_nb_xmlXIncludeCtxtPtr 1
26025static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26026 return(NULL);
26027}
26028static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26029}
Daniel Veillarda521d282004-11-09 14:59:59 +000026030#endif
26031
Daniel Veillardce682bc2004-11-05 17:22:25 +000026032
Daniel Veillardd93f6252004-11-02 15:53:51 +000026033static int
26034test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026036
William M. Brack21e4ef22005-01-02 09:53:13 +000026037#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026038 int mem_base;
26039 int ret_val;
26040 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26041 int n_ctxt;
26042 xmlNodePtr node; /* a node in an XML document */
26043 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026044
Daniel Veillardce682bc2004-11-05 17:22:25 +000026045 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26046 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26047 mem_base = xmlMemBlocks();
26048 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26049 node = gen_xmlNodePtr(n_node, 1);
26050
26051 ret_val = xmlXIncludeProcessNode(ctxt, node);
26052 desret_int(ret_val);
26053 call_tests++;
26054 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26055 des_xmlNodePtr(n_node, node, 1);
26056 xmlResetLastError();
26057 if (mem_base != xmlMemBlocks()) {
26058 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026060 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026061 printf(" %d", n_ctxt);
26062 printf(" %d", n_node);
26063 printf("\n");
26064 }
26065 }
26066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026067 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026068#endif
26069
Daniel Veillard42595322004-11-08 10:52:06 +000026070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026071}
26072
26073
26074static int
26075test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026077
William M. Brack21e4ef22005-01-02 09:53:13 +000026078#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026079 int mem_base;
26080 int ret_val;
26081 xmlNodePtr tree; /* a node in an XML document */
26082 int n_tree;
26083
26084 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26085 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026086 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026087
26088 ret_val = xmlXIncludeProcessTree(tree);
26089 desret_int(ret_val);
26090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026091 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026092 xmlResetLastError();
26093 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026094 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026096 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026097 printf(" %d", n_tree);
26098 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026099 }
26100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026101 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026102#endif
26103
Daniel Veillard42595322004-11-08 10:52:06 +000026104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026105}
26106
26107
26108static int
26109test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111
William M. Brack21e4ef22005-01-02 09:53:13 +000026112#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026113 int mem_base;
26114 int ret_val;
26115 xmlNodePtr tree; /* a node in an XML document */
26116 int n_tree;
26117 int flags; /* a set of xmlParserOption used for parsing XML includes */
26118 int n_flags;
26119
26120 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26121 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026123 tree = gen_xmlNodePtr(n_tree, 0);
26124 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026125
26126 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26127 desret_int(ret_val);
26128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026129 des_xmlNodePtr(n_tree, tree, 0);
26130 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026131 xmlResetLastError();
26132 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026133 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026135 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026136 printf(" %d", n_tree);
26137 printf(" %d", n_flags);
26138 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026139 }
26140 }
26141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026142 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026143#endif
26144
Daniel Veillard42595322004-11-08 10:52:06 +000026145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026146}
26147
26148
26149static int
26150test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026152
William M. Brack21e4ef22005-01-02 09:53:13 +000026153#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026154 int mem_base;
26155 int ret_val;
26156 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26157 int n_ctxt;
26158 int flags; /* a set of xmlParserOption used for parsing XML includes */
26159 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026160
Daniel Veillardce682bc2004-11-05 17:22:25 +000026161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26162 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26163 mem_base = xmlMemBlocks();
26164 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26165 flags = gen_int(n_flags, 1);
26166
26167 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26168 desret_int(ret_val);
26169 call_tests++;
26170 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26171 des_int(n_flags, flags, 1);
26172 xmlResetLastError();
26173 if (mem_base != xmlMemBlocks()) {
26174 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026176 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026177 printf(" %d", n_ctxt);
26178 printf(" %d", n_flags);
26179 printf("\n");
26180 }
26181 }
26182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026183 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026184#endif
26185
Daniel Veillard42595322004-11-08 10:52:06 +000026186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026187}
26188
26189static int
26190test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026193 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026194 test_ret += test_xmlXIncludeNewContext();
26195 test_ret += test_xmlXIncludeProcess();
26196 test_ret += test_xmlXIncludeProcessFlags();
26197 test_ret += test_xmlXIncludeProcessNode();
26198 test_ret += test_xmlXIncludeProcessTree();
26199 test_ret += test_xmlXIncludeProcessTreeFlags();
26200 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026201
Daniel Veillard42595322004-11-08 10:52:06 +000026202 if (test_ret != 0)
26203 printf("Module xinclude: %d errors\n", test_ret);
26204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205}
26206
26207static int
26208test_xmlAllocOutputBuffer(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_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026212 int mem_base;
26213 xmlOutputBufferPtr ret_val;
26214 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26215 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026216
Daniel Veillard3d95c732004-11-06 22:25:14 +000026217 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26218 mem_base = xmlMemBlocks();
26219 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26220
26221 ret_val = xmlAllocOutputBuffer(encoder);
26222 desret_xmlOutputBufferPtr(ret_val);
26223 call_tests++;
26224 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26225 xmlResetLastError();
26226 if (mem_base != xmlMemBlocks()) {
26227 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026229 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026230 printf(" %d", n_encoder);
26231 printf("\n");
26232 }
26233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026234 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026235#endif
26236
Daniel Veillard42595322004-11-08 10:52:06 +000026237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026238}
26239
26240
26241static int
26242test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026244
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026245 int mem_base;
26246 xmlParserInputBufferPtr ret_val;
26247 xmlCharEncoding enc; /* the charset encoding if known */
26248 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026249
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026250 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26251 mem_base = xmlMemBlocks();
26252 enc = gen_xmlCharEncoding(n_enc, 0);
26253
26254 ret_val = xmlAllocParserInputBuffer(enc);
26255 desret_xmlParserInputBufferPtr(ret_val);
26256 call_tests++;
26257 des_xmlCharEncoding(n_enc, enc, 0);
26258 xmlResetLastError();
26259 if (mem_base != xmlMemBlocks()) {
26260 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026262 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026263 printf(" %d", n_enc);
26264 printf("\n");
26265 }
26266 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026267 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026268
Daniel Veillard42595322004-11-08 10:52:06 +000026269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026270}
26271
26272
26273static int
26274test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026276
26277 int mem_base;
26278 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026279 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280 int n_path;
26281
26282 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26283 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026284 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026285
William M. Brackf13f77f2004-11-12 16:03:48 +000026286 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026287 desret_int(ret_val);
26288 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026289 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026290 xmlResetLastError();
26291 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026292 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026294 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026295 printf(" %d", n_path);
26296 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026297 }
26298 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026300
Daniel Veillard42595322004-11-08 10:52:06 +000026301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026302}
26303
26304
26305static int
26306test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026308
Daniel Veillard42595322004-11-08 10:52:06 +000026309 int mem_base;
26310 xmlParserInputPtr ret_val;
26311 xmlParserCtxtPtr ctxt; /* an XML parser context */
26312 int n_ctxt;
26313 xmlParserInputPtr ret; /* an XML parser input */
26314 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026315
Daniel Veillard42595322004-11-08 10:52:06 +000026316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26317 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26318 mem_base = xmlMemBlocks();
26319 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26320 ret = gen_xmlParserInputPtr(n_ret, 1);
26321
26322 ret_val = xmlCheckHTTPInput(ctxt, ret);
26323 desret_xmlParserInputPtr(ret_val);
26324 call_tests++;
26325 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26326 des_xmlParserInputPtr(n_ret, ret, 1);
26327 xmlResetLastError();
26328 if (mem_base != xmlMemBlocks()) {
26329 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26330 xmlMemBlocks() - mem_base);
26331 test_ret++;
26332 printf(" %d", n_ctxt);
26333 printf(" %d", n_ret);
26334 printf("\n");
26335 }
26336 }
26337 }
Daniel Veillard42595322004-11-08 10:52:06 +000026338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026339
Daniel Veillard42595322004-11-08 10:52:06 +000026340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026341}
26342
26343
26344static int
26345test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026347
26348 int mem_base;
26349
26350 mem_base = xmlMemBlocks();
26351
26352 xmlCleanupInputCallbacks();
26353 call_tests++;
26354 xmlResetLastError();
26355 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026356 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026358 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026359 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026360 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026361 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026362
Daniel Veillard42595322004-11-08 10:52:06 +000026363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026364}
26365
26366
26367static int
26368test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026370
William M. Brack21e4ef22005-01-02 09:53:13 +000026371#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026372 int mem_base;
26373
26374 mem_base = xmlMemBlocks();
26375
26376 xmlCleanupOutputCallbacks();
26377 call_tests++;
26378 xmlResetLastError();
26379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026380 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026383 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026385 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026386#endif
26387
Daniel Veillard42595322004-11-08 10:52:06 +000026388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026389}
26390
26391
26392static int
26393test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026395
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026396 int mem_base;
26397 int ret_val;
26398 void * context; /* the I/O context */
26399 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026400
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026401 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026403 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026404
26405 ret_val = xmlFileClose(context);
26406 desret_int(ret_val);
26407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026408 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026409 xmlResetLastError();
26410 if (mem_base != xmlMemBlocks()) {
26411 printf("Leak of %d blocks found in xmlFileClose",
26412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026413 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026414 printf(" %d", n_context);
26415 printf("\n");
26416 }
26417 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026419
Daniel Veillard42595322004-11-08 10:52:06 +000026420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026421}
26422
26423
26424static int
26425test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026427
26428 int mem_base;
26429 int ret_val;
26430 const char * filename; /* the URI for matching */
26431 int n_filename;
26432
26433 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026435 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026436
26437 ret_val = xmlFileMatch(filename);
26438 desret_int(ret_val);
26439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026440 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441 xmlResetLastError();
26442 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026443 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026445 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026446 printf(" %d", n_filename);
26447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026448 }
26449 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026451
Daniel Veillard42595322004-11-08 10:52:06 +000026452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026453}
26454
26455
26456static int
26457test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026459
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026460 int mem_base;
26461 void * ret_val;
26462 const char * filename; /* the URI for matching */
26463 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026464
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026465 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026467 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026468
26469 ret_val = xmlFileOpen(filename);
26470 desret_void_ptr(ret_val);
26471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026472 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026473 xmlResetLastError();
26474 if (mem_base != xmlMemBlocks()) {
26475 printf("Leak of %d blocks found in xmlFileOpen",
26476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026477 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026478 printf(" %d", n_filename);
26479 printf("\n");
26480 }
26481 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026483
Daniel Veillard42595322004-11-08 10:52:06 +000026484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026485}
26486
26487
26488static int
26489test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026491
Daniel Veillardce682bc2004-11-05 17:22:25 +000026492 int mem_base;
26493 int ret_val;
26494 void * context; /* the I/O context */
26495 int n_context;
26496 char * buffer; /* where to drop data */
26497 int n_buffer;
26498 int len; /* number of bytes to write */
26499 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026500
Daniel Veillardce682bc2004-11-05 17:22:25 +000026501 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26502 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26503 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26504 mem_base = xmlMemBlocks();
26505 context = gen_void_ptr(n_context, 0);
26506 buffer = gen_char_ptr(n_buffer, 1);
26507 len = gen_int(n_len, 2);
26508
26509 ret_val = xmlFileRead(context, buffer, len);
26510 desret_int(ret_val);
26511 call_tests++;
26512 des_void_ptr(n_context, context, 0);
26513 des_char_ptr(n_buffer, buffer, 1);
26514 des_int(n_len, len, 2);
26515 xmlResetLastError();
26516 if (mem_base != xmlMemBlocks()) {
26517 printf("Leak of %d blocks found in xmlFileRead",
26518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026519 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026520 printf(" %d", n_context);
26521 printf(" %d", n_buffer);
26522 printf(" %d", n_len);
26523 printf("\n");
26524 }
26525 }
26526 }
26527 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026528 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026529
Daniel Veillard42595322004-11-08 10:52:06 +000026530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026531}
26532
26533
26534static int
26535test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026537
William M. Brack21e4ef22005-01-02 09:53:13 +000026538#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026539 int mem_base;
26540 int ret_val;
26541 void * context; /* the I/O context */
26542 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026543
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026544 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026546 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026547
26548 ret_val = xmlIOFTPClose(context);
26549 desret_int(ret_val);
26550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026551 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026552 xmlResetLastError();
26553 if (mem_base != xmlMemBlocks()) {
26554 printf("Leak of %d blocks found in xmlIOFTPClose",
26555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026556 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026557 printf(" %d", n_context);
26558 printf("\n");
26559 }
26560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026561 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026562#endif
26563
Daniel Veillard42595322004-11-08 10:52:06 +000026564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026565}
26566
26567
26568static int
26569test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026571
William M. Brack21e4ef22005-01-02 09:53:13 +000026572#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026573 int mem_base;
26574 int ret_val;
26575 const char * filename; /* the URI for matching */
26576 int n_filename;
26577
26578 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026580 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026581
26582 ret_val = xmlIOFTPMatch(filename);
26583 desret_int(ret_val);
26584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026585 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026586 xmlResetLastError();
26587 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026588 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026590 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026591 printf(" %d", n_filename);
26592 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026593 }
26594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026595 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026596#endif
26597
Daniel Veillard42595322004-11-08 10:52:06 +000026598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026599}
26600
26601
26602static int
26603test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026605
William M. Brack21e4ef22005-01-02 09:53:13 +000026606#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026607 int mem_base;
26608 void * ret_val;
26609 const char * filename; /* the URI for matching */
26610 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026611
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026612 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026614 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026615
26616 ret_val = xmlIOFTPOpen(filename);
26617 desret_void_ptr(ret_val);
26618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026619 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026620 xmlResetLastError();
26621 if (mem_base != xmlMemBlocks()) {
26622 printf("Leak of %d blocks found in xmlIOFTPOpen",
26623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026624 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026625 printf(" %d", n_filename);
26626 printf("\n");
26627 }
26628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026629 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026630#endif
26631
Daniel Veillard42595322004-11-08 10:52:06 +000026632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633}
26634
26635
26636static int
26637test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026639
William M. Brack21e4ef22005-01-02 09:53:13 +000026640#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026641 int mem_base;
26642 int ret_val;
26643 void * context; /* the I/O context */
26644 int n_context;
26645 char * buffer; /* where to drop data */
26646 int n_buffer;
26647 int len; /* number of bytes to write */
26648 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026649
Daniel Veillardce682bc2004-11-05 17:22:25 +000026650 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26651 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26652 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26653 mem_base = xmlMemBlocks();
26654 context = gen_void_ptr(n_context, 0);
26655 buffer = gen_char_ptr(n_buffer, 1);
26656 len = gen_int(n_len, 2);
26657
26658 ret_val = xmlIOFTPRead(context, buffer, len);
26659 desret_int(ret_val);
26660 call_tests++;
26661 des_void_ptr(n_context, context, 0);
26662 des_char_ptr(n_buffer, buffer, 1);
26663 des_int(n_len, len, 2);
26664 xmlResetLastError();
26665 if (mem_base != xmlMemBlocks()) {
26666 printf("Leak of %d blocks found in xmlIOFTPRead",
26667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026668 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026669 printf(" %d", n_context);
26670 printf(" %d", n_buffer);
26671 printf(" %d", n_len);
26672 printf("\n");
26673 }
26674 }
26675 }
26676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026677 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026678#endif
26679
Daniel Veillard42595322004-11-08 10:52:06 +000026680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026681}
26682
26683
26684static int
26685test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026687
William M. Brack21e4ef22005-01-02 09:53:13 +000026688#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026689 int mem_base;
26690 int ret_val;
26691 void * context; /* the I/O context */
26692 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026693
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026694 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26695 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026696 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026697
26698 ret_val = xmlIOHTTPClose(context);
26699 desret_int(ret_val);
26700 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026701 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026702 xmlResetLastError();
26703 if (mem_base != xmlMemBlocks()) {
26704 printf("Leak of %d blocks found in xmlIOHTTPClose",
26705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026706 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026707 printf(" %d", n_context);
26708 printf("\n");
26709 }
26710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026711 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026712#endif
26713
Daniel Veillard42595322004-11-08 10:52:06 +000026714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026715}
26716
26717
26718static int
26719test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026721
William M. Brack21e4ef22005-01-02 09:53:13 +000026722#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026723 int mem_base;
26724 int ret_val;
26725 const char * filename; /* the URI for matching */
26726 int n_filename;
26727
26728 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26729 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026730 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026731
26732 ret_val = xmlIOHTTPMatch(filename);
26733 desret_int(ret_val);
26734 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026735 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026736 xmlResetLastError();
26737 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026738 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026740 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026741 printf(" %d", n_filename);
26742 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026743 }
26744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026745 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026746#endif
26747
Daniel Veillard42595322004-11-08 10:52:06 +000026748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026749}
26750
26751
26752static int
26753test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026755
William M. Brack21e4ef22005-01-02 09:53:13 +000026756#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026757 int mem_base;
26758 void * ret_val;
26759 const char * filename; /* the URI for matching */
26760 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026761
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026762 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026764 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026765
26766 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000026767 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026769 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026770 xmlResetLastError();
26771 if (mem_base != xmlMemBlocks()) {
26772 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026774 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026775 printf(" %d", n_filename);
26776 printf("\n");
26777 }
26778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026779 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026780#endif
26781
Daniel Veillard42595322004-11-08 10:52:06 +000026782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026783}
26784
26785
26786static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026787test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026789
William M. Brack21e4ef22005-01-02 09:53:13 +000026790#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026791 int mem_base;
26792 int ret_val;
26793 void * context; /* the I/O context */
26794 int n_context;
26795 char * buffer; /* where to drop data */
26796 int n_buffer;
26797 int len; /* number of bytes to write */
26798 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026799
Daniel Veillardce682bc2004-11-05 17:22:25 +000026800 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26801 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26802 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26803 mem_base = xmlMemBlocks();
26804 context = gen_void_ptr(n_context, 0);
26805 buffer = gen_char_ptr(n_buffer, 1);
26806 len = gen_int(n_len, 2);
26807
26808 ret_val = xmlIOHTTPRead(context, buffer, len);
26809 desret_int(ret_val);
26810 call_tests++;
26811 des_void_ptr(n_context, context, 0);
26812 des_char_ptr(n_buffer, buffer, 1);
26813 des_int(n_len, len, 2);
26814 xmlResetLastError();
26815 if (mem_base != xmlMemBlocks()) {
26816 printf("Leak of %d blocks found in xmlIOHTTPRead",
26817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026818 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026819 printf(" %d", n_context);
26820 printf(" %d", n_buffer);
26821 printf(" %d", n_len);
26822 printf("\n");
26823 }
26824 }
26825 }
26826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026827 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026828#endif
26829
Daniel Veillard42595322004-11-08 10:52:06 +000026830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026831}
26832
26833
26834static int
26835test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026837
Daniel Veillard42595322004-11-08 10:52:06 +000026838 int mem_base;
26839 xmlParserInputPtr ret_val;
26840 const char * URL; /* the URL for the entity to load */
26841 int n_URL;
26842 char * ID; /* the System ID for the entity to load */
26843 int n_ID;
26844 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26845 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026846
Daniel Veillard42595322004-11-08 10:52:06 +000026847 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26848 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26849 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26850 mem_base = xmlMemBlocks();
26851 URL = gen_filepath(n_URL, 0);
26852 ID = gen_const_char_ptr(n_ID, 1);
26853 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26854
William M. Brackf13f77f2004-11-12 16:03:48 +000026855 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026856 desret_xmlParserInputPtr(ret_val);
26857 call_tests++;
26858 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026859 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026860 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26861 xmlResetLastError();
26862 if (mem_base != xmlMemBlocks()) {
26863 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26864 xmlMemBlocks() - mem_base);
26865 test_ret++;
26866 printf(" %d", n_URL);
26867 printf(" %d", n_ID);
26868 printf(" %d", n_ctxt);
26869 printf("\n");
26870 }
26871 }
26872 }
26873 }
Daniel Veillard42595322004-11-08 10:52:06 +000026874 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026875
Daniel Veillard42595322004-11-08 10:52:06 +000026876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026877}
26878
26879
26880static int
26881test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026883
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026884 int mem_base;
26885 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026886 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026887 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026888
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026889 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026891 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026892
William M. Brackf13f77f2004-11-12 16:03:48 +000026893 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026894 desret_xmlChar_ptr(ret_val);
26895 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026896 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026897 xmlResetLastError();
26898 if (mem_base != xmlMemBlocks()) {
26899 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026901 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026902 printf(" %d", n_path);
26903 printf("\n");
26904 }
26905 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026906 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026907
Daniel Veillard42595322004-11-08 10:52:06 +000026908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026909}
26910
26911
26912static int
26913test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026915
William M. Brack21e4ef22005-01-02 09:53:13 +000026916#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026917 int mem_base;
26918 xmlOutputBufferPtr ret_val;
26919 int fd; /* a file descriptor number */
26920 int n_fd;
26921 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26922 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026923
Daniel Veillard3d95c732004-11-06 22:25:14 +000026924 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26925 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26926 mem_base = xmlMemBlocks();
26927 fd = gen_int(n_fd, 0);
26928 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26929
26930 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26931 desret_xmlOutputBufferPtr(ret_val);
26932 call_tests++;
26933 des_int(n_fd, fd, 0);
26934 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26935 xmlResetLastError();
26936 if (mem_base != xmlMemBlocks()) {
26937 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026939 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026940 printf(" %d", n_fd);
26941 printf(" %d", n_encoder);
26942 printf("\n");
26943 }
26944 }
26945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026946 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026947#endif
26948
Daniel Veillard42595322004-11-08 10:52:06 +000026949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026950}
26951
26952
26953static int
26954test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026956
William M. Brack21e4ef22005-01-02 09:53:13 +000026957#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026958 int mem_base;
26959 xmlOutputBufferPtr ret_val;
26960 FILE * file; /* a FILE* */
26961 int n_file;
26962 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26963 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026964
Daniel Veillard3d95c732004-11-06 22:25:14 +000026965 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26966 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26967 mem_base = xmlMemBlocks();
26968 file = gen_FILE_ptr(n_file, 0);
26969 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26970
26971 ret_val = xmlOutputBufferCreateFile(file, encoder);
26972 desret_xmlOutputBufferPtr(ret_val);
26973 call_tests++;
26974 des_FILE_ptr(n_file, file, 0);
26975 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26976 xmlResetLastError();
26977 if (mem_base != xmlMemBlocks()) {
26978 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026980 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026981 printf(" %d", n_file);
26982 printf(" %d", n_encoder);
26983 printf("\n");
26984 }
26985 }
26986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026987 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026988#endif
26989
Daniel Veillard42595322004-11-08 10:52:06 +000026990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026991}
26992
26993
26994static int
26995test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026997
William M. Brack21e4ef22005-01-02 09:53:13 +000026998#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026999 int mem_base;
27000 xmlOutputBufferPtr ret_val;
27001 const char * URI; /* a C string containing the URI or filename */
27002 int n_URI;
27003 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27004 int n_encoder;
27005 int compression; /* the compression ration (0 none, 9 max). */
27006 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027007
Daniel Veillard42595322004-11-08 10:52:06 +000027008 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027009 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27010 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27011 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027012 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027013 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27014 compression = gen_int(n_compression, 2);
27015
27016 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27017 desret_xmlOutputBufferPtr(ret_val);
27018 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027019 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027020 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27021 des_int(n_compression, compression, 2);
27022 xmlResetLastError();
27023 if (mem_base != xmlMemBlocks()) {
27024 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027026 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027027 printf(" %d", n_URI);
27028 printf(" %d", n_encoder);
27029 printf(" %d", n_compression);
27030 printf("\n");
27031 }
27032 }
27033 }
27034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027035 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027036#endif
27037
Daniel Veillard42595322004-11-08 10:52:06 +000027038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027039}
27040
27041
27042static int
27043test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027045
William M. Brack21e4ef22005-01-02 09:53:13 +000027046#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027047 int mem_base;
27048 int ret_val;
27049 xmlOutputBufferPtr out; /* a buffered output */
27050 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027051
Daniel Veillard3d97e662004-11-04 10:49:00 +000027052 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27053 mem_base = xmlMemBlocks();
27054 out = gen_xmlOutputBufferPtr(n_out, 0);
27055
27056 ret_val = xmlOutputBufferFlush(out);
27057 desret_int(ret_val);
27058 call_tests++;
27059 des_xmlOutputBufferPtr(n_out, out, 0);
27060 xmlResetLastError();
27061 if (mem_base != xmlMemBlocks()) {
27062 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027064 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027065 printf(" %d", n_out);
27066 printf("\n");
27067 }
27068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027069 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027070#endif
27071
Daniel Veillard42595322004-11-08 10:52:06 +000027072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027073}
27074
27075
27076static int
27077test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027079
William M. Brack21e4ef22005-01-02 09:53:13 +000027080#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027081 int mem_base;
27082 int ret_val;
27083 xmlOutputBufferPtr out; /* a buffered parser output */
27084 int n_out;
27085 int len; /* the size in bytes of the array. */
27086 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027087 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027088 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027089
Daniel Veillard3d97e662004-11-04 10:49:00 +000027090 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27091 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27092 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27093 mem_base = xmlMemBlocks();
27094 out = gen_xmlOutputBufferPtr(n_out, 0);
27095 len = gen_int(n_len, 1);
27096 buf = gen_const_char_ptr(n_buf, 2);
27097
William M. Brackf13f77f2004-11-12 16:03:48 +000027098 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027099 desret_int(ret_val);
27100 call_tests++;
27101 des_xmlOutputBufferPtr(n_out, out, 0);
27102 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027103 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027104 xmlResetLastError();
27105 if (mem_base != xmlMemBlocks()) {
27106 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027108 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027109 printf(" %d", n_out);
27110 printf(" %d", n_len);
27111 printf(" %d", n_buf);
27112 printf("\n");
27113 }
27114 }
27115 }
27116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027117 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027118#endif
27119
Daniel Veillard42595322004-11-08 10:52:06 +000027120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027121}
27122
27123
27124static int
27125test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027127
27128
27129 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027131}
27132
27133
27134static int
27135test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027137
William M. Brack21e4ef22005-01-02 09:53:13 +000027138#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027139 int mem_base;
27140 int ret_val;
27141 xmlOutputBufferPtr out; /* a buffered parser output */
27142 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027143 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027144 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027145
Daniel Veillard3d97e662004-11-04 10:49:00 +000027146 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27147 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27148 mem_base = xmlMemBlocks();
27149 out = gen_xmlOutputBufferPtr(n_out, 0);
27150 str = gen_const_char_ptr(n_str, 1);
27151
William M. Brackf13f77f2004-11-12 16:03:48 +000027152 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027153 desret_int(ret_val);
27154 call_tests++;
27155 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027156 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027157 xmlResetLastError();
27158 if (mem_base != xmlMemBlocks()) {
27159 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027161 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027162 printf(" %d", n_out);
27163 printf(" %d", n_str);
27164 printf("\n");
27165 }
27166 }
27167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027168 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027169#endif
27170
Daniel Veillard42595322004-11-08 10:52:06 +000027171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027172}
27173
27174
27175static int
27176test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027178
27179
27180 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027182}
27183
27184
27185static int
27186test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027188
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027189 int mem_base;
27190 xmlParserInputBufferPtr ret_val;
27191 int fd; /* a file descriptor number */
27192 int n_fd;
27193 xmlCharEncoding enc; /* the charset encoding if known */
27194 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027195
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027196 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27197 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27198 mem_base = xmlMemBlocks();
27199 fd = gen_int(n_fd, 0);
27200 enc = gen_xmlCharEncoding(n_enc, 1);
27201 if (fd >= 0) fd = -1;
27202
27203 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27204 desret_xmlParserInputBufferPtr(ret_val);
27205 call_tests++;
27206 des_int(n_fd, fd, 0);
27207 des_xmlCharEncoding(n_enc, enc, 1);
27208 xmlResetLastError();
27209 if (mem_base != xmlMemBlocks()) {
27210 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027212 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027213 printf(" %d", n_fd);
27214 printf(" %d", n_enc);
27215 printf("\n");
27216 }
27217 }
27218 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027219 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027220
Daniel Veillard42595322004-11-08 10:52:06 +000027221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027222}
27223
27224
27225static int
27226test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027228
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027229 int mem_base;
27230 xmlParserInputBufferPtr ret_val;
27231 FILE * file; /* a FILE* */
27232 int n_file;
27233 xmlCharEncoding enc; /* the charset encoding if known */
27234 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027235
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027236 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27237 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27238 mem_base = xmlMemBlocks();
27239 file = gen_FILE_ptr(n_file, 0);
27240 enc = gen_xmlCharEncoding(n_enc, 1);
27241
27242 ret_val = xmlParserInputBufferCreateFile(file, enc);
27243 desret_xmlParserInputBufferPtr(ret_val);
27244 call_tests++;
27245 des_FILE_ptr(n_file, file, 0);
27246 des_xmlCharEncoding(n_enc, enc, 1);
27247 xmlResetLastError();
27248 if (mem_base != xmlMemBlocks()) {
27249 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027251 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027252 printf(" %d", n_file);
27253 printf(" %d", n_enc);
27254 printf("\n");
27255 }
27256 }
27257 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027259
Daniel Veillard42595322004-11-08 10:52:06 +000027260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027261}
27262
27263
27264static int
27265test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027267
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027268 int mem_base;
27269 xmlParserInputBufferPtr ret_val;
27270 const char * URI; /* a C string containing the URI or filename */
27271 int n_URI;
27272 xmlCharEncoding enc; /* the charset encoding if known */
27273 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027274
Daniel Veillard42595322004-11-08 10:52:06 +000027275 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027276 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27277 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027278 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027279 enc = gen_xmlCharEncoding(n_enc, 1);
27280
27281 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27282 desret_xmlParserInputBufferPtr(ret_val);
27283 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027284 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027285 des_xmlCharEncoding(n_enc, enc, 1);
27286 xmlResetLastError();
27287 if (mem_base != xmlMemBlocks()) {
27288 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027290 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027291 printf(" %d", n_URI);
27292 printf(" %d", n_enc);
27293 printf("\n");
27294 }
27295 }
27296 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027298
Daniel Veillard42595322004-11-08 10:52:06 +000027299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027300}
27301
27302
27303static int
27304test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027306
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027307 int mem_base;
27308 xmlParserInputBufferPtr ret_val;
27309 char * mem; /* the memory input */
27310 int n_mem;
27311 int size; /* the length of the memory block */
27312 int n_size;
27313 xmlCharEncoding enc; /* the charset encoding if known */
27314 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027315
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027316 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27317 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27318 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27319 mem_base = xmlMemBlocks();
27320 mem = gen_const_char_ptr(n_mem, 0);
27321 size = gen_int(n_size, 1);
27322 enc = gen_xmlCharEncoding(n_enc, 2);
27323
William M. Brackf13f77f2004-11-12 16:03:48 +000027324 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027325 desret_xmlParserInputBufferPtr(ret_val);
27326 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027327 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027328 des_int(n_size, size, 1);
27329 des_xmlCharEncoding(n_enc, enc, 2);
27330 xmlResetLastError();
27331 if (mem_base != xmlMemBlocks()) {
27332 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027334 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027335 printf(" %d", n_mem);
27336 printf(" %d", n_size);
27337 printf(" %d", n_enc);
27338 printf("\n");
27339 }
27340 }
27341 }
27342 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027343 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027344
Daniel Veillard42595322004-11-08 10:52:06 +000027345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027346}
27347
27348
27349static int
27350test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027352
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027353 int mem_base;
27354 xmlParserInputBufferPtr ret_val;
27355 char * mem; /* the memory input */
27356 int n_mem;
27357 int size; /* the length of the memory block */
27358 int n_size;
27359 xmlCharEncoding enc; /* the charset encoding if known */
27360 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027361
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027362 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27363 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27364 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27365 mem_base = xmlMemBlocks();
27366 mem = gen_const_char_ptr(n_mem, 0);
27367 size = gen_int(n_size, 1);
27368 enc = gen_xmlCharEncoding(n_enc, 2);
27369
William M. Brackf13f77f2004-11-12 16:03:48 +000027370 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027371 desret_xmlParserInputBufferPtr(ret_val);
27372 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027373 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027374 des_int(n_size, size, 1);
27375 des_xmlCharEncoding(n_enc, enc, 2);
27376 xmlResetLastError();
27377 if (mem_base != xmlMemBlocks()) {
27378 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027380 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027381 printf(" %d", n_mem);
27382 printf(" %d", n_size);
27383 printf(" %d", n_enc);
27384 printf("\n");
27385 }
27386 }
27387 }
27388 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027390
Daniel Veillard42595322004-11-08 10:52:06 +000027391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027392}
27393
27394
27395static int
27396test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027398
Daniel Veillard34099b42004-11-04 17:34:35 +000027399 int mem_base;
27400 int ret_val;
27401 xmlParserInputBufferPtr in; /* a buffered parser input */
27402 int n_in;
27403 int len; /* indicative value of the amount of chars to read */
27404 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027405
Daniel Veillard34099b42004-11-04 17:34:35 +000027406 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27407 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27408 mem_base = xmlMemBlocks();
27409 in = gen_xmlParserInputBufferPtr(n_in, 0);
27410 len = gen_int(n_len, 1);
27411
27412 ret_val = xmlParserInputBufferGrow(in, len);
27413 desret_int(ret_val);
27414 call_tests++;
27415 des_xmlParserInputBufferPtr(n_in, in, 0);
27416 des_int(n_len, len, 1);
27417 xmlResetLastError();
27418 if (mem_base != xmlMemBlocks()) {
27419 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027421 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027422 printf(" %d", n_in);
27423 printf(" %d", n_len);
27424 printf("\n");
27425 }
27426 }
27427 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027429
Daniel Veillard42595322004-11-08 10:52:06 +000027430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027431}
27432
27433
27434static int
27435test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027437
Daniel Veillard34099b42004-11-04 17:34:35 +000027438 int mem_base;
27439 int ret_val;
27440 xmlParserInputBufferPtr in; /* a buffered parser input */
27441 int n_in;
27442 int len; /* the size in bytes of the array. */
27443 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027444 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027445 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027446
Daniel Veillard34099b42004-11-04 17:34:35 +000027447 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27448 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27449 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27450 mem_base = xmlMemBlocks();
27451 in = gen_xmlParserInputBufferPtr(n_in, 0);
27452 len = gen_int(n_len, 1);
27453 buf = gen_const_char_ptr(n_buf, 2);
27454
William M. Brackf13f77f2004-11-12 16:03:48 +000027455 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027456 desret_int(ret_val);
27457 call_tests++;
27458 des_xmlParserInputBufferPtr(n_in, in, 0);
27459 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027460 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027461 xmlResetLastError();
27462 if (mem_base != xmlMemBlocks()) {
27463 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027465 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027466 printf(" %d", n_in);
27467 printf(" %d", n_len);
27468 printf(" %d", n_buf);
27469 printf("\n");
27470 }
27471 }
27472 }
27473 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027474 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027475
Daniel Veillard42595322004-11-08 10:52:06 +000027476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477}
27478
27479
27480static int
27481test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027483
Daniel Veillard34099b42004-11-04 17:34:35 +000027484 int mem_base;
27485 int ret_val;
27486 xmlParserInputBufferPtr in; /* a buffered parser input */
27487 int n_in;
27488 int len; /* indicative value of the amount of chars to read */
27489 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027490
Daniel Veillard34099b42004-11-04 17:34:35 +000027491 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27492 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27493 mem_base = xmlMemBlocks();
27494 in = gen_xmlParserInputBufferPtr(n_in, 0);
27495 len = gen_int(n_len, 1);
27496
27497 ret_val = xmlParserInputBufferRead(in, len);
27498 desret_int(ret_val);
27499 call_tests++;
27500 des_xmlParserInputBufferPtr(n_in, in, 0);
27501 des_int(n_len, len, 1);
27502 xmlResetLastError();
27503 if (mem_base != xmlMemBlocks()) {
27504 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027506 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027507 printf(" %d", n_in);
27508 printf(" %d", n_len);
27509 printf("\n");
27510 }
27511 }
27512 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027513 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027514
Daniel Veillard42595322004-11-08 10:52:06 +000027515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027516}
27517
27518
27519static int
27520test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027522
27523 int mem_base;
27524 int ret_val;
27525
27526 mem_base = xmlMemBlocks();
27527
27528 ret_val = xmlPopInputCallbacks();
27529 desret_int(ret_val);
27530 call_tests++;
27531 xmlResetLastError();
27532 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027533 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027535 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027536 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027539
Daniel Veillard42595322004-11-08 10:52:06 +000027540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027541}
27542
27543
27544static int
27545test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027547
27548 int mem_base;
27549
27550 mem_base = xmlMemBlocks();
27551
27552 xmlRegisterDefaultInputCallbacks();
27553 call_tests++;
27554 xmlResetLastError();
27555 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027556 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027558 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027559 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027560 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027562
Daniel Veillard42595322004-11-08 10:52:06 +000027563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027564}
27565
27566
27567static int
27568test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027570
William M. Brack21e4ef22005-01-02 09:53:13 +000027571#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027572 int mem_base;
27573
27574 mem_base = xmlMemBlocks();
27575
27576 xmlRegisterDefaultOutputCallbacks();
27577 call_tests++;
27578 xmlResetLastError();
27579 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027580 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027582 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027583 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027585 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027586#endif
27587
Daniel Veillard42595322004-11-08 10:52:06 +000027588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027589}
27590
27591
27592static int
27593test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027595
William M. Brack21e4ef22005-01-02 09:53:13 +000027596#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027597 int mem_base;
27598
27599 mem_base = xmlMemBlocks();
27600
27601 xmlRegisterHTTPPostCallbacks();
27602 call_tests++;
27603 xmlResetLastError();
27604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027605 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027610 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027611#endif
27612
Daniel Veillard42595322004-11-08 10:52:06 +000027613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027614}
27615
27616static int
27617test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027619
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027620 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027621 test_ret += test_xmlAllocOutputBuffer();
27622 test_ret += test_xmlAllocParserInputBuffer();
27623 test_ret += test_xmlCheckFilename();
27624 test_ret += test_xmlCheckHTTPInput();
27625 test_ret += test_xmlCleanupInputCallbacks();
27626 test_ret += test_xmlCleanupOutputCallbacks();
27627 test_ret += test_xmlFileClose();
27628 test_ret += test_xmlFileMatch();
27629 test_ret += test_xmlFileOpen();
27630 test_ret += test_xmlFileRead();
27631 test_ret += test_xmlIOFTPClose();
27632 test_ret += test_xmlIOFTPMatch();
27633 test_ret += test_xmlIOFTPOpen();
27634 test_ret += test_xmlIOFTPRead();
27635 test_ret += test_xmlIOHTTPClose();
27636 test_ret += test_xmlIOHTTPMatch();
27637 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000027638 test_ret += test_xmlIOHTTPRead();
27639 test_ret += test_xmlNoNetExternalEntityLoader();
27640 test_ret += test_xmlNormalizeWindowsPath();
27641 test_ret += test_xmlOutputBufferCreateFd();
27642 test_ret += test_xmlOutputBufferCreateFile();
27643 test_ret += test_xmlOutputBufferCreateFilename();
27644 test_ret += test_xmlOutputBufferFlush();
27645 test_ret += test_xmlOutputBufferWrite();
27646 test_ret += test_xmlOutputBufferWriteEscape();
27647 test_ret += test_xmlOutputBufferWriteString();
27648 test_ret += test_xmlParserGetDirectory();
27649 test_ret += test_xmlParserInputBufferCreateFd();
27650 test_ret += test_xmlParserInputBufferCreateFile();
27651 test_ret += test_xmlParserInputBufferCreateFilename();
27652 test_ret += test_xmlParserInputBufferCreateMem();
27653 test_ret += test_xmlParserInputBufferCreateStatic();
27654 test_ret += test_xmlParserInputBufferGrow();
27655 test_ret += test_xmlParserInputBufferPush();
27656 test_ret += test_xmlParserInputBufferRead();
27657 test_ret += test_xmlPopInputCallbacks();
27658 test_ret += test_xmlRegisterDefaultInputCallbacks();
27659 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27660 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027661
Daniel Veillard42595322004-11-08 10:52:06 +000027662 if (test_ret != 0)
27663 printf("Module xmlIO: %d errors\n", test_ret);
27664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027665}
Daniel Veillarda521d282004-11-09 14:59:59 +000027666#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027667
Daniel Veillarda82b1822004-11-08 16:24:57 +000027668#define gen_nb_xmlAutomataPtr 1
27669static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27670 return(NULL);
27671}
27672static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27673}
Daniel Veillarda521d282004-11-09 14:59:59 +000027674#endif
27675
Daniel Veillarda82b1822004-11-08 16:24:57 +000027676
27677static int
27678test_xmlAutomataCompile(void) {
27679 int test_ret = 0;
27680
27681
27682 /* missing type support */
27683 return(test_ret);
27684}
27685
27686
27687static int
27688test_xmlAutomataGetInitState(void) {
27689 int test_ret = 0;
27690
27691
27692 /* missing type support */
27693 return(test_ret);
27694}
27695
27696
27697static int
27698test_xmlAutomataIsDeterminist(void) {
27699 int test_ret = 0;
27700
William M. Brack21e4ef22005-01-02 09:53:13 +000027701#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027702 int mem_base;
27703 int ret_val;
27704 xmlAutomataPtr am; /* an automata */
27705 int n_am;
27706
27707 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27708 mem_base = xmlMemBlocks();
27709 am = gen_xmlAutomataPtr(n_am, 0);
27710
27711 ret_val = xmlAutomataIsDeterminist(am);
27712 desret_int(ret_val);
27713 call_tests++;
27714 des_xmlAutomataPtr(n_am, am, 0);
27715 xmlResetLastError();
27716 if (mem_base != xmlMemBlocks()) {
27717 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27718 xmlMemBlocks() - mem_base);
27719 test_ret++;
27720 printf(" %d", n_am);
27721 printf("\n");
27722 }
27723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027724 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027725#endif
27726
Daniel Veillarda82b1822004-11-08 16:24:57 +000027727 return(test_ret);
27728}
27729
Daniel Veillarda521d282004-11-09 14:59:59 +000027730#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027731
27732#define gen_nb_xmlAutomataStatePtr 1
27733static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27734 return(NULL);
27735}
27736static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27737}
Daniel Veillarda521d282004-11-09 14:59:59 +000027738#endif
27739
Daniel Veillarda82b1822004-11-08 16:24:57 +000027740
27741static int
27742test_xmlAutomataNewAllTrans(void) {
27743 int test_ret = 0;
27744
27745
27746 /* missing type support */
27747 return(test_ret);
27748}
27749
27750
27751static int
27752test_xmlAutomataNewCountTrans(void) {
27753 int test_ret = 0;
27754
27755
27756 /* missing type support */
27757 return(test_ret);
27758}
27759
27760
27761static int
27762test_xmlAutomataNewCountTrans2(void) {
27763 int test_ret = 0;
27764
27765
27766 /* missing type support */
27767 return(test_ret);
27768}
27769
27770
27771static int
27772test_xmlAutomataNewCountedTrans(void) {
27773 int test_ret = 0;
27774
27775
27776 /* missing type support */
27777 return(test_ret);
27778}
27779
27780
27781static int
27782test_xmlAutomataNewCounter(void) {
27783 int test_ret = 0;
27784
William M. Brack21e4ef22005-01-02 09:53:13 +000027785#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027786 int mem_base;
27787 int ret_val;
27788 xmlAutomataPtr am; /* an automata */
27789 int n_am;
27790 int min; /* the minimal value on the counter */
27791 int n_min;
27792 int max; /* the maximal value on the counter */
27793 int n_max;
27794
27795 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27796 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27797 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27798 mem_base = xmlMemBlocks();
27799 am = gen_xmlAutomataPtr(n_am, 0);
27800 min = gen_int(n_min, 1);
27801 max = gen_int(n_max, 2);
27802
27803 ret_val = xmlAutomataNewCounter(am, min, max);
27804 desret_int(ret_val);
27805 call_tests++;
27806 des_xmlAutomataPtr(n_am, am, 0);
27807 des_int(n_min, min, 1);
27808 des_int(n_max, max, 2);
27809 xmlResetLastError();
27810 if (mem_base != xmlMemBlocks()) {
27811 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27812 xmlMemBlocks() - mem_base);
27813 test_ret++;
27814 printf(" %d", n_am);
27815 printf(" %d", n_min);
27816 printf(" %d", n_max);
27817 printf("\n");
27818 }
27819 }
27820 }
27821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027822 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027823#endif
27824
Daniel Veillarda82b1822004-11-08 16:24:57 +000027825 return(test_ret);
27826}
27827
27828
27829static int
27830test_xmlAutomataNewCounterTrans(void) {
27831 int test_ret = 0;
27832
27833
27834 /* missing type support */
27835 return(test_ret);
27836}
27837
27838
27839static int
27840test_xmlAutomataNewEpsilon(void) {
27841 int test_ret = 0;
27842
27843
27844 /* missing type support */
27845 return(test_ret);
27846}
27847
27848
27849static int
27850test_xmlAutomataNewOnceTrans(void) {
27851 int test_ret = 0;
27852
27853
27854 /* missing type support */
27855 return(test_ret);
27856}
27857
27858
27859static int
27860test_xmlAutomataNewOnceTrans2(void) {
27861 int test_ret = 0;
27862
27863
27864 /* missing type support */
27865 return(test_ret);
27866}
27867
27868
27869static int
27870test_xmlAutomataNewState(void) {
27871 int test_ret = 0;
27872
27873
27874 /* missing type support */
27875 return(test_ret);
27876}
27877
27878
27879static int
27880test_xmlAutomataNewTransition(void) {
27881 int test_ret = 0;
27882
27883
27884 /* missing type support */
27885 return(test_ret);
27886}
27887
27888
27889static int
27890test_xmlAutomataNewTransition2(void) {
27891 int test_ret = 0;
27892
27893
27894 /* missing type support */
27895 return(test_ret);
27896}
27897
27898
27899static int
27900test_xmlAutomataSetFinalState(void) {
27901 int test_ret = 0;
27902
William M. Brack21e4ef22005-01-02 09:53:13 +000027903#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027904 int mem_base;
27905 int ret_val;
27906 xmlAutomataPtr am; /* an automata */
27907 int n_am;
27908 xmlAutomataStatePtr state; /* a state in this automata */
27909 int n_state;
27910
27911 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27912 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27913 mem_base = xmlMemBlocks();
27914 am = gen_xmlAutomataPtr(n_am, 0);
27915 state = gen_xmlAutomataStatePtr(n_state, 1);
27916
27917 ret_val = xmlAutomataSetFinalState(am, state);
27918 desret_int(ret_val);
27919 call_tests++;
27920 des_xmlAutomataPtr(n_am, am, 0);
27921 des_xmlAutomataStatePtr(n_state, state, 1);
27922 xmlResetLastError();
27923 if (mem_base != xmlMemBlocks()) {
27924 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27925 xmlMemBlocks() - mem_base);
27926 test_ret++;
27927 printf(" %d", n_am);
27928 printf(" %d", n_state);
27929 printf("\n");
27930 }
27931 }
27932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027933 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027934#endif
27935
Daniel Veillarda82b1822004-11-08 16:24:57 +000027936 return(test_ret);
27937}
27938
27939
27940static int
27941test_xmlNewAutomata(void) {
27942 int test_ret = 0;
27943
27944
27945 /* missing type support */
27946 return(test_ret);
27947}
27948
27949static int
27950test_xmlautomata(void) {
27951 int test_ret = 0;
27952
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027953 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027954 test_ret += test_xmlAutomataCompile();
27955 test_ret += test_xmlAutomataGetInitState();
27956 test_ret += test_xmlAutomataIsDeterminist();
27957 test_ret += test_xmlAutomataNewAllTrans();
27958 test_ret += test_xmlAutomataNewCountTrans();
27959 test_ret += test_xmlAutomataNewCountTrans2();
27960 test_ret += test_xmlAutomataNewCountedTrans();
27961 test_ret += test_xmlAutomataNewCounter();
27962 test_ret += test_xmlAutomataNewCounterTrans();
27963 test_ret += test_xmlAutomataNewEpsilon();
27964 test_ret += test_xmlAutomataNewOnceTrans();
27965 test_ret += test_xmlAutomataNewOnceTrans2();
27966 test_ret += test_xmlAutomataNewState();
27967 test_ret += test_xmlAutomataNewTransition();
27968 test_ret += test_xmlAutomataNewTransition2();
27969 test_ret += test_xmlAutomataSetFinalState();
27970 test_ret += test_xmlNewAutomata();
27971
27972 if (test_ret != 0)
27973 printf("Module xmlautomata: %d errors\n", test_ret);
27974 return(test_ret);
27975}
27976
Daniel Veillardce682bc2004-11-05 17:22:25 +000027977#define gen_nb_xmlGenericErrorFunc_ptr 1
27978static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27979 return(NULL);
27980}
27981static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27982}
27983
Daniel Veillardd93f6252004-11-02 15:53:51 +000027984static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027985test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027987
Daniel Veillardce682bc2004-11-05 17:22:25 +000027988 int mem_base;
27989 xmlGenericErrorFunc * handler; /* the handler */
27990 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027991
Daniel Veillardce682bc2004-11-05 17:22:25 +000027992 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27993 mem_base = xmlMemBlocks();
27994 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27995
27996 initGenericErrorDefaultFunc(handler);
27997 call_tests++;
27998 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27999 xmlResetLastError();
28000 if (mem_base != xmlMemBlocks()) {
28001 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028003 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028004 printf(" %d", n_handler);
28005 printf("\n");
28006 }
28007 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028008 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028009
Daniel Veillard42595322004-11-08 10:52:06 +000028010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028011}
28012
28013
Daniel Veillardce682bc2004-11-05 17:22:25 +000028014#define gen_nb_xmlErrorPtr 1
28015static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28016 return(NULL);
28017}
28018static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28019}
28020
Daniel Veillardd93f6252004-11-02 15:53:51 +000028021static int
28022test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028024
Daniel Veillardce682bc2004-11-05 17:22:25 +000028025 int mem_base;
28026 int ret_val;
28027 xmlErrorPtr from; /* a source error */
28028 int n_from;
28029 xmlErrorPtr to; /* a target error */
28030 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028031
Daniel Veillardce682bc2004-11-05 17:22:25 +000028032 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28033 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28034 mem_base = xmlMemBlocks();
28035 from = gen_xmlErrorPtr(n_from, 0);
28036 to = gen_xmlErrorPtr(n_to, 1);
28037
28038 ret_val = xmlCopyError(from, to);
28039 desret_int(ret_val);
28040 call_tests++;
28041 des_xmlErrorPtr(n_from, from, 0);
28042 des_xmlErrorPtr(n_to, to, 1);
28043 xmlResetLastError();
28044 if (mem_base != xmlMemBlocks()) {
28045 printf("Leak of %d blocks found in xmlCopyError",
28046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028047 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028048 printf(" %d", n_from);
28049 printf(" %d", n_to);
28050 printf("\n");
28051 }
28052 }
28053 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028054 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028055
Daniel Veillard42595322004-11-08 10:52:06 +000028056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028057}
28058
28059
28060static int
28061test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028063
28064
28065 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028067}
28068
28069
28070static int
28071test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028073
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028074 int mem_base;
28075 void * ctx; /* an XML parser context */
28076 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028077
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028078 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028080 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028081
28082 xmlCtxtResetLastError(ctx);
28083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028084 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028085 xmlResetLastError();
28086 if (mem_base != xmlMemBlocks()) {
28087 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028089 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028090 printf(" %d", n_ctx);
28091 printf("\n");
28092 }
28093 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028094 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028095
Daniel Veillard42595322004-11-08 10:52:06 +000028096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028097}
28098
28099
28100static int
28101test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028103
28104
28105 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028107}
28108
28109
28110static int
28111test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028113
28114
28115 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028117}
28118
28119
28120static int
28121test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028123
Daniel Veillardce682bc2004-11-05 17:22:25 +000028124 int mem_base;
28125 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28126 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028127
Daniel Veillardce682bc2004-11-05 17:22:25 +000028128 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28129 mem_base = xmlMemBlocks();
28130 input = gen_xmlParserInputPtr(n_input, 0);
28131
28132 xmlParserPrintFileContext(input);
28133 call_tests++;
28134 des_xmlParserInputPtr(n_input, input, 0);
28135 xmlResetLastError();
28136 if (mem_base != xmlMemBlocks()) {
28137 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028139 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028140 printf(" %d", n_input);
28141 printf("\n");
28142 }
28143 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028144 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028145
Daniel Veillard42595322004-11-08 10:52:06 +000028146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028147}
28148
28149
28150static int
28151test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028153
Daniel Veillardce682bc2004-11-05 17:22:25 +000028154 int mem_base;
28155 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28156 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028157
Daniel Veillardce682bc2004-11-05 17:22:25 +000028158 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28159 mem_base = xmlMemBlocks();
28160 input = gen_xmlParserInputPtr(n_input, 0);
28161
28162 xmlParserPrintFileInfo(input);
28163 call_tests++;
28164 des_xmlParserInputPtr(n_input, input, 0);
28165 xmlResetLastError();
28166 if (mem_base != xmlMemBlocks()) {
28167 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028169 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028170 printf(" %d", n_input);
28171 printf("\n");
28172 }
28173 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028174 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028175
Daniel Veillard42595322004-11-08 10:52:06 +000028176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028177}
28178
28179
28180static int
28181test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028183
28184
28185 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028187}
28188
28189
28190static int
28191test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193
28194
28195 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028197}
28198
28199
28200static int
28201test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028203
28204
28205 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028207}
28208
28209
28210static int
28211test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028213
Daniel Veillardce682bc2004-11-05 17:22:25 +000028214 int mem_base;
28215 xmlErrorPtr err; /* pointer to the error. */
28216 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028217
Daniel Veillardce682bc2004-11-05 17:22:25 +000028218 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28219 mem_base = xmlMemBlocks();
28220 err = gen_xmlErrorPtr(n_err, 0);
28221
28222 xmlResetError(err);
28223 call_tests++;
28224 des_xmlErrorPtr(n_err, err, 0);
28225 xmlResetLastError();
28226 if (mem_base != xmlMemBlocks()) {
28227 printf("Leak of %d blocks found in xmlResetError",
28228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028230 printf(" %d", n_err);
28231 printf("\n");
28232 }
28233 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028234 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028235
Daniel Veillard42595322004-11-08 10:52:06 +000028236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028237}
28238
28239
28240static int
28241test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028243
28244
28245
28246 xmlResetLastError();
28247 call_tests++;
28248 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028250
Daniel Veillard42595322004-11-08 10:52:06 +000028251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028252}
28253
28254
28255static int
28256test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028258
28259
28260 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028262}
28263
28264
28265static int
28266test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028268
28269
28270 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028272}
28273
28274static int
28275test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028277
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028278 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028279 test_ret += test_initGenericErrorDefaultFunc();
28280 test_ret += test_xmlCopyError();
28281 test_ret += test_xmlCtxtGetLastError();
28282 test_ret += test_xmlCtxtResetLastError();
28283 test_ret += test_xmlGetLastError();
28284 test_ret += test_xmlParserError();
28285 test_ret += test_xmlParserPrintFileContext();
28286 test_ret += test_xmlParserPrintFileInfo();
28287 test_ret += test_xmlParserValidityError();
28288 test_ret += test_xmlParserValidityWarning();
28289 test_ret += test_xmlParserWarning();
28290 test_ret += test_xmlResetError();
28291 test_ret += test_xmlResetLastError();
28292 test_ret += test_xmlSetGenericErrorFunc();
28293 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028294
Daniel Veillard42595322004-11-08 10:52:06 +000028295 if (test_ret != 0)
28296 printf("Module xmlerror: %d errors\n", test_ret);
28297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028298}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028299#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028300
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028301#define gen_nb_xmlModulePtr 1
28302static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28303 return(NULL);
28304}
28305static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28306}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028307#endif
28308
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028309
28310static int
28311test_xmlModuleClose(void) {
28312 int test_ret = 0;
28313
28314#if defined(LIBXML_MODULES_ENABLED)
28315 int mem_base;
28316 int ret_val;
28317 xmlModulePtr module; /* the module handle */
28318 int n_module;
28319
28320 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28321 mem_base = xmlMemBlocks();
28322 module = gen_xmlModulePtr(n_module, 0);
28323
28324 ret_val = xmlModuleClose(module);
28325 desret_int(ret_val);
28326 call_tests++;
28327 des_xmlModulePtr(n_module, module, 0);
28328 xmlResetLastError();
28329 if (mem_base != xmlMemBlocks()) {
28330 printf("Leak of %d blocks found in xmlModuleClose",
28331 xmlMemBlocks() - mem_base);
28332 test_ret++;
28333 printf(" %d", n_module);
28334 printf("\n");
28335 }
28336 }
28337 function_tests++;
28338#endif
28339
28340 return(test_ret);
28341}
28342
28343
28344static int
28345test_xmlModuleOpen(void) {
28346 int test_ret = 0;
28347
28348
28349 /* missing type support */
28350 return(test_ret);
28351}
28352
28353
28354static int
28355test_xmlModuleSymbol(void) {
28356 int test_ret = 0;
28357
28358#if defined(LIBXML_MODULES_ENABLED)
28359 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028360 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028361 xmlModulePtr module; /* the module */
28362 int n_module;
28363 char * name; /* the name of the symbol */
28364 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028365 void ** symbol; /* the resulting symbol address */
28366 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028367
28368 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28369 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028370 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028371 mem_base = xmlMemBlocks();
28372 module = gen_xmlModulePtr(n_module, 0);
28373 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028374 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028375
Daniel Veillardbe076e92005-01-04 20:18:14 +000028376 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28377 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028378 call_tests++;
28379 des_xmlModulePtr(n_module, module, 0);
28380 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028381 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028382 xmlResetLastError();
28383 if (mem_base != xmlMemBlocks()) {
28384 printf("Leak of %d blocks found in xmlModuleSymbol",
28385 xmlMemBlocks() - mem_base);
28386 test_ret++;
28387 printf(" %d", n_module);
28388 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028389 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028390 printf("\n");
28391 }
28392 }
28393 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028394 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028395 function_tests++;
28396#endif
28397
28398 return(test_ret);
28399}
28400
28401static int
28402test_xmlmodule(void) {
28403 int test_ret = 0;
28404
28405 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28406 test_ret += test_xmlModuleClose();
28407 test_ret += test_xmlModuleOpen();
28408 test_ret += test_xmlModuleSymbol();
28409
28410 if (test_ret != 0)
28411 printf("Module xmlmodule: %d errors\n", test_ret);
28412 return(test_ret);
28413}
28414
Daniel Veillardd93f6252004-11-02 15:53:51 +000028415static int
28416test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028418
William M. Brack21e4ef22005-01-02 09:53:13 +000028419#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028420 int mem_base;
28421 xmlTextReaderPtr ret_val;
28422 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28423 int n_input;
28424 const char * URI; /* the URI information for the source if available */
28425 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028426
Daniel Veillard34099b42004-11-04 17:34:35 +000028427 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28428 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28429 mem_base = xmlMemBlocks();
28430 input = gen_xmlParserInputBufferPtr(n_input, 0);
28431 URI = gen_filepath(n_URI, 1);
28432
28433 ret_val = xmlNewTextReader(input, URI);
28434 desret_xmlTextReaderPtr(ret_val);
28435 call_tests++;
28436 des_xmlParserInputBufferPtr(n_input, input, 0);
28437 des_filepath(n_URI, URI, 1);
28438 xmlResetLastError();
28439 if (mem_base != xmlMemBlocks()) {
28440 printf("Leak of %d blocks found in xmlNewTextReader",
28441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028442 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028443 printf(" %d", n_input);
28444 printf(" %d", n_URI);
28445 printf("\n");
28446 }
28447 }
28448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028449 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028450#endif
28451
Daniel Veillard42595322004-11-08 10:52:06 +000028452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028453}
28454
28455
28456static int
28457test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028459
William M. Brack21e4ef22005-01-02 09:53:13 +000028460#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028461 int mem_base;
28462 xmlTextReaderPtr ret_val;
28463 const char * URI; /* the URI of the resource to process */
28464 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028465
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028466 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28467 mem_base = xmlMemBlocks();
28468 URI = gen_filepath(n_URI, 0);
28469
28470 ret_val = xmlNewTextReaderFilename(URI);
28471 desret_xmlTextReaderPtr(ret_val);
28472 call_tests++;
28473 des_filepath(n_URI, URI, 0);
28474 xmlResetLastError();
28475 if (mem_base != xmlMemBlocks()) {
28476 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028478 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028479 printf(" %d", n_URI);
28480 printf("\n");
28481 }
28482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028483 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028484#endif
28485
Daniel Veillard42595322004-11-08 10:52:06 +000028486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028487}
28488
28489
28490static int
28491test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028493
William M. Brack21e4ef22005-01-02 09:53:13 +000028494#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028495 int mem_base;
28496 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028497 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028498 int n_cur;
28499 const char * URL; /* the base URL to use for the document */
28500 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028501 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028502 int n_encoding;
28503 int options; /* a combination of xmlParserOption */
28504 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028505
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028506 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28507 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28508 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028509 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028510 mem_base = xmlMemBlocks();
28511 cur = gen_const_xmlChar_ptr(n_cur, 0);
28512 URL = gen_filepath(n_URL, 1);
28513 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028514 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028515
William M. Brackf13f77f2004-11-12 16:03:48 +000028516 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028517 desret_xmlTextReaderPtr(ret_val);
28518 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028519 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028520 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028521 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028522 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028523 xmlResetLastError();
28524 if (mem_base != xmlMemBlocks()) {
28525 printf("Leak of %d blocks found in xmlReaderForDoc",
28526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028527 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028528 printf(" %d", n_cur);
28529 printf(" %d", n_URL);
28530 printf(" %d", n_encoding);
28531 printf(" %d", n_options);
28532 printf("\n");
28533 }
28534 }
28535 }
28536 }
28537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028538 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028539#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028540
Daniel Veillard42595322004-11-08 10:52:06 +000028541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028542}
28543
28544
28545static int
28546test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028548
William M. Brack21e4ef22005-01-02 09:53:13 +000028549#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028550 int mem_base;
28551 xmlTextReaderPtr ret_val;
28552 const char * filename; /* a file or URL */
28553 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028554 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028555 int n_encoding;
28556 int options; /* a combination of xmlParserOption */
28557 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028558
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028559 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28560 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028561 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028562 mem_base = xmlMemBlocks();
28563 filename = gen_filepath(n_filename, 0);
28564 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028565 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028566
William M. Brackf13f77f2004-11-12 16:03:48 +000028567 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028568 desret_xmlTextReaderPtr(ret_val);
28569 call_tests++;
28570 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028571 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028572 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028573 xmlResetLastError();
28574 if (mem_base != xmlMemBlocks()) {
28575 printf("Leak of %d blocks found in xmlReaderForFile",
28576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028577 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028578 printf(" %d", n_filename);
28579 printf(" %d", n_encoding);
28580 printf(" %d", n_options);
28581 printf("\n");
28582 }
28583 }
28584 }
28585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028586 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028587#endif
28588
Daniel Veillard42595322004-11-08 10:52:06 +000028589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028590}
28591
28592
28593static int
28594test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028596
William M. Brack21e4ef22005-01-02 09:53:13 +000028597#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028598 int mem_base;
28599 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028600 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028601 int n_buffer;
28602 int size; /* the size of the array */
28603 int n_size;
28604 const char * URL; /* the base URL to use for the document */
28605 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028606 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028607 int n_encoding;
28608 int options; /* a combination of xmlParserOption */
28609 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028610
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028611 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28612 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28613 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28614 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028615 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028616 mem_base = xmlMemBlocks();
28617 buffer = gen_const_char_ptr(n_buffer, 0);
28618 size = gen_int(n_size, 1);
28619 URL = gen_filepath(n_URL, 2);
28620 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028621 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028622
William M. Brackf13f77f2004-11-12 16:03:48 +000028623 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028624 desret_xmlTextReaderPtr(ret_val);
28625 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028626 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028627 des_int(n_size, size, 1);
28628 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028629 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028630 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028631 xmlResetLastError();
28632 if (mem_base != xmlMemBlocks()) {
28633 printf("Leak of %d blocks found in xmlReaderForMemory",
28634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028635 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028636 printf(" %d", n_buffer);
28637 printf(" %d", n_size);
28638 printf(" %d", n_URL);
28639 printf(" %d", n_encoding);
28640 printf(" %d", n_options);
28641 printf("\n");
28642 }
28643 }
28644 }
28645 }
28646 }
28647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028648 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028649#endif
28650
Daniel Veillard42595322004-11-08 10:52:06 +000028651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028652}
28653
28654
28655static int
28656test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028658
William M. Brack21e4ef22005-01-02 09:53:13 +000028659#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028660 int mem_base;
28661 int ret_val;
28662 xmlTextReaderPtr reader; /* an XML reader */
28663 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028664 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028665 int n_cur;
28666 const char * URL; /* the base URL to use for the document */
28667 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028668 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028669 int n_encoding;
28670 int options; /* a combination of xmlParserOption */
28671 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028672
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028673 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28674 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28675 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28676 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028677 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028679 reader = gen_xmlTextReaderPtr(n_reader, 0);
28680 cur = gen_const_xmlChar_ptr(n_cur, 1);
28681 URL = gen_filepath(n_URL, 2);
28682 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028683 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028684
William M. Brackf13f77f2004-11-12 16:03:48 +000028685 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028686 desret_int(ret_val);
28687 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028688 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028689 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028690 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028691 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028692 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028693 xmlResetLastError();
28694 if (mem_base != xmlMemBlocks()) {
28695 printf("Leak of %d blocks found in xmlReaderNewDoc",
28696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028697 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028698 printf(" %d", n_reader);
28699 printf(" %d", n_cur);
28700 printf(" %d", n_URL);
28701 printf(" %d", n_encoding);
28702 printf(" %d", n_options);
28703 printf("\n");
28704 }
28705 }
28706 }
28707 }
28708 }
28709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028710 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028711#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028712
Daniel Veillard42595322004-11-08 10:52:06 +000028713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028714}
28715
28716
28717static int
28718test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028720
William M. Brack21e4ef22005-01-02 09:53:13 +000028721#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028722 int mem_base;
28723 int ret_val;
28724 xmlTextReaderPtr reader; /* an XML reader */
28725 int n_reader;
28726 const char * filename; /* a file or URL */
28727 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028728 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028729 int n_encoding;
28730 int options; /* a combination of xmlParserOption */
28731 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028732
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028733 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28734 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28735 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028736 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028738 reader = gen_xmlTextReaderPtr(n_reader, 0);
28739 filename = gen_filepath(n_filename, 1);
28740 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028741 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028742
William M. Brackf13f77f2004-11-12 16:03:48 +000028743 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028744 desret_int(ret_val);
28745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028746 des_xmlTextReaderPtr(n_reader, reader, 0);
28747 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028748 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028749 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028750 xmlResetLastError();
28751 if (mem_base != xmlMemBlocks()) {
28752 printf("Leak of %d blocks found in xmlReaderNewFile",
28753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028754 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028755 printf(" %d", n_reader);
28756 printf(" %d", n_filename);
28757 printf(" %d", n_encoding);
28758 printf(" %d", n_options);
28759 printf("\n");
28760 }
28761 }
28762 }
28763 }
28764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028765 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028766#endif
28767
Daniel Veillard42595322004-11-08 10:52:06 +000028768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028769}
28770
28771
28772static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028773test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028775
William M. Brack21e4ef22005-01-02 09:53:13 +000028776#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028777 int mem_base;
28778 int ret_val;
28779 xmlTextReaderPtr reader; /* an XML reader */
28780 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028781 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028782 int n_buffer;
28783 int size; /* the size of the array */
28784 int n_size;
28785 const char * URL; /* the base URL to use for the document */
28786 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028787 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028788 int n_encoding;
28789 int options; /* a combination of xmlParserOption */
28790 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028791
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028792 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28793 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28794 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28795 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28796 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028797 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028799 reader = gen_xmlTextReaderPtr(n_reader, 0);
28800 buffer = gen_const_char_ptr(n_buffer, 1);
28801 size = gen_int(n_size, 2);
28802 URL = gen_filepath(n_URL, 3);
28803 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028804 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028805
William M. Brackf13f77f2004-11-12 16:03:48 +000028806 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028807 desret_int(ret_val);
28808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028809 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028810 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028811 des_int(n_size, size, 2);
28812 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028813 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028814 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028815 xmlResetLastError();
28816 if (mem_base != xmlMemBlocks()) {
28817 printf("Leak of %d blocks found in xmlReaderNewMemory",
28818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028819 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028820 printf(" %d", n_reader);
28821 printf(" %d", n_buffer);
28822 printf(" %d", n_size);
28823 printf(" %d", n_URL);
28824 printf(" %d", n_encoding);
28825 printf(" %d", n_options);
28826 printf("\n");
28827 }
28828 }
28829 }
28830 }
28831 }
28832 }
28833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028834 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028835#endif
28836
Daniel Veillard42595322004-11-08 10:52:06 +000028837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028838}
28839
28840
28841static int
28842test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028844
William M. Brack21e4ef22005-01-02 09:53:13 +000028845#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028846 int mem_base;
28847 int ret_val;
28848 xmlTextReaderPtr reader; /* an XML reader */
28849 int n_reader;
28850 xmlDocPtr doc; /* a preparsed document */
28851 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028852
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028853 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28855 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028856 reader = gen_xmlTextReaderPtr(n_reader, 0);
28857 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028858
28859 ret_val = xmlReaderNewWalker(reader, doc);
28860 desret_int(ret_val);
28861 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028862 des_xmlTextReaderPtr(n_reader, reader, 0);
28863 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028864 xmlResetLastError();
28865 if (mem_base != xmlMemBlocks()) {
28866 printf("Leak of %d blocks found in xmlReaderNewWalker",
28867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028868 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028869 printf(" %d", n_reader);
28870 printf(" %d", n_doc);
28871 printf("\n");
28872 }
28873 }
28874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028875 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028876#endif
28877
Daniel Veillard42595322004-11-08 10:52:06 +000028878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028879}
28880
28881
28882static int
28883test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028885
William M. Brack21e4ef22005-01-02 09:53:13 +000028886#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028887 int mem_base;
28888 xmlTextReaderPtr ret_val;
28889 xmlDocPtr doc; /* a preparsed document */
28890 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028891
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028892 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28893 mem_base = xmlMemBlocks();
28894 doc = gen_xmlDocPtr(n_doc, 0);
28895
28896 ret_val = xmlReaderWalker(doc);
28897 desret_xmlTextReaderPtr(ret_val);
28898 call_tests++;
28899 des_xmlDocPtr(n_doc, doc, 0);
28900 xmlResetLastError();
28901 if (mem_base != xmlMemBlocks()) {
28902 printf("Leak of %d blocks found in xmlReaderWalker",
28903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028904 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028905 printf(" %d", n_doc);
28906 printf("\n");
28907 }
28908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028909 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028910#endif
28911
Daniel Veillard42595322004-11-08 10:52:06 +000028912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028913}
28914
28915
28916static int
28917test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028919
William M. Brack21e4ef22005-01-02 09:53:13 +000028920#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028921 int mem_base;
28922 int ret_val;
28923 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28924 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028925
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028926 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028928 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028929
28930 ret_val = xmlTextReaderAttributeCount(reader);
28931 desret_int(ret_val);
28932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028933 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028934 xmlResetLastError();
28935 if (mem_base != xmlMemBlocks()) {
28936 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028938 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028939 printf(" %d", n_reader);
28940 printf("\n");
28941 }
28942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028943 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028944#endif
28945
Daniel Veillard42595322004-11-08 10:52:06 +000028946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028947}
28948
28949
28950static int
28951test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028953
William M. Brack21e4ef22005-01-02 09:53:13 +000028954#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028955 int mem_base;
28956 xmlChar * ret_val;
28957 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28958 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028959
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028960 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028962 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028963
28964 ret_val = xmlTextReaderBaseUri(reader);
28965 desret_xmlChar_ptr(ret_val);
28966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028967 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028968 xmlResetLastError();
28969 if (mem_base != xmlMemBlocks()) {
28970 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028972 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028973 printf(" %d", n_reader);
28974 printf("\n");
28975 }
28976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028977 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028978#endif
28979
Daniel Veillard42595322004-11-08 10:52:06 +000028980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028981}
28982
28983
28984static int
28985test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028987
William M. Brack21e4ef22005-01-02 09:53:13 +000028988#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028989 int mem_base;
28990 int ret_val;
28991 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28992 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028993
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028994 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028996 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028997
28998 ret_val = xmlTextReaderClose(reader);
28999 desret_int(ret_val);
29000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029001 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029002 xmlResetLastError();
29003 if (mem_base != xmlMemBlocks()) {
29004 printf("Leak of %d blocks found in xmlTextReaderClose",
29005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029006 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029007 printf(" %d", n_reader);
29008 printf("\n");
29009 }
29010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029011 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029012#endif
29013
Daniel Veillard42595322004-11-08 10:52:06 +000029014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029015}
29016
29017
29018static int
29019test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029021
William M. Brack21e4ef22005-01-02 09:53:13 +000029022#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029023 int mem_base;
29024 const xmlChar * ret_val;
29025 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29026 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029027
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029028 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029030 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029031
29032 ret_val = xmlTextReaderConstBaseUri(reader);
29033 desret_const_xmlChar_ptr(ret_val);
29034 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029035 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029036 xmlResetLastError();
29037 if (mem_base != xmlMemBlocks()) {
29038 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029040 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029041 printf(" %d", n_reader);
29042 printf("\n");
29043 }
29044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029045 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029046#endif
29047
Daniel Veillard42595322004-11-08 10:52:06 +000029048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029049}
29050
29051
29052static int
29053test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029055
William M. Brack21e4ef22005-01-02 09:53:13 +000029056#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029057 int mem_base;
29058 const xmlChar * ret_val;
29059 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29060 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029061
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029062 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29063 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029064 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029065
29066 ret_val = xmlTextReaderConstEncoding(reader);
29067 desret_const_xmlChar_ptr(ret_val);
29068 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029069 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029070 xmlResetLastError();
29071 if (mem_base != xmlMemBlocks()) {
29072 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029074 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029075 printf(" %d", n_reader);
29076 printf("\n");
29077 }
29078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029079 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080#endif
29081
Daniel Veillard42595322004-11-08 10:52:06 +000029082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029083}
29084
29085
29086static int
29087test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029089
William M. Brack21e4ef22005-01-02 09:53:13 +000029090#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029091 int mem_base;
29092 const xmlChar * ret_val;
29093 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29094 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029095
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029096 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029098 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029099
29100 ret_val = xmlTextReaderConstLocalName(reader);
29101 desret_const_xmlChar_ptr(ret_val);
29102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029103 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029104 xmlResetLastError();
29105 if (mem_base != xmlMemBlocks()) {
29106 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029108 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029109 printf(" %d", n_reader);
29110 printf("\n");
29111 }
29112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029113 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114#endif
29115
Daniel Veillard42595322004-11-08 10:52:06 +000029116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029117}
29118
29119
29120static int
29121test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029123
William M. Brack21e4ef22005-01-02 09:53:13 +000029124#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029125 int mem_base;
29126 const xmlChar * ret_val;
29127 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29128 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029130 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029132 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029133
29134 ret_val = xmlTextReaderConstName(reader);
29135 desret_const_xmlChar_ptr(ret_val);
29136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029137 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029138 xmlResetLastError();
29139 if (mem_base != xmlMemBlocks()) {
29140 printf("Leak of %d blocks found in xmlTextReaderConstName",
29141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029142 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029143 printf(" %d", n_reader);
29144 printf("\n");
29145 }
29146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029147 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148#endif
29149
Daniel Veillard42595322004-11-08 10:52:06 +000029150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029151}
29152
29153
29154static int
29155test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029157
William M. Brack21e4ef22005-01-02 09:53:13 +000029158#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029159 int mem_base;
29160 const xmlChar * ret_val;
29161 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29162 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029163
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029164 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029166 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029167
29168 ret_val = xmlTextReaderConstNamespaceUri(reader);
29169 desret_const_xmlChar_ptr(ret_val);
29170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029171 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029172 xmlResetLastError();
29173 if (mem_base != xmlMemBlocks()) {
29174 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029176 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029177 printf(" %d", n_reader);
29178 printf("\n");
29179 }
29180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029181 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182#endif
29183
Daniel Veillard42595322004-11-08 10:52:06 +000029184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029185}
29186
29187
29188static int
29189test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029191
William M. Brack21e4ef22005-01-02 09:53:13 +000029192#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029193 int mem_base;
29194 const xmlChar * ret_val;
29195 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29196 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029197
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029198 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029200 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029201
29202 ret_val = xmlTextReaderConstPrefix(reader);
29203 desret_const_xmlChar_ptr(ret_val);
29204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029205 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029206 xmlResetLastError();
29207 if (mem_base != xmlMemBlocks()) {
29208 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029210 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029211 printf(" %d", n_reader);
29212 printf("\n");
29213 }
29214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029215 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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_xmlTextReaderConstString(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 Veillardd005b9e2004-11-03 17:07:05 +000029227 int mem_base;
29228 const xmlChar * ret_val;
29229 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29230 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029231 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029232 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029233
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029234 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29235 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029237 reader = gen_xmlTextReaderPtr(n_reader, 0);
29238 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029239
William M. Brackf13f77f2004-11-12 16:03:48 +000029240 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029241 desret_const_xmlChar_ptr(ret_val);
29242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029243 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029244 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029245 xmlResetLastError();
29246 if (mem_base != xmlMemBlocks()) {
29247 printf("Leak of %d blocks found in xmlTextReaderConstString",
29248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029249 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029250 printf(" %d", n_reader);
29251 printf(" %d", n_str);
29252 printf("\n");
29253 }
29254 }
29255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029256 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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_xmlTextReaderConstValue(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 Veillardd005b9e2004-11-03 17:07:05 +000029268 int mem_base;
29269 const xmlChar * ret_val;
29270 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29271 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029272
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029273 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029275 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029276
29277 ret_val = xmlTextReaderConstValue(reader);
29278 desret_const_xmlChar_ptr(ret_val);
29279 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029280 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029281 xmlResetLastError();
29282 if (mem_base != xmlMemBlocks()) {
29283 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029285 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029286 printf(" %d", n_reader);
29287 printf("\n");
29288 }
29289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029290 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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_xmlTextReaderConstXmlLang(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 Veillardd005b9e2004-11-03 17:07:05 +000029302 int mem_base;
29303 const xmlChar * ret_val;
29304 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29305 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029306
Daniel Veillardd005b9e2004-11-03 17:07:05 +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 Veillardd005b9e2004-11-03 17:07:05 +000029310
29311 ret_val = xmlTextReaderConstXmlLang(reader);
29312 desret_const_xmlChar_ptr(ret_val);
29313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029314 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029315 xmlResetLastError();
29316 if (mem_base != xmlMemBlocks()) {
29317 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029319 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029320 printf(" %d", n_reader);
29321 printf("\n");
29322 }
29323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029324 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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_xmlTextReaderConstXmlVersion(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 Veillardd005b9e2004-11-03 17:07:05 +000029336 int mem_base;
29337 const xmlChar * ret_val;
29338 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29339 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029340
Daniel Veillardd005b9e2004-11-03 17:07:05 +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 Veillardd005b9e2004-11-03 17:07:05 +000029344
29345 ret_val = xmlTextReaderConstXmlVersion(reader);
29346 desret_const_xmlChar_ptr(ret_val);
29347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029348 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029349 xmlResetLastError();
29350 if (mem_base != xmlMemBlocks()) {
29351 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029353 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029354 printf(" %d", n_reader);
29355 printf("\n");
29356 }
29357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029358 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +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
29366test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029368
William M. Brack21e4ef22005-01-02 09:53:13 +000029369#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029370 int mem_base;
29371 xmlDocPtr ret_val;
29372 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29373 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029374
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029375 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029377 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029378
29379 ret_val = xmlTextReaderCurrentDoc(reader);
29380 desret_xmlDocPtr(ret_val);
29381 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029382 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029383 xmlResetLastError();
29384 if (mem_base != xmlMemBlocks()) {
29385 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029387 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029388 printf(" %d", n_reader);
29389 printf("\n");
29390 }
29391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029392 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029393#endif
29394
Daniel Veillard42595322004-11-08 10:52:06 +000029395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029396}
29397
29398
29399static int
29400test_xmlTextReaderCurrentNode(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 xmlNodePtr 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 = xmlTextReaderCurrentNode(reader);
29414 desret_xmlNodePtr(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 xmlTextReaderCurrentNode",
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_xmlTextReaderDepth(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 Veillarddd6d3002004-11-03 14:20:29 +000029438 int mem_base;
29439 int ret_val;
29440 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29441 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029442
Daniel Veillarddd6d3002004-11-03 14:20:29 +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 Veillarddd6d3002004-11-03 14:20:29 +000029446
29447 ret_val = xmlTextReaderDepth(reader);
29448 desret_int(ret_val);
29449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029450 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029451 xmlResetLastError();
29452 if (mem_base != xmlMemBlocks()) {
29453 printf("Leak of %d blocks found in xmlTextReaderDepth",
29454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029455 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029456 printf(" %d", n_reader);
29457 printf("\n");
29458 }
29459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029460 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderExpand(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 Veillarddd6d3002004-11-03 14:20:29 +000029472 int mem_base;
29473 xmlNodePtr ret_val;
29474 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29475 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029476
Daniel Veillarddd6d3002004-11-03 14:20:29 +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 Veillarddd6d3002004-11-03 14:20:29 +000029480
29481 ret_val = xmlTextReaderExpand(reader);
29482 desret_xmlNodePtr(ret_val);
29483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029484 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029485 xmlResetLastError();
29486 if (mem_base != xmlMemBlocks()) {
29487 printf("Leak of %d blocks found in xmlTextReaderExpand",
29488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029489 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029490 printf(" %d", n_reader);
29491 printf("\n");
29492 }
29493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029494 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +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_xmlTextReaderGetAttribute(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 Veillarddd6d3002004-11-03 14:20:29 +000029506 int mem_base;
29507 xmlChar * ret_val;
29508 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29509 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029510 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029511 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029512
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029513 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29514 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029516 reader = gen_xmlTextReaderPtr(n_reader, 0);
29517 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029518
William M. Brackf13f77f2004-11-12 16:03:48 +000029519 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029520 desret_xmlChar_ptr(ret_val);
29521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029522 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029524 xmlResetLastError();
29525 if (mem_base != xmlMemBlocks()) {
29526 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029528 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029529 printf(" %d", n_reader);
29530 printf(" %d", n_name);
29531 printf("\n");
29532 }
29533 }
29534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029535 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029536#endif
29537
Daniel Veillard42595322004-11-08 10:52:06 +000029538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029539}
29540
29541
29542static int
29543test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029545
William M. Brack21e4ef22005-01-02 09:53:13 +000029546#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029547 int mem_base;
29548 xmlChar * ret_val;
29549 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29550 int n_reader;
29551 int no; /* the zero-based index of the attribute relative to the containing element */
29552 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029553
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029554 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29555 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029557 reader = gen_xmlTextReaderPtr(n_reader, 0);
29558 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029559
29560 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29561 desret_xmlChar_ptr(ret_val);
29562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029563 des_xmlTextReaderPtr(n_reader, reader, 0);
29564 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029565 xmlResetLastError();
29566 if (mem_base != xmlMemBlocks()) {
29567 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029569 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029570 printf(" %d", n_reader);
29571 printf(" %d", n_no);
29572 printf("\n");
29573 }
29574 }
29575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029576 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029577#endif
29578
Daniel Veillard42595322004-11-08 10:52:06 +000029579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029580}
29581
29582
29583static int
29584test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029586
William M. Brack21e4ef22005-01-02 09:53:13 +000029587#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029588 int mem_base;
29589 xmlChar * ret_val;
29590 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29591 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029592 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029593 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029594 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029595 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029596
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029597 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29598 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29599 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029601 reader = gen_xmlTextReaderPtr(n_reader, 0);
29602 localName = gen_const_xmlChar_ptr(n_localName, 1);
29603 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029604
William M. Brackf13f77f2004-11-12 16:03:48 +000029605 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029606 desret_xmlChar_ptr(ret_val);
29607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029608 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029609 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29610 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029611 xmlResetLastError();
29612 if (mem_base != xmlMemBlocks()) {
29613 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029615 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029616 printf(" %d", n_reader);
29617 printf(" %d", n_localName);
29618 printf(" %d", n_namespaceURI);
29619 printf("\n");
29620 }
29621 }
29622 }
29623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029624 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029625#endif
29626
Daniel Veillard42595322004-11-08 10:52:06 +000029627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029628}
29629
Daniel Veillarda521d282004-11-09 14:59:59 +000029630#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029631
Daniel Veillardce682bc2004-11-05 17:22:25 +000029632#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29633static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29634 return(NULL);
29635}
29636static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29637}
Daniel Veillarda521d282004-11-09 14:59:59 +000029638#endif
29639
Daniel Veillardce682bc2004-11-05 17:22:25 +000029640
Daniel Veillardd93f6252004-11-02 15:53:51 +000029641static int
29642test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029644
William M. Brack21e4ef22005-01-02 09:53:13 +000029645#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029646 int mem_base;
29647 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29648 int n_reader;
29649 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29650 int n_f;
29651 void ** arg; /* a user argument */
29652 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029653
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029654 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29655 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29656 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29657 mem_base = xmlMemBlocks();
29658 reader = gen_xmlTextReaderPtr(n_reader, 0);
29659 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29660 arg = gen_void_ptr_ptr(n_arg, 2);
29661
29662 xmlTextReaderGetErrorHandler(reader, f, arg);
29663 call_tests++;
29664 des_xmlTextReaderPtr(n_reader, reader, 0);
29665 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29666 des_void_ptr_ptr(n_arg, arg, 2);
29667 xmlResetLastError();
29668 if (mem_base != xmlMemBlocks()) {
29669 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029671 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029672 printf(" %d", n_reader);
29673 printf(" %d", n_f);
29674 printf(" %d", n_arg);
29675 printf("\n");
29676 }
29677 }
29678 }
29679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029680 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029681#endif
29682
Daniel Veillard42595322004-11-08 10:52:06 +000029683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029684}
29685
29686
29687static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029688test_xmlTextReaderGetParserColumnNumber(void) {
29689 int test_ret = 0;
29690
29691#if defined(LIBXML_READER_ENABLED)
29692 int mem_base;
29693 int ret_val;
29694 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29695 int n_reader;
29696
29697 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29698 mem_base = xmlMemBlocks();
29699 reader = gen_xmlTextReaderPtr(n_reader, 0);
29700
29701 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29702 desret_int(ret_val);
29703 call_tests++;
29704 des_xmlTextReaderPtr(n_reader, reader, 0);
29705 xmlResetLastError();
29706 if (mem_base != xmlMemBlocks()) {
29707 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29708 xmlMemBlocks() - mem_base);
29709 test_ret++;
29710 printf(" %d", n_reader);
29711 printf("\n");
29712 }
29713 }
29714 function_tests++;
29715#endif
29716
29717 return(test_ret);
29718}
29719
29720
29721static int
29722test_xmlTextReaderGetParserLineNumber(void) {
29723 int test_ret = 0;
29724
29725#if defined(LIBXML_READER_ENABLED)
29726 int mem_base;
29727 int ret_val;
29728 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29729 int n_reader;
29730
29731 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29732 mem_base = xmlMemBlocks();
29733 reader = gen_xmlTextReaderPtr(n_reader, 0);
29734
29735 ret_val = xmlTextReaderGetParserLineNumber(reader);
29736 desret_int(ret_val);
29737 call_tests++;
29738 des_xmlTextReaderPtr(n_reader, reader, 0);
29739 xmlResetLastError();
29740 if (mem_base != xmlMemBlocks()) {
29741 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29742 xmlMemBlocks() - mem_base);
29743 test_ret++;
29744 printf(" %d", n_reader);
29745 printf("\n");
29746 }
29747 }
29748 function_tests++;
29749#endif
29750
29751 return(test_ret);
29752}
29753
29754
29755static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029756test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029758
William M. Brack21e4ef22005-01-02 09:53:13 +000029759#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029760 int mem_base;
29761 int ret_val;
29762 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29763 int n_reader;
29764 int prop; /* the xmlParserProperties to get */
29765 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029766
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029767 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29768 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029770 reader = gen_xmlTextReaderPtr(n_reader, 0);
29771 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029772
29773 ret_val = xmlTextReaderGetParserProp(reader, prop);
29774 desret_int(ret_val);
29775 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029776 des_xmlTextReaderPtr(n_reader, reader, 0);
29777 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029778 xmlResetLastError();
29779 if (mem_base != xmlMemBlocks()) {
29780 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029782 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029783 printf(" %d", n_reader);
29784 printf(" %d", n_prop);
29785 printf("\n");
29786 }
29787 }
29788 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029789 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790#endif
29791
Daniel Veillard42595322004-11-08 10:52:06 +000029792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029793}
29794
29795
29796static int
29797test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029799
William M. Brack21e4ef22005-01-02 09:53:13 +000029800#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029801 int mem_base;
29802 xmlParserInputBufferPtr ret_val;
29803 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29804 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029805
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029806 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29807 mem_base = xmlMemBlocks();
29808 reader = gen_xmlTextReaderPtr(n_reader, 0);
29809
29810 ret_val = xmlTextReaderGetRemainder(reader);
29811 desret_xmlParserInputBufferPtr(ret_val);
29812 call_tests++;
29813 des_xmlTextReaderPtr(n_reader, reader, 0);
29814 xmlResetLastError();
29815 if (mem_base != xmlMemBlocks()) {
29816 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029818 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029819 printf(" %d", n_reader);
29820 printf("\n");
29821 }
29822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029823 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029824#endif
29825
Daniel Veillard42595322004-11-08 10:52:06 +000029826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029827}
29828
29829
29830static int
29831test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029833
William M. Brack21e4ef22005-01-02 09:53:13 +000029834#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029835 int mem_base;
29836 int ret_val;
29837 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29838 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029839
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029840 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29841 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029842 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029843
29844 ret_val = xmlTextReaderHasAttributes(reader);
29845 desret_int(ret_val);
29846 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029847 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029848 xmlResetLastError();
29849 if (mem_base != xmlMemBlocks()) {
29850 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029852 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029853 printf(" %d", n_reader);
29854 printf("\n");
29855 }
29856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029857 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858#endif
29859
Daniel Veillard42595322004-11-08 10:52:06 +000029860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029861}
29862
29863
29864static int
29865test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029867
William M. Brack21e4ef22005-01-02 09:53:13 +000029868#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029869 int mem_base;
29870 int ret_val;
29871 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29872 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029873
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029874 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029876 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029877
29878 ret_val = xmlTextReaderHasValue(reader);
29879 desret_int(ret_val);
29880 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029881 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029882 xmlResetLastError();
29883 if (mem_base != xmlMemBlocks()) {
29884 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029886 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029887 printf(" %d", n_reader);
29888 printf("\n");
29889 }
29890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029891 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892#endif
29893
Daniel Veillard42595322004-11-08 10:52:06 +000029894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029895}
29896
29897
29898static int
29899test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029901
William M. Brack21e4ef22005-01-02 09:53:13 +000029902#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029903 int mem_base;
29904 int ret_val;
29905 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29906 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029907
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029908 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029910 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029911
29912 ret_val = xmlTextReaderIsDefault(reader);
29913 desret_int(ret_val);
29914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029915 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029916 xmlResetLastError();
29917 if (mem_base != xmlMemBlocks()) {
29918 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029920 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921 printf(" %d", n_reader);
29922 printf("\n");
29923 }
29924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029925 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926#endif
29927
Daniel Veillard42595322004-11-08 10:52:06 +000029928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029929}
29930
29931
29932static int
29933test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029935
William M. Brack21e4ef22005-01-02 09:53:13 +000029936#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029937 int mem_base;
29938 int ret_val;
29939 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29940 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029941
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029942 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029944 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029945
29946 ret_val = xmlTextReaderIsEmptyElement(reader);
29947 desret_int(ret_val);
29948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029949 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029950 xmlResetLastError();
29951 if (mem_base != xmlMemBlocks()) {
29952 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029954 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029955 printf(" %d", n_reader);
29956 printf("\n");
29957 }
29958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029959 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029960#endif
29961
Daniel Veillard42595322004-11-08 10:52:06 +000029962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029963}
29964
29965
29966static int
29967test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029969
William M. Brack21e4ef22005-01-02 09:53:13 +000029970#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029971 int mem_base;
29972 int ret_val;
29973 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29974 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029975
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029976 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029978 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029979
29980 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29981 desret_int(ret_val);
29982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029983 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029984 xmlResetLastError();
29985 if (mem_base != xmlMemBlocks()) {
29986 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029988 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029989 printf(" %d", n_reader);
29990 printf("\n");
29991 }
29992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029993 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029994#endif
29995
Daniel Veillard42595322004-11-08 10:52:06 +000029996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029997}
29998
29999
30000static int
30001test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030003
William M. Brack21e4ef22005-01-02 09:53:13 +000030004#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030005 int mem_base;
30006 int ret_val;
30007 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30008 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030009
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030010 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30011 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030012 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030013
30014 ret_val = xmlTextReaderIsValid(reader);
30015 desret_int(ret_val);
30016 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030017 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030018 xmlResetLastError();
30019 if (mem_base != xmlMemBlocks()) {
30020 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030022 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030023 printf(" %d", n_reader);
30024 printf("\n");
30025 }
30026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030027 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030028#endif
30029
Daniel Veillard42595322004-11-08 10:52:06 +000030030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031}
30032
30033
30034static int
30035test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030037
William M. Brack21e4ef22005-01-02 09:53:13 +000030038#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030039 int mem_base;
30040 xmlChar * ret_val;
30041 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30042 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030043
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030044 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30045 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030046 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030047
30048 ret_val = xmlTextReaderLocalName(reader);
30049 desret_xmlChar_ptr(ret_val);
30050 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030051 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030052 xmlResetLastError();
30053 if (mem_base != xmlMemBlocks()) {
30054 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030056 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030057 printf(" %d", n_reader);
30058 printf("\n");
30059 }
30060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030061 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030062#endif
30063
Daniel Veillard42595322004-11-08 10:52:06 +000030064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030065}
30066
Daniel Veillarda521d282004-11-09 14:59:59 +000030067#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030068
Daniel Veillardce682bc2004-11-05 17:22:25 +000030069#define gen_nb_xmlTextReaderLocatorPtr 1
30070static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30071 return(NULL);
30072}
30073static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30074}
Daniel Veillarda521d282004-11-09 14:59:59 +000030075#endif
30076
Daniel Veillardce682bc2004-11-05 17:22:25 +000030077
Daniel Veillardd93f6252004-11-02 15:53:51 +000030078static int
30079test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030081
William M. Brack21e4ef22005-01-02 09:53:13 +000030082#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030083 int mem_base;
30084 xmlChar * ret_val;
30085 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30086 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030087
Daniel Veillardce682bc2004-11-05 17:22:25 +000030088 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30089 mem_base = xmlMemBlocks();
30090 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30091
30092 ret_val = xmlTextReaderLocatorBaseURI(locator);
30093 desret_xmlChar_ptr(ret_val);
30094 call_tests++;
30095 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30096 xmlResetLastError();
30097 if (mem_base != xmlMemBlocks()) {
30098 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030100 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030101 printf(" %d", n_locator);
30102 printf("\n");
30103 }
30104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030105 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030106#endif
30107
Daniel Veillard42595322004-11-08 10:52:06 +000030108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030109}
30110
30111
30112static int
30113test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030115
William M. Brack21e4ef22005-01-02 09:53:13 +000030116#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030117 int mem_base;
30118 int ret_val;
30119 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30120 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030121
Daniel Veillardce682bc2004-11-05 17:22:25 +000030122 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30123 mem_base = xmlMemBlocks();
30124 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30125
30126 ret_val = xmlTextReaderLocatorLineNumber(locator);
30127 desret_int(ret_val);
30128 call_tests++;
30129 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30130 xmlResetLastError();
30131 if (mem_base != xmlMemBlocks()) {
30132 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030134 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030135 printf(" %d", n_locator);
30136 printf("\n");
30137 }
30138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030139 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030140#endif
30141
Daniel Veillard42595322004-11-08 10:52:06 +000030142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030143}
30144
30145
30146static int
30147test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030149
William M. Brack21e4ef22005-01-02 09:53:13 +000030150#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030151 int mem_base;
30152 xmlChar * ret_val;
30153 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30154 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030155 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 +000030156 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030157
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030158 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30159 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030161 reader = gen_xmlTextReaderPtr(n_reader, 0);
30162 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163
William M. Brackf13f77f2004-11-12 16:03:48 +000030164 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030165 desret_xmlChar_ptr(ret_val);
30166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030167 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030168 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030169 xmlResetLastError();
30170 if (mem_base != xmlMemBlocks()) {
30171 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030173 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 printf(" %d", n_reader);
30175 printf(" %d", n_prefix);
30176 printf("\n");
30177 }
30178 }
30179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030180 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030181#endif
30182
Daniel Veillard42595322004-11-08 10:52:06 +000030183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030184}
30185
30186
30187static int
30188test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030190
William M. Brack21e4ef22005-01-02 09:53:13 +000030191#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192 int mem_base;
30193 int ret_val;
30194 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30195 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030196 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030198
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030199 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30200 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030202 reader = gen_xmlTextReaderPtr(n_reader, 0);
30203 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030204
William M. Brackf13f77f2004-11-12 16:03:48 +000030205 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030206 desret_int(ret_val);
30207 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030208 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030209 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030210 xmlResetLastError();
30211 if (mem_base != xmlMemBlocks()) {
30212 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030214 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030215 printf(" %d", n_reader);
30216 printf(" %d", n_name);
30217 printf("\n");
30218 }
30219 }
30220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030221 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030222#endif
30223
Daniel Veillard42595322004-11-08 10:52:06 +000030224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030225}
30226
30227
30228static int
30229test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030231
William M. Brack21e4ef22005-01-02 09:53:13 +000030232#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030233 int mem_base;
30234 int ret_val;
30235 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30236 int n_reader;
30237 int no; /* the zero-based index of the attribute relative to the containing element. */
30238 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030239
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030240 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30241 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030243 reader = gen_xmlTextReaderPtr(n_reader, 0);
30244 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245
30246 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30247 desret_int(ret_val);
30248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030249 des_xmlTextReaderPtr(n_reader, reader, 0);
30250 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030251 xmlResetLastError();
30252 if (mem_base != xmlMemBlocks()) {
30253 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030255 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030256 printf(" %d", n_reader);
30257 printf(" %d", n_no);
30258 printf("\n");
30259 }
30260 }
30261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030262 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030263#endif
30264
Daniel Veillard42595322004-11-08 10:52:06 +000030265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030266}
30267
30268
30269static int
30270test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030272
William M. Brack21e4ef22005-01-02 09:53:13 +000030273#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030274 int mem_base;
30275 int ret_val;
30276 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30277 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030278 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030279 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030280 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030281 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030282
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030283 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30284 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30285 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030287 reader = gen_xmlTextReaderPtr(n_reader, 0);
30288 localName = gen_const_xmlChar_ptr(n_localName, 1);
30289 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030290
William M. Brackf13f77f2004-11-12 16:03:48 +000030291 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030292 desret_int(ret_val);
30293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030294 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030295 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30296 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030297 xmlResetLastError();
30298 if (mem_base != xmlMemBlocks()) {
30299 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
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(" %d", n_localName);
30304 printf(" %d", n_namespaceURI);
30305 printf("\n");
30306 }
30307 }
30308 }
30309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030310 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311#endif
30312
Daniel Veillard42595322004-11-08 10:52:06 +000030313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030314}
30315
30316
30317static int
30318test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030320
William M. Brack21e4ef22005-01-02 09:53:13 +000030321#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030322 int mem_base;
30323 int ret_val;
30324 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30325 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030326
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030327 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030329 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030330
30331 ret_val = xmlTextReaderMoveToElement(reader);
30332 desret_int(ret_val);
30333 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030334 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030335 xmlResetLastError();
30336 if (mem_base != xmlMemBlocks()) {
30337 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030339 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030340 printf(" %d", n_reader);
30341 printf("\n");
30342 }
30343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030344 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345#endif
30346
Daniel Veillard42595322004-11-08 10:52:06 +000030347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030348}
30349
30350
30351static int
30352test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030354
William M. Brack21e4ef22005-01-02 09:53:13 +000030355#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030356 int mem_base;
30357 int ret_val;
30358 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30359 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030360
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030363 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030364
30365 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30366 desret_int(ret_val);
30367 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030368 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030369 xmlResetLastError();
30370 if (mem_base != xmlMemBlocks()) {
30371 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030373 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030374 printf(" %d", n_reader);
30375 printf("\n");
30376 }
30377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030378 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379#endif
30380
Daniel Veillard42595322004-11-08 10:52:06 +000030381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030382}
30383
30384
30385static int
30386test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030388
William M. Brack21e4ef22005-01-02 09:53:13 +000030389#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030390 int mem_base;
30391 int ret_val;
30392 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30393 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030394
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030395 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030397 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030398
30399 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30400 desret_int(ret_val);
30401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030402 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030403 xmlResetLastError();
30404 if (mem_base != xmlMemBlocks()) {
30405 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030407 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030408 printf(" %d", n_reader);
30409 printf("\n");
30410 }
30411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030412 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413#endif
30414
Daniel Veillard42595322004-11-08 10:52:06 +000030415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030416}
30417
30418
30419static int
30420test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030422
William M. Brack21e4ef22005-01-02 09:53:13 +000030423#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030424 int mem_base;
30425 xmlChar * ret_val;
30426 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30427 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030428
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030429 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30430 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030431 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030432
30433 ret_val = xmlTextReaderName(reader);
30434 desret_xmlChar_ptr(ret_val);
30435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030436 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030437 xmlResetLastError();
30438 if (mem_base != xmlMemBlocks()) {
30439 printf("Leak of %d blocks found in xmlTextReaderName",
30440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030441 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030442 printf(" %d", n_reader);
30443 printf("\n");
30444 }
30445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030446 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447#endif
30448
Daniel Veillard42595322004-11-08 10:52:06 +000030449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030450}
30451
30452
30453static int
30454test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030456
William M. Brack21e4ef22005-01-02 09:53:13 +000030457#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030458 int mem_base;
30459 xmlChar * ret_val;
30460 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30461 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030462
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030463 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030465 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030466
30467 ret_val = xmlTextReaderNamespaceUri(reader);
30468 desret_xmlChar_ptr(ret_val);
30469 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030470 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030471 xmlResetLastError();
30472 if (mem_base != xmlMemBlocks()) {
30473 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030475 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030476 printf(" %d", n_reader);
30477 printf("\n");
30478 }
30479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030480 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481#endif
30482
Daniel Veillard42595322004-11-08 10:52:06 +000030483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030484}
30485
30486
30487static int
30488test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030490
William M. Brack21e4ef22005-01-02 09:53:13 +000030491#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030492 int mem_base;
30493 int ret_val;
30494 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30495 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030496
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030497 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30498 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030499 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030500
30501 ret_val = xmlTextReaderNext(reader);
30502 desret_int(ret_val);
30503 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030504 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505 xmlResetLastError();
30506 if (mem_base != xmlMemBlocks()) {
30507 printf("Leak of %d blocks found in xmlTextReaderNext",
30508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030509 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030510 printf(" %d", n_reader);
30511 printf("\n");
30512 }
30513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030514 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515#endif
30516
Daniel Veillard42595322004-11-08 10:52:06 +000030517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030518}
30519
30520
30521static int
30522test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030524
William M. Brack21e4ef22005-01-02 09:53:13 +000030525#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030526 int mem_base;
30527 int ret_val;
30528 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30529 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030530
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030531 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30532 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030533 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030534
30535 ret_val = xmlTextReaderNextSibling(reader);
30536 desret_int(ret_val);
30537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030538 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030539 xmlResetLastError();
30540 if (mem_base != xmlMemBlocks()) {
30541 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030543 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030544 printf(" %d", n_reader);
30545 printf("\n");
30546 }
30547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030548 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549#endif
30550
Daniel Veillard42595322004-11-08 10:52:06 +000030551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030552}
30553
30554
30555static int
30556test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030558
William M. Brack21e4ef22005-01-02 09:53:13 +000030559#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030560 int mem_base;
30561 int ret_val;
30562 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30563 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030564
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030565 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30566 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030567 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030568
30569 ret_val = xmlTextReaderNodeType(reader);
30570 desret_int(ret_val);
30571 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030572 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030573 xmlResetLastError();
30574 if (mem_base != xmlMemBlocks()) {
30575 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030577 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030578 printf(" %d", n_reader);
30579 printf("\n");
30580 }
30581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030582 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583#endif
30584
Daniel Veillard42595322004-11-08 10:52:06 +000030585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030586}
30587
30588
30589static int
30590test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030592
William M. Brack21e4ef22005-01-02 09:53:13 +000030593#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030594 int mem_base;
30595 int ret_val;
30596 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30597 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030598
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030599 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030601 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030602
30603 ret_val = xmlTextReaderNormalization(reader);
30604 desret_int(ret_val);
30605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030606 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030607 xmlResetLastError();
30608 if (mem_base != xmlMemBlocks()) {
30609 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030611 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030612 printf(" %d", n_reader);
30613 printf("\n");
30614 }
30615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030616 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030617#endif
30618
Daniel Veillard42595322004-11-08 10:52:06 +000030619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030620}
30621
30622
30623static int
30624test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030626
William M. Brack21e4ef22005-01-02 09:53:13 +000030627#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030628 int mem_base;
30629 xmlChar * ret_val;
30630 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30631 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030632
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030633 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30634 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030635 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030636
30637 ret_val = xmlTextReaderPrefix(reader);
30638 desret_xmlChar_ptr(ret_val);
30639 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030640 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030641 xmlResetLastError();
30642 if (mem_base != xmlMemBlocks()) {
30643 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030645 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030646 printf(" %d", n_reader);
30647 printf("\n");
30648 }
30649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030650 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030651#endif
30652
Daniel Veillard42595322004-11-08 10:52:06 +000030653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030654}
30655
30656
30657static int
30658test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030660
William M. Brack21e4ef22005-01-02 09:53:13 +000030661#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030662 int mem_base;
30663 xmlNodePtr ret_val;
30664 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30665 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030666
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030667 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030669 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030670
30671 ret_val = xmlTextReaderPreserve(reader);
30672 desret_xmlNodePtr(ret_val);
30673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030674 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030675 xmlResetLastError();
30676 if (mem_base != xmlMemBlocks()) {
30677 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030679 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680 printf(" %d", n_reader);
30681 printf("\n");
30682 }
30683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030684 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685#endif
30686
Daniel Veillard42595322004-11-08 10:52:06 +000030687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030688}
30689
30690
30691static int
30692test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030694
William M. Brack21e4ef22005-01-02 09:53:13 +000030695#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030696#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030697 int mem_base;
30698 int ret_val;
30699 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30700 int n_reader;
30701 xmlChar * pattern; /* an XPath subset pattern */
30702 int n_pattern;
30703 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30704 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030705
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030706 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30707 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30708 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30709 mem_base = xmlMemBlocks();
30710 reader = gen_xmlTextReaderPtr(n_reader, 0);
30711 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30712 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30713
William M. Brackf13f77f2004-11-12 16:03:48 +000030714 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030715 desret_int(ret_val);
30716 call_tests++;
30717 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030718 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30719 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030720 xmlResetLastError();
30721 if (mem_base != xmlMemBlocks()) {
30722 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030724 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030725 printf(" %d", n_reader);
30726 printf(" %d", n_pattern);
30727 printf(" %d", n_namespaces);
30728 printf("\n");
30729 }
30730 }
30731 }
30732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030733 function_tests++;
30734#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030735#endif
30736
Daniel Veillard42595322004-11-08 10:52:06 +000030737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030738}
30739
30740
30741static int
30742test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030744
William M. Brack21e4ef22005-01-02 09:53:13 +000030745#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030746 int mem_base;
30747 int ret_val;
30748 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30749 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030750
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030751 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030753 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030754
30755 ret_val = xmlTextReaderQuoteChar(reader);
30756 desret_int(ret_val);
30757 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030758 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030759 xmlResetLastError();
30760 if (mem_base != xmlMemBlocks()) {
30761 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030763 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030764 printf(" %d", n_reader);
30765 printf("\n");
30766 }
30767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030768 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030769#endif
30770
Daniel Veillard42595322004-11-08 10:52:06 +000030771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030772}
30773
30774
30775static int
30776test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030778
William M. Brack21e4ef22005-01-02 09:53:13 +000030779#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030780 int mem_base;
30781 int ret_val;
30782 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30783 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030784
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030785 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030787 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030788
30789 ret_val = xmlTextReaderRead(reader);
30790 desret_int(ret_val);
30791 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030792 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030793 xmlResetLastError();
30794 if (mem_base != xmlMemBlocks()) {
30795 printf("Leak of %d blocks found in xmlTextReaderRead",
30796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030797 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030798 printf(" %d", n_reader);
30799 printf("\n");
30800 }
30801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030802 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030803#endif
30804
Daniel Veillard42595322004-11-08 10:52:06 +000030805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030806}
30807
30808
30809static int
30810test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030812
William M. Brack21e4ef22005-01-02 09:53:13 +000030813#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030814 int mem_base;
30815 int ret_val;
30816 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30817 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030818
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030819 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030821 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030822
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030823 ret_val = xmlTextReaderReadAttributeValue(reader);
30824 desret_int(ret_val);
30825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030826 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030827 xmlResetLastError();
30828 if (mem_base != xmlMemBlocks()) {
30829 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030831 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030832 printf(" %d", n_reader);
30833 printf("\n");
30834 }
30835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030836 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030837#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030838
Daniel Veillard42595322004-11-08 10:52:06 +000030839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030840}
30841
30842
30843static int
30844test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030846
William M. Brack21e4ef22005-01-02 09:53:13 +000030847#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030848 int mem_base;
30849 int ret_val;
30850 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30851 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030852
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030853 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030855 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030856
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030857 ret_val = xmlTextReaderReadState(reader);
30858 desret_int(ret_val);
30859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030860 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030861 xmlResetLastError();
30862 if (mem_base != xmlMemBlocks()) {
30863 printf("Leak of %d blocks found in xmlTextReaderReadState",
30864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030865 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030866 printf(" %d", n_reader);
30867 printf("\n");
30868 }
30869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030870 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030871#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030872
Daniel Veillard42595322004-11-08 10:52:06 +000030873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030874}
30875
30876
30877static int
30878test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030880
William M. Brack21e4ef22005-01-02 09:53:13 +000030881#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030882 int mem_base;
30883 int ret_val;
30884 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30885 int n_reader;
30886 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30887 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030888
Daniel Veillardce682bc2004-11-05 17:22:25 +000030889 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30890 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30891 mem_base = xmlMemBlocks();
30892 reader = gen_xmlTextReaderPtr(n_reader, 0);
30893 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30894
30895 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30896 desret_int(ret_val);
30897 call_tests++;
30898 des_xmlTextReaderPtr(n_reader, reader, 0);
30899 des_xmlRelaxNGPtr(n_schema, schema, 1);
30900 xmlResetLastError();
30901 if (mem_base != xmlMemBlocks()) {
30902 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030904 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030905 printf(" %d", n_reader);
30906 printf(" %d", n_schema);
30907 printf("\n");
30908 }
30909 }
30910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030911 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030912#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030913
Daniel Veillard42595322004-11-08 10:52:06 +000030914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030915}
30916
30917
30918static int
30919test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030921
William M. Brack21e4ef22005-01-02 09:53:13 +000030922#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030923 int mem_base;
30924 int ret_val;
30925 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30926 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030927 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030928 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030929
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030930 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30931 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030933 reader = gen_xmlTextReaderPtr(n_reader, 0);
30934 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030935
William M. Brackf13f77f2004-11-12 16:03:48 +000030936 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030937 desret_int(ret_val);
30938 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030939 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030940 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030941 xmlResetLastError();
30942 if (mem_base != xmlMemBlocks()) {
30943 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030945 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030946 printf(" %d", n_reader);
30947 printf(" %d", n_rng);
30948 printf("\n");
30949 }
30950 }
30951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030952 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030953#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030954
Daniel Veillard42595322004-11-08 10:52:06 +000030955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030956}
30957
30958
30959static int
30960test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030962
30963
30964 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030966}
30967
30968
30969static int
30970test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030972
William M. Brack21e4ef22005-01-02 09:53:13 +000030973#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030974 int mem_base;
30975 int ret_val;
30976 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30977 int n_reader;
30978 int prop; /* the xmlParserProperties to set */
30979 int n_prop;
30980 int value; /* usually 0 or 1 to (de)activate it */
30981 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030982
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30984 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30985 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30986 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030987 reader = gen_xmlTextReaderPtr(n_reader, 0);
30988 prop = gen_int(n_prop, 1);
30989 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030990
30991 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30992 desret_int(ret_val);
30993 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030994 des_xmlTextReaderPtr(n_reader, reader, 0);
30995 des_int(n_prop, prop, 1);
30996 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030997 xmlResetLastError();
30998 if (mem_base != xmlMemBlocks()) {
30999 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031001 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031002 printf(" %d", n_reader);
31003 printf(" %d", n_prop);
31004 printf(" %d", n_value);
31005 printf("\n");
31006 }
31007 }
31008 }
31009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031010 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031011#endif
31012
Daniel Veillard42595322004-11-08 10:52:06 +000031013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031014}
31015
31016
31017static int
31018test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031020
31021
31022 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031024}
31025
31026
31027static int
31028test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031030
William M. Brack21e4ef22005-01-02 09:53:13 +000031031#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031032 int mem_base;
31033 int ret_val;
31034 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31035 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031036
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031037 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031039 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031040
31041 ret_val = xmlTextReaderStandalone(reader);
31042 desret_int(ret_val);
31043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031044 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031045 xmlResetLastError();
31046 if (mem_base != xmlMemBlocks()) {
31047 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031049 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031050 printf(" %d", n_reader);
31051 printf("\n");
31052 }
31053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031054 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031055#endif
31056
Daniel Veillard42595322004-11-08 10:52:06 +000031057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031058}
31059
31060
31061static int
31062test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031064
William M. Brack21e4ef22005-01-02 09:53:13 +000031065#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031066 int mem_base;
31067 xmlChar * ret_val;
31068 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31069 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031070
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031071 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31072 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031073 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031074
31075 ret_val = xmlTextReaderValue(reader);
31076 desret_xmlChar_ptr(ret_val);
31077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031078 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031079 xmlResetLastError();
31080 if (mem_base != xmlMemBlocks()) {
31081 printf("Leak of %d blocks found in xmlTextReaderValue",
31082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031083 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031084 printf(" %d", n_reader);
31085 printf("\n");
31086 }
31087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031088 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031089#endif
31090
Daniel Veillard42595322004-11-08 10:52:06 +000031091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031092}
31093
31094
31095static int
31096test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031098
William M. Brack21e4ef22005-01-02 09:53:13 +000031099#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031100 int mem_base;
31101 xmlChar * ret_val;
31102 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31103 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031104
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031105 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031107 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031108
31109 ret_val = xmlTextReaderXmlLang(reader);
31110 desret_xmlChar_ptr(ret_val);
31111 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031112 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031113 xmlResetLastError();
31114 if (mem_base != xmlMemBlocks()) {
31115 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031117 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031118 printf(" %d", n_reader);
31119 printf("\n");
31120 }
31121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031122 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031123#endif
31124
Daniel Veillard42595322004-11-08 10:52:06 +000031125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031126}
31127
31128static int
31129test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031131
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031132 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031133 test_ret += test_xmlNewTextReader();
31134 test_ret += test_xmlNewTextReaderFilename();
31135 test_ret += test_xmlReaderForDoc();
31136 test_ret += test_xmlReaderForFile();
31137 test_ret += test_xmlReaderForMemory();
31138 test_ret += test_xmlReaderNewDoc();
31139 test_ret += test_xmlReaderNewFile();
31140 test_ret += test_xmlReaderNewMemory();
31141 test_ret += test_xmlReaderNewWalker();
31142 test_ret += test_xmlReaderWalker();
31143 test_ret += test_xmlTextReaderAttributeCount();
31144 test_ret += test_xmlTextReaderBaseUri();
31145 test_ret += test_xmlTextReaderClose();
31146 test_ret += test_xmlTextReaderConstBaseUri();
31147 test_ret += test_xmlTextReaderConstEncoding();
31148 test_ret += test_xmlTextReaderConstLocalName();
31149 test_ret += test_xmlTextReaderConstName();
31150 test_ret += test_xmlTextReaderConstNamespaceUri();
31151 test_ret += test_xmlTextReaderConstPrefix();
31152 test_ret += test_xmlTextReaderConstString();
31153 test_ret += test_xmlTextReaderConstValue();
31154 test_ret += test_xmlTextReaderConstXmlLang();
31155 test_ret += test_xmlTextReaderConstXmlVersion();
31156 test_ret += test_xmlTextReaderCurrentDoc();
31157 test_ret += test_xmlTextReaderCurrentNode();
31158 test_ret += test_xmlTextReaderDepth();
31159 test_ret += test_xmlTextReaderExpand();
31160 test_ret += test_xmlTextReaderGetAttribute();
31161 test_ret += test_xmlTextReaderGetAttributeNo();
31162 test_ret += test_xmlTextReaderGetAttributeNs();
31163 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031164 test_ret += test_xmlTextReaderGetParserColumnNumber();
31165 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031166 test_ret += test_xmlTextReaderGetParserProp();
31167 test_ret += test_xmlTextReaderGetRemainder();
31168 test_ret += test_xmlTextReaderHasAttributes();
31169 test_ret += test_xmlTextReaderHasValue();
31170 test_ret += test_xmlTextReaderIsDefault();
31171 test_ret += test_xmlTextReaderIsEmptyElement();
31172 test_ret += test_xmlTextReaderIsNamespaceDecl();
31173 test_ret += test_xmlTextReaderIsValid();
31174 test_ret += test_xmlTextReaderLocalName();
31175 test_ret += test_xmlTextReaderLocatorBaseURI();
31176 test_ret += test_xmlTextReaderLocatorLineNumber();
31177 test_ret += test_xmlTextReaderLookupNamespace();
31178 test_ret += test_xmlTextReaderMoveToAttribute();
31179 test_ret += test_xmlTextReaderMoveToAttributeNo();
31180 test_ret += test_xmlTextReaderMoveToAttributeNs();
31181 test_ret += test_xmlTextReaderMoveToElement();
31182 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31183 test_ret += test_xmlTextReaderMoveToNextAttribute();
31184 test_ret += test_xmlTextReaderName();
31185 test_ret += test_xmlTextReaderNamespaceUri();
31186 test_ret += test_xmlTextReaderNext();
31187 test_ret += test_xmlTextReaderNextSibling();
31188 test_ret += test_xmlTextReaderNodeType();
31189 test_ret += test_xmlTextReaderNormalization();
31190 test_ret += test_xmlTextReaderPrefix();
31191 test_ret += test_xmlTextReaderPreserve();
31192 test_ret += test_xmlTextReaderPreservePattern();
31193 test_ret += test_xmlTextReaderQuoteChar();
31194 test_ret += test_xmlTextReaderRead();
31195 test_ret += test_xmlTextReaderReadAttributeValue();
31196 test_ret += test_xmlTextReaderReadState();
31197 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31198 test_ret += test_xmlTextReaderRelaxNGValidate();
31199 test_ret += test_xmlTextReaderSetErrorHandler();
31200 test_ret += test_xmlTextReaderSetParserProp();
31201 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31202 test_ret += test_xmlTextReaderStandalone();
31203 test_ret += test_xmlTextReaderValue();
31204 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031205
Daniel Veillard42595322004-11-08 10:52:06 +000031206 if (test_ret != 0)
31207 printf("Module xmlreader: %d errors\n", test_ret);
31208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031209}
Daniel Veillarda521d282004-11-09 14:59:59 +000031210#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031211
Daniel Veillarda82b1822004-11-08 16:24:57 +000031212#define gen_nb_xmlRegExecCtxtPtr 1
31213static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31214 return(NULL);
31215}
31216static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31217}
Daniel Veillarda521d282004-11-09 14:59:59 +000031218#endif
31219
Daniel Veillarda82b1822004-11-08 16:24:57 +000031220
31221static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031222test_xmlRegExecErrInfo(void) {
31223 int test_ret = 0;
31224
31225#if defined(LIBXML_REGEXP_ENABLED)
31226 int mem_base;
31227 int ret_val;
31228 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31229 int n_exec;
31230 xmlChar ** string; /* return value for the error string */
31231 int n_string;
31232 int * nbval; /* pointer to the number of accepted values IN/OUT */
31233 int n_nbval;
31234 int * nbneg; /* return number of negative transitions */
31235 int n_nbneg;
31236 xmlChar ** values; /* pointer to the array of acceptable values */
31237 int n_values;
31238 int * terminal; /* return value if this was a terminal state */
31239 int n_terminal;
31240
31241 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31242 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31243 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31244 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31245 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31246 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31247 mem_base = xmlMemBlocks();
31248 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31249 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31250 nbval = gen_int_ptr(n_nbval, 2);
31251 nbneg = gen_int_ptr(n_nbneg, 3);
31252 values = gen_xmlChar_ptr_ptr(n_values, 4);
31253 terminal = gen_int_ptr(n_terminal, 5);
31254
31255 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31256 desret_int(ret_val);
31257 call_tests++;
31258 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31259 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31260 des_int_ptr(n_nbval, nbval, 2);
31261 des_int_ptr(n_nbneg, nbneg, 3);
31262 des_xmlChar_ptr_ptr(n_values, values, 4);
31263 des_int_ptr(n_terminal, terminal, 5);
31264 xmlResetLastError();
31265 if (mem_base != xmlMemBlocks()) {
31266 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31267 xmlMemBlocks() - mem_base);
31268 test_ret++;
31269 printf(" %d", n_exec);
31270 printf(" %d", n_string);
31271 printf(" %d", n_nbval);
31272 printf(" %d", n_nbneg);
31273 printf(" %d", n_values);
31274 printf(" %d", n_terminal);
31275 printf("\n");
31276 }
31277 }
31278 }
31279 }
31280 }
31281 }
31282 }
31283 function_tests++;
31284#endif
31285
31286 return(test_ret);
31287}
31288
31289
31290static int
31291test_xmlRegExecNextValues(void) {
31292 int test_ret = 0;
31293
31294#if defined(LIBXML_REGEXP_ENABLED)
31295 int mem_base;
31296 int ret_val;
31297 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31298 int n_exec;
31299 int * nbval; /* pointer to the number of accepted values IN/OUT */
31300 int n_nbval;
31301 int * nbneg; /* return number of negative transitions */
31302 int n_nbneg;
31303 xmlChar ** values; /* pointer to the array of acceptable values */
31304 int n_values;
31305 int * terminal; /* return value if this was a terminal state */
31306 int n_terminal;
31307
31308 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31309 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31310 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31311 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31312 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31313 mem_base = xmlMemBlocks();
31314 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31315 nbval = gen_int_ptr(n_nbval, 1);
31316 nbneg = gen_int_ptr(n_nbneg, 2);
31317 values = gen_xmlChar_ptr_ptr(n_values, 3);
31318 terminal = gen_int_ptr(n_terminal, 4);
31319
31320 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31321 desret_int(ret_val);
31322 call_tests++;
31323 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31324 des_int_ptr(n_nbval, nbval, 1);
31325 des_int_ptr(n_nbneg, nbneg, 2);
31326 des_xmlChar_ptr_ptr(n_values, values, 3);
31327 des_int_ptr(n_terminal, terminal, 4);
31328 xmlResetLastError();
31329 if (mem_base != xmlMemBlocks()) {
31330 printf("Leak of %d blocks found in xmlRegExecNextValues",
31331 xmlMemBlocks() - mem_base);
31332 test_ret++;
31333 printf(" %d", n_exec);
31334 printf(" %d", n_nbval);
31335 printf(" %d", n_nbneg);
31336 printf(" %d", n_values);
31337 printf(" %d", n_terminal);
31338 printf("\n");
31339 }
31340 }
31341 }
31342 }
31343 }
31344 }
31345 function_tests++;
31346#endif
31347
31348 return(test_ret);
31349}
31350
31351
31352static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031353test_xmlRegExecPushString(void) {
31354 int test_ret = 0;
31355
William M. Brack21e4ef22005-01-02 09:53:13 +000031356#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031357 int mem_base;
31358 int ret_val;
31359 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31360 int n_exec;
31361 xmlChar * value; /* a string token input */
31362 int n_value;
31363 void * data; /* data associated to the token to reuse in callbacks */
31364 int n_data;
31365
31366 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31367 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31368 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31369 mem_base = xmlMemBlocks();
31370 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31371 value = gen_const_xmlChar_ptr(n_value, 1);
31372 data = gen_userdata(n_data, 2);
31373
William M. Brackf13f77f2004-11-12 16:03:48 +000031374 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031375 desret_int(ret_val);
31376 call_tests++;
31377 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031378 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031379 des_userdata(n_data, data, 2);
31380 xmlResetLastError();
31381 if (mem_base != xmlMemBlocks()) {
31382 printf("Leak of %d blocks found in xmlRegExecPushString",
31383 xmlMemBlocks() - mem_base);
31384 test_ret++;
31385 printf(" %d", n_exec);
31386 printf(" %d", n_value);
31387 printf(" %d", n_data);
31388 printf("\n");
31389 }
31390 }
31391 }
31392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031393 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031394#endif
31395
Daniel Veillarda82b1822004-11-08 16:24:57 +000031396 return(test_ret);
31397}
31398
31399
31400static int
31401test_xmlRegExecPushString2(void) {
31402 int test_ret = 0;
31403
William M. Brack21e4ef22005-01-02 09:53:13 +000031404#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031405 int mem_base;
31406 int ret_val;
31407 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31408 int n_exec;
31409 xmlChar * value; /* the first string token input */
31410 int n_value;
31411 xmlChar * value2; /* the second string token input */
31412 int n_value2;
31413 void * data; /* data associated to the token to reuse in callbacks */
31414 int n_data;
31415
31416 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31417 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31418 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31419 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31420 mem_base = xmlMemBlocks();
31421 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31422 value = gen_const_xmlChar_ptr(n_value, 1);
31423 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31424 data = gen_userdata(n_data, 3);
31425
William M. Brackf13f77f2004-11-12 16:03:48 +000031426 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031427 desret_int(ret_val);
31428 call_tests++;
31429 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031430 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31431 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031432 des_userdata(n_data, data, 3);
31433 xmlResetLastError();
31434 if (mem_base != xmlMemBlocks()) {
31435 printf("Leak of %d blocks found in xmlRegExecPushString2",
31436 xmlMemBlocks() - mem_base);
31437 test_ret++;
31438 printf(" %d", n_exec);
31439 printf(" %d", n_value);
31440 printf(" %d", n_value2);
31441 printf(" %d", n_data);
31442 printf("\n");
31443 }
31444 }
31445 }
31446 }
31447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031448 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031449#endif
31450
Daniel Veillarda82b1822004-11-08 16:24:57 +000031451 return(test_ret);
31452}
31453
Daniel Veillarda521d282004-11-09 14:59:59 +000031454#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031455
31456#define gen_nb_xmlRegexpPtr 1
31457static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31458 return(NULL);
31459}
31460static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31461}
Daniel Veillarda521d282004-11-09 14:59:59 +000031462#endif
31463
Daniel Veillarda82b1822004-11-08 16:24:57 +000031464
31465static int
31466test_xmlRegNewExecCtxt(void) {
31467 int test_ret = 0;
31468
31469
31470 /* missing type support */
31471 return(test_ret);
31472}
31473
31474
31475static int
31476test_xmlRegexpCompile(void) {
31477 int test_ret = 0;
31478
31479
31480 /* missing type support */
31481 return(test_ret);
31482}
31483
31484
31485static int
31486test_xmlRegexpExec(void) {
31487 int test_ret = 0;
31488
William M. Brack21e4ef22005-01-02 09:53:13 +000031489#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031490 int mem_base;
31491 int ret_val;
31492 xmlRegexpPtr comp; /* the compiled regular expression */
31493 int n_comp;
31494 xmlChar * content; /* the value to check against the regular expression */
31495 int n_content;
31496
31497 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31498 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31499 mem_base = xmlMemBlocks();
31500 comp = gen_xmlRegexpPtr(n_comp, 0);
31501 content = gen_const_xmlChar_ptr(n_content, 1);
31502
William M. Brackf13f77f2004-11-12 16:03:48 +000031503 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031504 desret_int(ret_val);
31505 call_tests++;
31506 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031507 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031508 xmlResetLastError();
31509 if (mem_base != xmlMemBlocks()) {
31510 printf("Leak of %d blocks found in xmlRegexpExec",
31511 xmlMemBlocks() - mem_base);
31512 test_ret++;
31513 printf(" %d", n_comp);
31514 printf(" %d", n_content);
31515 printf("\n");
31516 }
31517 }
31518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031519 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031520#endif
31521
Daniel Veillarda82b1822004-11-08 16:24:57 +000031522 return(test_ret);
31523}
31524
31525
31526static int
31527test_xmlRegexpIsDeterminist(void) {
31528 int test_ret = 0;
31529
William M. Brack21e4ef22005-01-02 09:53:13 +000031530#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031531 int mem_base;
31532 int ret_val;
31533 xmlRegexpPtr comp; /* the compiled regular expression */
31534 int n_comp;
31535
31536 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31537 mem_base = xmlMemBlocks();
31538 comp = gen_xmlRegexpPtr(n_comp, 0);
31539
31540 ret_val = xmlRegexpIsDeterminist(comp);
31541 desret_int(ret_val);
31542 call_tests++;
31543 des_xmlRegexpPtr(n_comp, comp, 0);
31544 xmlResetLastError();
31545 if (mem_base != xmlMemBlocks()) {
31546 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31547 xmlMemBlocks() - mem_base);
31548 test_ret++;
31549 printf(" %d", n_comp);
31550 printf("\n");
31551 }
31552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031553 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031554#endif
31555
Daniel Veillarda82b1822004-11-08 16:24:57 +000031556 return(test_ret);
31557}
31558
31559
31560static int
31561test_xmlRegexpPrint(void) {
31562 int test_ret = 0;
31563
William M. Brack21e4ef22005-01-02 09:53:13 +000031564#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031565 int mem_base;
31566 FILE * output; /* the file for the output debug */
31567 int n_output;
31568 xmlRegexpPtr regexp; /* the compiled regexp */
31569 int n_regexp;
31570
31571 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31572 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31573 mem_base = xmlMemBlocks();
31574 output = gen_FILE_ptr(n_output, 0);
31575 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31576
31577 xmlRegexpPrint(output, regexp);
31578 call_tests++;
31579 des_FILE_ptr(n_output, output, 0);
31580 des_xmlRegexpPtr(n_regexp, regexp, 1);
31581 xmlResetLastError();
31582 if (mem_base != xmlMemBlocks()) {
31583 printf("Leak of %d blocks found in xmlRegexpPrint",
31584 xmlMemBlocks() - mem_base);
31585 test_ret++;
31586 printf(" %d", n_output);
31587 printf(" %d", n_regexp);
31588 printf("\n");
31589 }
31590 }
31591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031592 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031593#endif
31594
Daniel Veillarda82b1822004-11-08 16:24:57 +000031595 return(test_ret);
31596}
31597
31598static int
31599test_xmlregexp(void) {
31600 int test_ret = 0;
31601
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031602 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31603 test_ret += test_xmlRegExecErrInfo();
31604 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031605 test_ret += test_xmlRegExecPushString();
31606 test_ret += test_xmlRegExecPushString2();
31607 test_ret += test_xmlRegNewExecCtxt();
31608 test_ret += test_xmlRegexpCompile();
31609 test_ret += test_xmlRegexpExec();
31610 test_ret += test_xmlRegexpIsDeterminist();
31611 test_ret += test_xmlRegexpPrint();
31612
31613 if (test_ret != 0)
31614 printf("Module xmlregexp: %d errors\n", test_ret);
31615 return(test_ret);
31616}
Daniel Veillarda521d282004-11-09 14:59:59 +000031617#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031618
Daniel Veillardce682bc2004-11-05 17:22:25 +000031619#define gen_nb_xmlSaveCtxtPtr 1
31620static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31621 return(NULL);
31622}
31623static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31624}
Daniel Veillarda521d282004-11-09 14:59:59 +000031625#endif
31626
Daniel Veillardce682bc2004-11-05 17:22:25 +000031627
Daniel Veillardd93f6252004-11-02 15:53:51 +000031628static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031629test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031631
William M. Brack21e4ef22005-01-02 09:53:13 +000031632#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031633 int mem_base;
31634 int ret_val;
31635 xmlSaveCtxtPtr ctxt; /* a document saving context */
31636 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031637
Daniel Veillardce682bc2004-11-05 17:22:25 +000031638 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31639 mem_base = xmlMemBlocks();
31640 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31641
31642 ret_val = xmlSaveClose(ctxt);
31643 desret_int(ret_val);
31644 call_tests++;
31645 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31646 xmlResetLastError();
31647 if (mem_base != xmlMemBlocks()) {
31648 printf("Leak of %d blocks found in xmlSaveClose",
31649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031650 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031651 printf(" %d", n_ctxt);
31652 printf("\n");
31653 }
31654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031655 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031656#endif
31657
Daniel Veillard42595322004-11-08 10:52:06 +000031658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031659}
31660
31661
31662static int
31663test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031665
William M. Brack21e4ef22005-01-02 09:53:13 +000031666#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031667 int mem_base;
31668 long ret_val;
31669 xmlSaveCtxtPtr ctxt; /* a document saving context */
31670 int n_ctxt;
31671 xmlDocPtr doc; /* a document */
31672 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031673
Daniel Veillardce682bc2004-11-05 17:22:25 +000031674 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31675 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31676 mem_base = xmlMemBlocks();
31677 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31678 doc = gen_xmlDocPtr(n_doc, 1);
31679
31680 ret_val = xmlSaveDoc(ctxt, doc);
31681 desret_long(ret_val);
31682 call_tests++;
31683 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31684 des_xmlDocPtr(n_doc, doc, 1);
31685 xmlResetLastError();
31686 if (mem_base != xmlMemBlocks()) {
31687 printf("Leak of %d blocks found in xmlSaveDoc",
31688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031690 printf(" %d", n_ctxt);
31691 printf(" %d", n_doc);
31692 printf("\n");
31693 }
31694 }
31695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031696 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031697#endif
31698
Daniel Veillard42595322004-11-08 10:52:06 +000031699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031700}
31701
31702
31703static int
31704test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031706
William M. Brack21e4ef22005-01-02 09:53:13 +000031707#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031708 int mem_base;
31709 int ret_val;
31710 xmlSaveCtxtPtr ctxt; /* a document saving context */
31711 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031712
Daniel Veillardce682bc2004-11-05 17:22:25 +000031713 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31714 mem_base = xmlMemBlocks();
31715 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31716
31717 ret_val = xmlSaveFlush(ctxt);
31718 desret_int(ret_val);
31719 call_tests++;
31720 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31721 xmlResetLastError();
31722 if (mem_base != xmlMemBlocks()) {
31723 printf("Leak of %d blocks found in xmlSaveFlush",
31724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031725 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031726 printf(" %d", n_ctxt);
31727 printf("\n");
31728 }
31729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031730 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031731#endif
31732
Daniel Veillard42595322004-11-08 10:52:06 +000031733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031734}
31735
31736
31737static int
31738test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031740
31741
31742 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031744}
31745
31746
31747static int
31748test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031750
31751
31752 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031754}
31755
31756
31757static int
31758test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031760
31761
31762 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031764}
31765
31766
31767static int
31768test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031770
31771
31772 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031774}
31775
31776
31777static int
31778test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031780
William M. Brack21e4ef22005-01-02 09:53:13 +000031781#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031782 int mem_base;
31783 long ret_val;
31784 xmlSaveCtxtPtr ctxt; /* a document saving context */
31785 int n_ctxt;
31786 xmlNodePtr node; /* a document */
31787 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031788
Daniel Veillardce682bc2004-11-05 17:22:25 +000031789 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31790 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31791 mem_base = xmlMemBlocks();
31792 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31793 node = gen_xmlNodePtr(n_node, 1);
31794
31795 ret_val = xmlSaveTree(ctxt, node);
31796 desret_long(ret_val);
31797 call_tests++;
31798 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31799 des_xmlNodePtr(n_node, node, 1);
31800 xmlResetLastError();
31801 if (mem_base != xmlMemBlocks()) {
31802 printf("Leak of %d blocks found in xmlSaveTree",
31803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031804 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031805 printf(" %d", n_ctxt);
31806 printf(" %d", n_node);
31807 printf("\n");
31808 }
31809 }
31810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031811 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031812#endif
31813
Daniel Veillard42595322004-11-08 10:52:06 +000031814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031815}
31816
31817static int
31818test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031820
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031821 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031822 test_ret += test_xmlSaveClose();
31823 test_ret += test_xmlSaveDoc();
31824 test_ret += test_xmlSaveFlush();
31825 test_ret += test_xmlSaveSetAttrEscape();
31826 test_ret += test_xmlSaveSetEscape();
31827 test_ret += test_xmlSaveToFd();
31828 test_ret += test_xmlSaveToFilename();
31829 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031830
Daniel Veillard42595322004-11-08 10:52:06 +000031831 if (test_ret != 0)
31832 printf("Module xmlsave: %d errors\n", test_ret);
31833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031834}
Daniel Veillarda521d282004-11-09 14:59:59 +000031835#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031836
Daniel Veillardce682bc2004-11-05 17:22:25 +000031837#define gen_nb_xmlSchemaPtr 1
31838static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31839 return(NULL);
31840}
31841static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31842}
Daniel Veillarda521d282004-11-09 14:59:59 +000031843#endif
31844
Daniel Veillardce682bc2004-11-05 17:22:25 +000031845
Daniel Veillardd93f6252004-11-02 15:53:51 +000031846static int
31847test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031849
William M. Brack21e4ef22005-01-02 09:53:13 +000031850#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031851 int mem_base;
31852 FILE * output; /* the file output */
31853 int n_output;
31854 xmlSchemaPtr schema; /* a schema structure */
31855 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031856
Daniel Veillardce682bc2004-11-05 17:22:25 +000031857 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31858 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31859 mem_base = xmlMemBlocks();
31860 output = gen_FILE_ptr(n_output, 0);
31861 schema = gen_xmlSchemaPtr(n_schema, 1);
31862
31863 xmlSchemaDump(output, schema);
31864 call_tests++;
31865 des_FILE_ptr(n_output, output, 0);
31866 des_xmlSchemaPtr(n_schema, schema, 1);
31867 xmlResetLastError();
31868 if (mem_base != xmlMemBlocks()) {
31869 printf("Leak of %d blocks found in xmlSchemaDump",
31870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031871 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031872 printf(" %d", n_output);
31873 printf(" %d", n_schema);
31874 printf("\n");
31875 }
31876 }
31877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031878 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031879#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031880
Daniel Veillard42595322004-11-08 10:52:06 +000031881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031882}
31883
Daniel Veillarda521d282004-11-09 14:59:59 +000031884#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031885
Daniel Veillardce682bc2004-11-05 17:22:25 +000031886#define gen_nb_xmlSchemaParserCtxtPtr 1
31887static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31888 return(NULL);
31889}
31890static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31891}
Daniel Veillarda521d282004-11-09 14:59:59 +000031892#endif
31893
31894#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031895
31896#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31897static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31898 return(NULL);
31899}
31900static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31901}
Daniel Veillarda521d282004-11-09 14:59:59 +000031902#endif
31903
31904#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031905
31906#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31907static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31908 return(NULL);
31909}
31910static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31911}
Daniel Veillarda521d282004-11-09 14:59:59 +000031912#endif
31913
Daniel Veillardce682bc2004-11-05 17:22:25 +000031914
Daniel Veillardd93f6252004-11-02 15:53:51 +000031915static int
31916test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031918
William M. Brack21e4ef22005-01-02 09:53:13 +000031919#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031920 int mem_base;
31921 int ret_val;
31922 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31923 int n_ctxt;
31924 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31925 int n_err;
31926 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31927 int n_warn;
31928 void ** ctx; /* contextual data for the callbacks result */
31929 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031930
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031931 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31932 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31933 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31934 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31935 mem_base = xmlMemBlocks();
31936 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31937 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31938 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31939 ctx = gen_void_ptr_ptr(n_ctx, 3);
31940
31941 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31942 desret_int(ret_val);
31943 call_tests++;
31944 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31945 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31946 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31947 des_void_ptr_ptr(n_ctx, ctx, 3);
31948 xmlResetLastError();
31949 if (mem_base != xmlMemBlocks()) {
31950 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031952 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031953 printf(" %d", n_ctxt);
31954 printf(" %d", n_err);
31955 printf(" %d", n_warn);
31956 printf(" %d", n_ctx);
31957 printf("\n");
31958 }
31959 }
31960 }
31961 }
31962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031964#endif
31965
Daniel Veillard42595322004-11-08 10:52:06 +000031966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031967}
31968
Daniel Veillarda521d282004-11-09 14:59:59 +000031969#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031970
Daniel Veillardce682bc2004-11-05 17:22:25 +000031971#define gen_nb_xmlSchemaValidCtxtPtr 1
31972static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31973 return(NULL);
31974}
31975static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31976}
Daniel Veillarda521d282004-11-09 14:59:59 +000031977#endif
31978
Daniel Veillardce682bc2004-11-05 17:22:25 +000031979
Daniel Veillardd93f6252004-11-02 15:53:51 +000031980static int
31981test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031983
William M. Brack21e4ef22005-01-02 09:53:13 +000031984#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031985 int mem_base;
31986 int ret_val;
31987 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31988 int n_ctxt;
31989 xmlSchemaValidityErrorFunc * err; /* the error function result */
31990 int n_err;
31991 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31992 int n_warn;
31993 void ** ctx; /* the functions context result */
31994 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031995
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031996 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31997 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31998 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31999 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32000 mem_base = xmlMemBlocks();
32001 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32002 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32003 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32004 ctx = gen_void_ptr_ptr(n_ctx, 3);
32005
32006 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32007 desret_int(ret_val);
32008 call_tests++;
32009 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32010 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32011 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32012 des_void_ptr_ptr(n_ctx, ctx, 3);
32013 xmlResetLastError();
32014 if (mem_base != xmlMemBlocks()) {
32015 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032017 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032018 printf(" %d", n_ctxt);
32019 printf(" %d", n_err);
32020 printf(" %d", n_warn);
32021 printf(" %d", n_ctx);
32022 printf("\n");
32023 }
32024 }
32025 }
32026 }
32027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032028 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032029#endif
32030
Daniel Veillard42595322004-11-08 10:52:06 +000032031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032032}
32033
32034
32035static int
32036test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032038
William M. Brack21e4ef22005-01-02 09:53:13 +000032039#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032040 int mem_base;
32041 xmlSchemaParserCtxtPtr ret_val;
32042 xmlDocPtr doc; /* a preparsed document tree */
32043 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032044
Daniel Veillard42595322004-11-08 10:52:06 +000032045 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32046 mem_base = xmlMemBlocks();
32047 doc = gen_xmlDocPtr(n_doc, 0);
32048
32049 ret_val = xmlSchemaNewDocParserCtxt(doc);
32050 desret_xmlSchemaParserCtxtPtr(ret_val);
32051 call_tests++;
32052 des_xmlDocPtr(n_doc, doc, 0);
32053 xmlResetLastError();
32054 if (mem_base != xmlMemBlocks()) {
32055 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32056 xmlMemBlocks() - mem_base);
32057 test_ret++;
32058 printf(" %d", n_doc);
32059 printf("\n");
32060 }
32061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032062 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032063#endif
32064
Daniel Veillard42595322004-11-08 10:52:06 +000032065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032066}
32067
32068
32069static int
32070test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032072
William M. Brack21e4ef22005-01-02 09:53:13 +000032073#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032074 int mem_base;
32075 xmlSchemaParserCtxtPtr ret_val;
32076 char * buffer; /* a pointer to a char array containing the schemas */
32077 int n_buffer;
32078 int size; /* the size of the array */
32079 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032080
Daniel Veillard42595322004-11-08 10:52:06 +000032081 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32082 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32083 mem_base = xmlMemBlocks();
32084 buffer = gen_const_char_ptr(n_buffer, 0);
32085 size = gen_int(n_size, 1);
32086
William M. Brackf13f77f2004-11-12 16:03:48 +000032087 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032088 desret_xmlSchemaParserCtxtPtr(ret_val);
32089 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032090 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032091 des_int(n_size, size, 1);
32092 xmlResetLastError();
32093 if (mem_base != xmlMemBlocks()) {
32094 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32095 xmlMemBlocks() - mem_base);
32096 test_ret++;
32097 printf(" %d", n_buffer);
32098 printf(" %d", n_size);
32099 printf("\n");
32100 }
32101 }
32102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032104#endif
32105
Daniel Veillard42595322004-11-08 10:52:06 +000032106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032107}
32108
32109
32110static int
32111test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032113
William M. Brack21e4ef22005-01-02 09:53:13 +000032114#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032115 int mem_base;
32116 xmlSchemaParserCtxtPtr ret_val;
32117 char * URL; /* the location of the schema */
32118 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032119
Daniel Veillard42595322004-11-08 10:52:06 +000032120 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32121 mem_base = xmlMemBlocks();
32122 URL = gen_const_char_ptr(n_URL, 0);
32123
William M. Brackf13f77f2004-11-12 16:03:48 +000032124 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032125 desret_xmlSchemaParserCtxtPtr(ret_val);
32126 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032127 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032128 xmlResetLastError();
32129 if (mem_base != xmlMemBlocks()) {
32130 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32131 xmlMemBlocks() - mem_base);
32132 test_ret++;
32133 printf(" %d", n_URL);
32134 printf("\n");
32135 }
32136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032138#endif
32139
Daniel Veillard42595322004-11-08 10:52:06 +000032140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032141}
32142
32143
32144static int
32145test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032147
32148
32149 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032151}
32152
32153
32154static int
32155test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032157
32158
32159 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032161}
32162
32163
32164static int
32165test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032167
32168
32169 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032171}
32172
32173
32174static int
32175test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032177
32178
32179 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032181}
32182
32183
32184static int
32185test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032187
William M. Brack21e4ef22005-01-02 09:53:13 +000032188#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032189 int mem_base;
32190 int ret_val;
32191 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32192 int n_ctxt;
32193 int options; /* a combination of xmlSchemaValidOption */
32194 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032195
Daniel Veillardce682bc2004-11-05 17:22:25 +000032196 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32197 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32198 mem_base = xmlMemBlocks();
32199 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32200 options = gen_int(n_options, 1);
32201
32202 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32203 desret_int(ret_val);
32204 call_tests++;
32205 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32206 des_int(n_options, options, 1);
32207 xmlResetLastError();
32208 if (mem_base != xmlMemBlocks()) {
32209 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032211 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032212 printf(" %d", n_ctxt);
32213 printf(" %d", n_options);
32214 printf("\n");
32215 }
32216 }
32217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032218 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032219#endif
32220
Daniel Veillard42595322004-11-08 10:52:06 +000032221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032222}
32223
32224
32225static int
32226test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032228
William M. Brack21e4ef22005-01-02 09:53:13 +000032229#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032230 int mem_base;
32231 int ret_val;
32232 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32233 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032234
Daniel Veillardce682bc2004-11-05 17:22:25 +000032235 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32236 mem_base = xmlMemBlocks();
32237 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32238
32239 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32240 desret_int(ret_val);
32241 call_tests++;
32242 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32243 xmlResetLastError();
32244 if (mem_base != xmlMemBlocks()) {
32245 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032247 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032248 printf(" %d", n_ctxt);
32249 printf("\n");
32250 }
32251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032252 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032253#endif
32254
Daniel Veillard42595322004-11-08 10:52:06 +000032255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032256}
32257
32258
32259static int
32260test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032262
William M. Brack21e4ef22005-01-02 09:53:13 +000032263#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032264 int mem_base;
32265 int ret_val;
32266 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32267 int n_ctxt;
32268 xmlDocPtr doc; /* a parsed document tree */
32269 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032270
Daniel Veillardce682bc2004-11-05 17:22:25 +000032271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32273 mem_base = xmlMemBlocks();
32274 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32275 doc = gen_xmlDocPtr(n_doc, 1);
32276
32277 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32278 desret_int(ret_val);
32279 call_tests++;
32280 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32281 des_xmlDocPtr(n_doc, doc, 1);
32282 xmlResetLastError();
32283 if (mem_base != xmlMemBlocks()) {
32284 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032286 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032287 printf(" %d", n_ctxt);
32288 printf(" %d", n_doc);
32289 printf("\n");
32290 }
32291 }
32292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032293 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032294#endif
32295
Daniel Veillard42595322004-11-08 10:52:06 +000032296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032297}
32298
32299
32300static int
32301test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032303
William M. Brack21e4ef22005-01-02 09:53:13 +000032304#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032305 int mem_base;
32306 int ret_val;
32307 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32308 int n_ctxt;
32309 xmlNodePtr elem; /* an element node */
32310 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032311
Daniel Veillardce682bc2004-11-05 17:22:25 +000032312 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32313 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32314 mem_base = xmlMemBlocks();
32315 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32316 elem = gen_xmlNodePtr(n_elem, 1);
32317
32318 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32319 desret_int(ret_val);
32320 call_tests++;
32321 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32322 des_xmlNodePtr(n_elem, elem, 1);
32323 xmlResetLastError();
32324 if (mem_base != xmlMemBlocks()) {
32325 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032327 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032328 printf(" %d", n_ctxt);
32329 printf(" %d", n_elem);
32330 printf("\n");
32331 }
32332 }
32333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032334 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032335#endif
32336
Daniel Veillard42595322004-11-08 10:52:06 +000032337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032338}
32339
32340
32341static int
32342test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032344
William M. Brack21e4ef22005-01-02 09:53:13 +000032345#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032346 int mem_base;
32347 int ret_val;
32348 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32349 int n_ctxt;
32350 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32351 int n_input;
32352 xmlCharEncoding enc; /* an optional encoding information */
32353 int n_enc;
32354 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32355 int n_sax;
32356 void * user_data; /* the context to provide to the SAX handler. */
32357 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032358
Daniel Veillardce682bc2004-11-05 17:22:25 +000032359 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32360 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32361 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32362 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32363 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32364 mem_base = xmlMemBlocks();
32365 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32366 input = gen_xmlParserInputBufferPtr(n_input, 1);
32367 enc = gen_xmlCharEncoding(n_enc, 2);
32368 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32369 user_data = gen_userdata(n_user_data, 4);
32370
32371 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32372 desret_int(ret_val);
32373 call_tests++;
32374 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32375 des_xmlParserInputBufferPtr(n_input, input, 1);
32376 des_xmlCharEncoding(n_enc, enc, 2);
32377 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32378 des_userdata(n_user_data, user_data, 4);
32379 xmlResetLastError();
32380 if (mem_base != xmlMemBlocks()) {
32381 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032383 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032384 printf(" %d", n_ctxt);
32385 printf(" %d", n_input);
32386 printf(" %d", n_enc);
32387 printf(" %d", n_sax);
32388 printf(" %d", n_user_data);
32389 printf("\n");
32390 }
32391 }
32392 }
32393 }
32394 }
32395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032396 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032397#endif
32398
Daniel Veillard42595322004-11-08 10:52:06 +000032399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032400}
32401
32402static int
32403test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032405
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032406 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032407 test_ret += test_xmlSchemaDump();
32408 test_ret += test_xmlSchemaGetParserErrors();
32409 test_ret += test_xmlSchemaGetValidErrors();
32410 test_ret += test_xmlSchemaNewDocParserCtxt();
32411 test_ret += test_xmlSchemaNewMemParserCtxt();
32412 test_ret += test_xmlSchemaNewParserCtxt();
32413 test_ret += test_xmlSchemaNewValidCtxt();
32414 test_ret += test_xmlSchemaParse();
32415 test_ret += test_xmlSchemaSetParserErrors();
32416 test_ret += test_xmlSchemaSetValidErrors();
32417 test_ret += test_xmlSchemaSetValidOptions();
32418 test_ret += test_xmlSchemaValidCtxtGetOptions();
32419 test_ret += test_xmlSchemaValidateDoc();
32420 test_ret += test_xmlSchemaValidateOneElement();
32421 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032422
Daniel Veillard42595322004-11-08 10:52:06 +000032423 if (test_ret != 0)
32424 printf("Module xmlschemas: %d errors\n", test_ret);
32425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032426}
Daniel Veillarda521d282004-11-09 14:59:59 +000032427#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032428
Daniel Veillardce682bc2004-11-05 17:22:25 +000032429#define gen_nb_xmlSchemaFacetPtr 1
32430static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32431 return(NULL);
32432}
32433static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32434}
Daniel Veillarda521d282004-11-09 14:59:59 +000032435#endif
32436
32437#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032438
32439#define gen_nb_xmlSchemaTypePtr 1
32440static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32441 return(NULL);
32442}
32443static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32444}
Daniel Veillarda521d282004-11-09 14:59:59 +000032445#endif
32446
Daniel Veillardce682bc2004-11-05 17:22:25 +000032447
Daniel Veillardd93f6252004-11-02 15:53:51 +000032448static int
32449test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032451
William M. Brack21e4ef22005-01-02 09:53:13 +000032452#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032453 int mem_base;
32454 int ret_val;
32455 xmlSchemaFacetPtr facet; /* the facet */
32456 int n_facet;
32457 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32458 int n_typeDecl;
32459 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32460 int n_ctxt;
32461 xmlChar * name; /* name of the type */
32462 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032463
Daniel Veillardce682bc2004-11-05 17:22:25 +000032464 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32465 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32467 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32468 mem_base = xmlMemBlocks();
32469 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32470 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32471 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32472 name = gen_const_xmlChar_ptr(n_name, 3);
32473
William M. Brackf13f77f2004-11-12 16:03:48 +000032474 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032475 desret_int(ret_val);
32476 call_tests++;
32477 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32478 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32479 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032480 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032481 xmlResetLastError();
32482 if (mem_base != xmlMemBlocks()) {
32483 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032485 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032486 printf(" %d", n_facet);
32487 printf(" %d", n_typeDecl);
32488 printf(" %d", n_ctxt);
32489 printf(" %d", n_name);
32490 printf("\n");
32491 }
32492 }
32493 }
32494 }
32495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032496 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032497#endif
32498
Daniel Veillard42595322004-11-08 10:52:06 +000032499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032500}
32501
32502
32503static int
32504test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032506
William M. Brack21e4ef22005-01-02 09:53:13 +000032507#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032508 int mem_base;
32509
32510 mem_base = xmlMemBlocks();
32511
32512 xmlSchemaCleanupTypes();
32513 call_tests++;
32514 xmlResetLastError();
32515 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032516 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032518 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032519 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032521 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032522#endif
32523
Daniel Veillard42595322004-11-08 10:52:06 +000032524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032525}
32526
32527
32528static int
32529test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032531
William M. Brack21e4ef22005-01-02 09:53:13 +000032532#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032533 int mem_base;
32534 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032535 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032536 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032537
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032538 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032540 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032541
William M. Brackf13f77f2004-11-12 16:03:48 +000032542 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032543 desret_xmlChar_ptr(ret_val);
32544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032545 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032546 xmlResetLastError();
32547 if (mem_base != xmlMemBlocks()) {
32548 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032550 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032551 printf(" %d", n_value);
32552 printf("\n");
32553 }
32554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032555 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032556#endif
32557
Daniel Veillard42595322004-11-08 10:52:06 +000032558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032559}
32560
Daniel Veillarda521d282004-11-09 14:59:59 +000032561#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032562
Daniel Veillardce682bc2004-11-05 17:22:25 +000032563#define gen_nb_xmlSchemaValPtr 1
32564static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32565 return(NULL);
32566}
32567static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32568}
Daniel Veillarda521d282004-11-09 14:59:59 +000032569#endif
32570
Daniel Veillardce682bc2004-11-05 17:22:25 +000032571
Daniel Veillardd93f6252004-11-02 15:53:51 +000032572static int
32573test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032575
William M. Brack21e4ef22005-01-02 09:53:13 +000032576#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032577 int mem_base;
32578 int ret_val;
32579 xmlSchemaValPtr x; /* a first value */
32580 int n_x;
32581 xmlSchemaValPtr y; /* a second value */
32582 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032583
Daniel Veillardce682bc2004-11-05 17:22:25 +000032584 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32585 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32586 mem_base = xmlMemBlocks();
32587 x = gen_xmlSchemaValPtr(n_x, 0);
32588 y = gen_xmlSchemaValPtr(n_y, 1);
32589
32590 ret_val = xmlSchemaCompareValues(x, y);
32591 desret_int(ret_val);
32592 call_tests++;
32593 des_xmlSchemaValPtr(n_x, x, 0);
32594 des_xmlSchemaValPtr(n_y, y, 1);
32595 xmlResetLastError();
32596 if (mem_base != xmlMemBlocks()) {
32597 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032599 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032600 printf(" %d", n_x);
32601 printf(" %d", n_y);
32602 printf("\n");
32603 }
32604 }
32605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032607#endif
32608
Daniel Veillard42595322004-11-08 10:52:06 +000032609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032610}
32611
32612
32613static int
32614test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032616
William M. Brack21e4ef22005-01-02 09:53:13 +000032617#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032618 int mem_base;
32619 xmlSchemaTypePtr ret_val;
32620 xmlSchemaTypePtr type; /* the built-in simple type. */
32621 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032622
Daniel Veillard42595322004-11-08 10:52:06 +000032623 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32624 mem_base = xmlMemBlocks();
32625 type = gen_xmlSchemaTypePtr(n_type, 0);
32626
32627 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32628 desret_xmlSchemaTypePtr(ret_val);
32629 call_tests++;
32630 des_xmlSchemaTypePtr(n_type, type, 0);
32631 xmlResetLastError();
32632 if (mem_base != xmlMemBlocks()) {
32633 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32634 xmlMemBlocks() - mem_base);
32635 test_ret++;
32636 printf(" %d", n_type);
32637 printf("\n");
32638 }
32639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032640 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032641#endif
32642
Daniel Veillard42595322004-11-08 10:52:06 +000032643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032644}
32645
32646
32647static int
32648test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032650
William M. Brack21e4ef22005-01-02 09:53:13 +000032651#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032652 xmlSchemaTypePtr ret_val;
32653 xmlSchemaValType type; /* the type of the built in type */
32654 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655
Daniel Veillard42595322004-11-08 10:52:06 +000032656 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32657 type = gen_xmlSchemaValType(n_type, 0);
32658
32659 ret_val = xmlSchemaGetBuiltInType(type);
32660 desret_xmlSchemaTypePtr(ret_val);
32661 call_tests++;
32662 des_xmlSchemaValType(n_type, type, 0);
32663 xmlResetLastError();
32664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032665 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032666#endif
32667
Daniel Veillard42595322004-11-08 10:52:06 +000032668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032669}
32670
32671
32672static int
32673test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032675
William M. Brack21e4ef22005-01-02 09:53:13 +000032676#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032677 int mem_base;
32678 unsigned long ret_val;
32679 xmlSchemaFacetPtr facet; /* an schemas type facet */
32680 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032681
William M. Brack094dd862004-11-14 14:28:34 +000032682 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32683 mem_base = xmlMemBlocks();
32684 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32685
32686 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32687 desret_unsigned_long(ret_val);
32688 call_tests++;
32689 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32690 xmlResetLastError();
32691 if (mem_base != xmlMemBlocks()) {
32692 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32693 xmlMemBlocks() - mem_base);
32694 test_ret++;
32695 printf(" %d", n_facet);
32696 printf("\n");
32697 }
32698 }
32699 function_tests++;
32700#endif
32701
Daniel Veillard42595322004-11-08 10:52:06 +000032702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032703}
32704
32705
32706static int
32707test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032709
William M. Brack21e4ef22005-01-02 09:53:13 +000032710#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032711 int mem_base;
32712 xmlSchemaTypePtr ret_val;
32713 xmlChar * name; /* the type name */
32714 int n_name;
32715 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32716 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032717
Daniel Veillard42595322004-11-08 10:52:06 +000032718 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32719 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32720 mem_base = xmlMemBlocks();
32721 name = gen_const_xmlChar_ptr(n_name, 0);
32722 ns = gen_const_xmlChar_ptr(n_ns, 1);
32723
William M. Brackf13f77f2004-11-12 16:03:48 +000032724 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032725 desret_xmlSchemaTypePtr(ret_val);
32726 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032727 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32728 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032729 xmlResetLastError();
32730 if (mem_base != xmlMemBlocks()) {
32731 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32732 xmlMemBlocks() - mem_base);
32733 test_ret++;
32734 printf(" %d", n_name);
32735 printf(" %d", n_ns);
32736 printf("\n");
32737 }
32738 }
32739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032740 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032741#endif
32742
Daniel Veillard42595322004-11-08 10:52:06 +000032743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032744}
32745
32746
32747static int
32748test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032750
William M. Brack21e4ef22005-01-02 09:53:13 +000032751#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032752
32753
32754 xmlSchemaInitTypes();
32755 call_tests++;
32756 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032757 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032758#endif
32759
Daniel Veillard42595322004-11-08 10:52:06 +000032760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032761}
32762
32763
32764static int
32765test_xmlSchemaIsBuiltInTypeFacet(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 xmlSchemaTypePtr type; /* the built-in type */
32772 int n_type;
32773 int facetType; /* the facet type */
32774 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032775
Daniel Veillardce682bc2004-11-05 17:22:25 +000032776 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32777 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32778 mem_base = xmlMemBlocks();
32779 type = gen_xmlSchemaTypePtr(n_type, 0);
32780 facetType = gen_int(n_facetType, 1);
32781
32782 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32783 desret_int(ret_val);
32784 call_tests++;
32785 des_xmlSchemaTypePtr(n_type, type, 0);
32786 des_int(n_facetType, facetType, 1);
32787 xmlResetLastError();
32788 if (mem_base != xmlMemBlocks()) {
32789 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
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_type);
32793 printf(" %d", n_facetType);
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_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032808
32809
32810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032812}
32813
Daniel Veillarda521d282004-11-09 14:59:59 +000032814#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032815
Daniel Veillardce682bc2004-11-05 17:22:25 +000032816#define gen_nb_xmlSchemaValPtr_ptr 1
32817static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32818 return(NULL);
32819}
32820static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32821}
Daniel Veillarda521d282004-11-09 14:59:59 +000032822#endif
32823
Daniel Veillardce682bc2004-11-05 17:22:25 +000032824
Daniel Veillardd93f6252004-11-02 15:53:51 +000032825static int
32826test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032828
William M. Brack21e4ef22005-01-02 09:53:13 +000032829#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032830 int mem_base;
32831 int ret_val;
32832 xmlSchemaTypePtr type; /* the predefined type */
32833 int n_type;
32834 xmlChar * value; /* the value to check */
32835 int n_value;
32836 xmlSchemaValPtr * val; /* the return computed value */
32837 int n_val;
32838 xmlNodePtr node; /* the node containing the value */
32839 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032840
Daniel Veillardce682bc2004-11-05 17:22:25 +000032841 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32842 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32843 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32844 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32845 mem_base = xmlMemBlocks();
32846 type = gen_xmlSchemaTypePtr(n_type, 0);
32847 value = gen_const_xmlChar_ptr(n_value, 1);
32848 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32849 node = gen_xmlNodePtr(n_node, 3);
32850
William M. Brackf13f77f2004-11-12 16:03:48 +000032851 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032852 desret_int(ret_val);
32853 call_tests++;
32854 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032855 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032856 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32857 des_xmlNodePtr(n_node, node, 3);
32858 xmlResetLastError();
32859 if (mem_base != xmlMemBlocks()) {
32860 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032862 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032863 printf(" %d", n_type);
32864 printf(" %d", n_value);
32865 printf(" %d", n_val);
32866 printf(" %d", n_node);
32867 printf("\n");
32868 }
32869 }
32870 }
32871 }
32872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032873 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032874#endif
32875
Daniel Veillard42595322004-11-08 10:52:06 +000032876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032877}
32878
32879
32880static int
32881test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032883
William M. Brack21e4ef22005-01-02 09:53:13 +000032884#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032885 int mem_base;
32886 int ret_val;
32887 xmlSchemaTypePtr type; /* the predefined type */
32888 int n_type;
32889 xmlChar * value; /* the value to check */
32890 int n_value;
32891 xmlSchemaValPtr * val; /* the return computed value */
32892 int n_val;
32893 xmlNodePtr node; /* the node containing the value */
32894 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032895
Daniel Veillardce682bc2004-11-05 17:22:25 +000032896 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32897 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32898 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32899 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32900 mem_base = xmlMemBlocks();
32901 type = gen_xmlSchemaTypePtr(n_type, 0);
32902 value = gen_const_xmlChar_ptr(n_value, 1);
32903 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32904 node = gen_xmlNodePtr(n_node, 3);
32905
William M. Brackf13f77f2004-11-12 16:03:48 +000032906 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032907 desret_int(ret_val);
32908 call_tests++;
32909 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032910 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032911 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32912 des_xmlNodePtr(n_node, node, 3);
32913 xmlResetLastError();
32914 if (mem_base != xmlMemBlocks()) {
32915 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032917 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918 printf(" %d", n_type);
32919 printf(" %d", n_value);
32920 printf(" %d", n_val);
32921 printf(" %d", n_node);
32922 printf("\n");
32923 }
32924 }
32925 }
32926 }
32927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032928 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032929#endif
32930
Daniel Veillard42595322004-11-08 10:52:06 +000032931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032932}
32933
32934
32935static int
32936test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032938
William M. Brack21e4ef22005-01-02 09:53:13 +000032939#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032940 int mem_base;
32941 int ret_val;
32942 xmlSchemaTypePtr base; /* the base type */
32943 int n_base;
32944 xmlSchemaFacetPtr facet; /* the facet to check */
32945 int n_facet;
32946 xmlChar * value; /* the lexical repr of the value to validate */
32947 int n_value;
32948 xmlSchemaValPtr val; /* the precomputed value */
32949 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032950
Daniel Veillardce682bc2004-11-05 17:22:25 +000032951 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32952 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32953 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32954 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32955 mem_base = xmlMemBlocks();
32956 base = gen_xmlSchemaTypePtr(n_base, 0);
32957 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32958 value = gen_const_xmlChar_ptr(n_value, 2);
32959 val = gen_xmlSchemaValPtr(n_val, 3);
32960
William M. Brackf13f77f2004-11-12 16:03:48 +000032961 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032962 desret_int(ret_val);
32963 call_tests++;
32964 des_xmlSchemaTypePtr(n_base, base, 0);
32965 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032966 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032967 des_xmlSchemaValPtr(n_val, val, 3);
32968 xmlResetLastError();
32969 if (mem_base != xmlMemBlocks()) {
32970 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032972 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032973 printf(" %d", n_base);
32974 printf(" %d", n_facet);
32975 printf(" %d", n_value);
32976 printf(" %d", n_val);
32977 printf("\n");
32978 }
32979 }
32980 }
32981 }
32982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032983 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032984#endif
32985
Daniel Veillard42595322004-11-08 10:52:06 +000032986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032987}
32988
32989
32990static int
32991test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032993
William M. Brack21e4ef22005-01-02 09:53:13 +000032994#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032995 int mem_base;
32996 int ret_val;
32997 xmlSchemaTypePtr type; /* the built-in type */
32998 int n_type;
32999 xmlSchemaFacetPtr facet; /* the facet to check */
33000 int n_facet;
33001 xmlChar * value; /* the lexical repr. of the value to be validated */
33002 int n_value;
33003 xmlSchemaValPtr val; /* the precomputed value */
33004 int n_val;
33005 unsigned long * length; /* the actual length of the value */
33006 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033007
Daniel Veillardce682bc2004-11-05 17:22:25 +000033008 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33009 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33010 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33011 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33012 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33013 mem_base = xmlMemBlocks();
33014 type = gen_xmlSchemaTypePtr(n_type, 0);
33015 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33016 value = gen_const_xmlChar_ptr(n_value, 2);
33017 val = gen_xmlSchemaValPtr(n_val, 3);
33018 length = gen_unsigned_long_ptr(n_length, 4);
33019
William M. Brackf13f77f2004-11-12 16:03:48 +000033020 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033021 desret_int(ret_val);
33022 call_tests++;
33023 des_xmlSchemaTypePtr(n_type, type, 0);
33024 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033025 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033026 des_xmlSchemaValPtr(n_val, val, 3);
33027 des_unsigned_long_ptr(n_length, length, 4);
33028 xmlResetLastError();
33029 if (mem_base != xmlMemBlocks()) {
33030 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033032 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033033 printf(" %d", n_type);
33034 printf(" %d", n_facet);
33035 printf(" %d", n_value);
33036 printf(" %d", n_val);
33037 printf(" %d", n_length);
33038 printf("\n");
33039 }
33040 }
33041 }
33042 }
33043 }
33044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033045 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033046#endif
33047
Daniel Veillard42595322004-11-08 10:52:06 +000033048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033049}
33050
33051
33052static int
33053test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033055
William M. Brack21e4ef22005-01-02 09:53:13 +000033056#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033057 int mem_base;
33058 int ret_val;
33059 xmlSchemaFacetPtr facet; /* the facet to check */
33060 int n_facet;
33061 xmlChar * value; /* the lexical repr of the value to validate */
33062 int n_value;
33063 unsigned long actualLen; /* the number of list items */
33064 int n_actualLen;
33065 unsigned long * expectedLen; /* the resulting expected number of list items */
33066 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033067
Daniel Veillardce682bc2004-11-05 17:22:25 +000033068 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33069 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33070 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33071 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33072 mem_base = xmlMemBlocks();
33073 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33074 value = gen_const_xmlChar_ptr(n_value, 1);
33075 actualLen = gen_unsigned_long(n_actualLen, 2);
33076 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33077
William M. Brackf13f77f2004-11-12 16:03:48 +000033078 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033079 desret_int(ret_val);
33080 call_tests++;
33081 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033082 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033083 des_unsigned_long(n_actualLen, actualLen, 2);
33084 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33085 xmlResetLastError();
33086 if (mem_base != xmlMemBlocks()) {
33087 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033089 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033090 printf(" %d", n_facet);
33091 printf(" %d", n_value);
33092 printf(" %d", n_actualLen);
33093 printf(" %d", n_expectedLen);
33094 printf("\n");
33095 }
33096 }
33097 }
33098 }
33099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033100 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033101#endif
33102
Daniel Veillard42595322004-11-08 10:52:06 +000033103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033104}
33105
33106
33107static int
33108test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033110
William M. Brack21e4ef22005-01-02 09:53:13 +000033111#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033112 int mem_base;
33113 int ret_val;
33114 xmlSchemaTypePtr type; /* the predefined type */
33115 int n_type;
33116 xmlChar * value; /* the value to check */
33117 int n_value;
33118 xmlSchemaValPtr * val; /* the return computed value */
33119 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033120
Daniel Veillardce682bc2004-11-05 17:22:25 +000033121 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33122 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33123 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33124 mem_base = xmlMemBlocks();
33125 type = gen_xmlSchemaTypePtr(n_type, 0);
33126 value = gen_const_xmlChar_ptr(n_value, 1);
33127 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33128
William M. Brackf13f77f2004-11-12 16:03:48 +000033129 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033130 desret_int(ret_val);
33131 call_tests++;
33132 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033133 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033134 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33135 xmlResetLastError();
33136 if (mem_base != xmlMemBlocks()) {
33137 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033139 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033140 printf(" %d", n_type);
33141 printf(" %d", n_value);
33142 printf(" %d", n_val);
33143 printf("\n");
33144 }
33145 }
33146 }
33147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033148 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033149#endif
33150
Daniel Veillard42595322004-11-08 10:52:06 +000033151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033152}
33153
Daniel Veillard91b955c2004-12-10 10:26:42 +000033154
33155static int
33156test_xmlSchemaWhiteSpaceReplace(void) {
33157 int test_ret = 0;
33158
William M. Brack21e4ef22005-01-02 09:53:13 +000033159#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033160 int mem_base;
33161 xmlChar * ret_val;
33162 xmlChar * value; /* a value */
33163 int n_value;
33164
33165 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33166 mem_base = xmlMemBlocks();
33167 value = gen_const_xmlChar_ptr(n_value, 0);
33168
33169 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33170 desret_xmlChar_ptr(ret_val);
33171 call_tests++;
33172 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33173 xmlResetLastError();
33174 if (mem_base != xmlMemBlocks()) {
33175 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33176 xmlMemBlocks() - mem_base);
33177 test_ret++;
33178 printf(" %d", n_value);
33179 printf("\n");
33180 }
33181 }
33182 function_tests++;
33183#endif
33184
33185 return(test_ret);
33186}
33187
Daniel Veillardd93f6252004-11-02 15:53:51 +000033188static int
33189test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033191
Daniel Veillard91b955c2004-12-10 10:26:42 +000033192 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033193 test_ret += test_xmlSchemaCheckFacet();
33194 test_ret += test_xmlSchemaCleanupTypes();
33195 test_ret += test_xmlSchemaCollapseString();
33196 test_ret += test_xmlSchemaCompareValues();
33197 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33198 test_ret += test_xmlSchemaGetBuiltInType();
33199 test_ret += test_xmlSchemaGetFacetValueAsULong();
33200 test_ret += test_xmlSchemaGetPredefinedType();
33201 test_ret += test_xmlSchemaInitTypes();
33202 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33203 test_ret += test_xmlSchemaNewFacet();
33204 test_ret += test_xmlSchemaValPredefTypeNode();
33205 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33206 test_ret += test_xmlSchemaValidateFacet();
33207 test_ret += test_xmlSchemaValidateLengthFacet();
33208 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33209 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033210 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033211
Daniel Veillard42595322004-11-08 10:52:06 +000033212 if (test_ret != 0)
33213 printf("Module xmlschemastypes: %d errors\n", test_ret);
33214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033215}
33216
33217static int
33218test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033220
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033221 int mem_base;
33222 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033223 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033224 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033225
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033226 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33227 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033228 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033229
William M. Brackf13f77f2004-11-12 16:03:48 +000033230 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033231 desret_xmlChar_ptr(ret_val);
33232 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033233 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033234 xmlResetLastError();
33235 if (mem_base != xmlMemBlocks()) {
33236 printf("Leak of %d blocks found in xmlCharStrdup",
33237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033238 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033239 printf(" %d", n_cur);
33240 printf("\n");
33241 }
33242 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033244
Daniel Veillard42595322004-11-08 10:52:06 +000033245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033246}
33247
33248
33249static int
33250test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033252
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033253 int mem_base;
33254 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033255 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033256 int n_cur;
33257 int len; /* the len of @cur */
33258 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033259
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033260 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33261 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033263 cur = gen_const_char_ptr(n_cur, 0);
33264 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033265
William M. Brackf13f77f2004-11-12 16:03:48 +000033266 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033267 desret_xmlChar_ptr(ret_val);
33268 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033269 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033270 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033271 xmlResetLastError();
33272 if (mem_base != xmlMemBlocks()) {
33273 printf("Leak of %d blocks found in xmlCharStrndup",
33274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033275 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033276 printf(" %d", n_cur);
33277 printf(" %d", n_len);
33278 printf("\n");
33279 }
33280 }
33281 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033283
Daniel Veillard42595322004-11-08 10:52:06 +000033284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033285}
33286
33287
33288static int
33289test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033291
Daniel Veillardce682bc2004-11-05 17:22:25 +000033292 int mem_base;
33293 int ret_val;
33294 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33295 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033296
Daniel Veillardce682bc2004-11-05 17:22:25 +000033297 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33298 mem_base = xmlMemBlocks();
33299 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33300
William M. Brackf13f77f2004-11-12 16:03:48 +000033301 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033302 desret_int(ret_val);
33303 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033304 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033305 xmlResetLastError();
33306 if (mem_base != xmlMemBlocks()) {
33307 printf("Leak of %d blocks found in xmlCheckUTF8",
33308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033309 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033310 printf(" %d", n_utf);
33311 printf("\n");
33312 }
33313 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033315
Daniel Veillard42595322004-11-08 10:52:06 +000033316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033317}
33318
33319
33320static int
33321test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033323
Daniel Veillardce682bc2004-11-05 17:22:25 +000033324 int mem_base;
33325 int ret_val;
33326 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33327 int n_utf;
33328 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. */
33329 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033330
Daniel Veillardce682bc2004-11-05 17:22:25 +000033331 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33332 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33333 mem_base = xmlMemBlocks();
33334 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33335 len = gen_int_ptr(n_len, 1);
33336
William M. Brackf13f77f2004-11-12 16:03:48 +000033337 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033338 desret_int(ret_val);
33339 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033340 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033341 des_int_ptr(n_len, len, 1);
33342 xmlResetLastError();
33343 if (mem_base != xmlMemBlocks()) {
33344 printf("Leak of %d blocks found in xmlGetUTF8Char",
33345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033346 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033347 printf(" %d", n_utf);
33348 printf(" %d", n_len);
33349 printf("\n");
33350 }
33351 }
33352 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033353 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033354
Daniel Veillard42595322004-11-08 10:52:06 +000033355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033356}
33357
33358
33359static int
33360test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033362
33363 int mem_base;
33364 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033365 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033366 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033367 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033368 int n_str2;
33369
33370 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33371 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033373 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33374 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033375
William M. Brackf13f77f2004-11-12 16:03:48 +000033376 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033377 desret_int(ret_val);
33378 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033379 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33380 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033381 xmlResetLastError();
33382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033383 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033386 printf(" %d", n_str1);
33387 printf(" %d", n_str2);
33388 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033389 }
33390 }
33391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033393
Daniel Veillard42595322004-11-08 10:52:06 +000033394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033395}
33396
33397
33398static int
33399test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033401
33402
33403 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033405}
33406
33407
33408static int
33409test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033411
33412 int mem_base;
33413 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033414 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033415 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033416 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033417 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033418 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033419 int n_str;
33420
33421 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33422 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33423 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033425 pref = gen_const_xmlChar_ptr(n_pref, 0);
33426 name = gen_const_xmlChar_ptr(n_name, 1);
33427 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033428
William M. Brackf13f77f2004-11-12 16:03:48 +000033429 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033430 desret_int(ret_val);
33431 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033432 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33433 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33434 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033435 xmlResetLastError();
33436 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033437 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033440 printf(" %d", n_pref);
33441 printf(" %d", n_name);
33442 printf(" %d", n_str);
33443 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033444 }
33445 }
33446 }
33447 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033449
Daniel Veillard42595322004-11-08 10:52:06 +000033450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033451}
33452
33453
33454static int
33455test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033457
33458
33459 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461}
33462
33463
33464static int
33465test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033467
33468 int mem_base;
33469 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033470 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033471 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033472 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033473 int n_str2;
33474
33475 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33476 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033478 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33479 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033480
William M. Brackf13f77f2004-11-12 16:03:48 +000033481 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033482 desret_int(ret_val);
33483 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033484 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33485 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033486 xmlResetLastError();
33487 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033488 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033490 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033491 printf(" %d", n_str1);
33492 printf(" %d", n_str2);
33493 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033494 }
33495 }
33496 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033497 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033498
Daniel Veillard42595322004-11-08 10:52:06 +000033499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033500}
33501
33502
33503static int
33504test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033506
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033507 int mem_base;
33508 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033509 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033510 int n_str;
33511 xmlChar * val; /* the xmlChar to search (needle) */
33512 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033513
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033514 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33515 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033517 str = gen_const_xmlChar_ptr(n_str, 0);
33518 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033519
William M. Brackf13f77f2004-11-12 16:03:48 +000033520 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033521 desret_const_xmlChar_ptr(ret_val);
33522 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033523 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033524 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033525 xmlResetLastError();
33526 if (mem_base != xmlMemBlocks()) {
33527 printf("Leak of %d blocks found in xmlStrcasestr",
33528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033529 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033530 printf(" %d", n_str);
33531 printf(" %d", n_val);
33532 printf("\n");
33533 }
33534 }
33535 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033536 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033537
Daniel Veillard42595322004-11-08 10:52:06 +000033538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033539}
33540
33541
33542static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033543test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033545
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033546 int mem_base;
33547 const xmlChar * ret_val;
33548 xmlChar * str; /* the xmlChar * array */
33549 int n_str;
33550 xmlChar val; /* the xmlChar to search */
33551 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033552
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033553 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33554 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33555 mem_base = xmlMemBlocks();
33556 str = gen_const_xmlChar_ptr(n_str, 0);
33557 val = gen_xmlChar(n_val, 1);
33558
William M. Brackf13f77f2004-11-12 16:03:48 +000033559 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033560 desret_const_xmlChar_ptr(ret_val);
33561 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033562 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033563 des_xmlChar(n_val, val, 1);
33564 xmlResetLastError();
33565 if (mem_base != xmlMemBlocks()) {
33566 printf("Leak of %d blocks found in xmlStrchr",
33567 xmlMemBlocks() - mem_base);
33568 test_ret++;
33569 printf(" %d", n_str);
33570 printf(" %d", n_val);
33571 printf("\n");
33572 }
33573 }
33574 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033576
Daniel Veillard42595322004-11-08 10:52:06 +000033577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033578}
33579
33580
33581static int
33582test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584
33585 int mem_base;
33586 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033587 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033588 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033589 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033590 int n_str2;
33591
33592 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33593 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033595 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33596 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597
William M. Brackf13f77f2004-11-12 16:03:48 +000033598 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033599 desret_int(ret_val);
33600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033601 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33602 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033603 xmlResetLastError();
33604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033605 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033608 printf(" %d", n_str1);
33609 printf(" %d", n_str2);
33610 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033611 }
33612 }
33613 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033614 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033615
Daniel Veillard42595322004-11-08 10:52:06 +000033616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033617}
33618
33619
33620static int
33621test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033623
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033624 int mem_base;
33625 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033626 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033627 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033628
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033629 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33630 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033631 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033632
William M. Brackf13f77f2004-11-12 16:03:48 +000033633 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033634 desret_xmlChar_ptr(ret_val);
33635 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033636 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033637 xmlResetLastError();
33638 if (mem_base != xmlMemBlocks()) {
33639 printf("Leak of %d blocks found in xmlStrdup",
33640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033641 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033642 printf(" %d", n_cur);
33643 printf("\n");
33644 }
33645 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033647
Daniel Veillard42595322004-11-08 10:52:06 +000033648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033649}
33650
33651
33652static int
33653test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033655
33656 int mem_base;
33657 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033658 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033659 int n_str;
33660
33661 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033663 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033664
William M. Brackf13f77f2004-11-12 16:03:48 +000033665 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033666 desret_int(ret_val);
33667 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033668 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033669 xmlResetLastError();
33670 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033671 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033673 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033674 printf(" %d", n_str);
33675 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033676 }
33677 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033678 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033679
Daniel Veillard42595322004-11-08 10:52:06 +000033680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033681}
33682
33683
33684static int
33685test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033687
33688 int mem_base;
33689 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033690 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033691 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033692 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033693 int n_str2;
33694 int len; /* the max comparison length */
33695 int n_len;
33696
33697 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33698 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33699 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33700 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033701 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33702 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33703 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033704
William M. Brackf13f77f2004-11-12 16:03:48 +000033705 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033706 desret_int(ret_val);
33707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033708 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33709 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033710 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033711 xmlResetLastError();
33712 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033713 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033715 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033716 printf(" %d", n_str1);
33717 printf(" %d", n_str2);
33718 printf(" %d", n_len);
33719 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033720 }
33721 }
33722 }
33723 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033725
Daniel Veillard42595322004-11-08 10:52:06 +000033726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033727}
33728
33729
33730static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033731test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033734 int mem_base;
33735 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033736 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033737 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033738 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033739 int n_str2;
33740 int len; /* the len of @str2 */
33741 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033742
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033743 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33744 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33745 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033747 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33748 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33749 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033750
William M. Brackf13f77f2004-11-12 16:03:48 +000033751 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033752 desret_xmlChar_ptr(ret_val);
33753 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033754 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33755 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033756 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033757 xmlResetLastError();
33758 if (mem_base != xmlMemBlocks()) {
33759 printf("Leak of %d blocks found in xmlStrncatNew",
33760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033761 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033762 printf(" %d", n_str1);
33763 printf(" %d", n_str2);
33764 printf(" %d", n_len);
33765 printf("\n");
33766 }
33767 }
33768 }
33769 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033770 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033771
Daniel Veillard42595322004-11-08 10:52:06 +000033772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773}
33774
33775
33776static int
33777test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033779
33780 int mem_base;
33781 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033782 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033783 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033784 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033785 int n_str2;
33786 int len; /* the max comparison length */
33787 int n_len;
33788
33789 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33790 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33791 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033793 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33794 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33795 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033796
William M. Brackf13f77f2004-11-12 16:03:48 +000033797 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033798 desret_int(ret_val);
33799 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033800 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33801 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033802 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033803 xmlResetLastError();
33804 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033805 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033807 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033808 printf(" %d", n_str1);
33809 printf(" %d", n_str2);
33810 printf(" %d", n_len);
33811 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033812 }
33813 }
33814 }
33815 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033817
Daniel Veillard42595322004-11-08 10:52:06 +000033818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819}
33820
33821
33822static int
33823test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033825
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033826 int mem_base;
33827 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033828 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033829 int n_cur;
33830 int len; /* the len of @cur */
33831 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033832
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033833 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33834 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033836 cur = gen_const_xmlChar_ptr(n_cur, 0);
33837 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033838
William M. Brackf13f77f2004-11-12 16:03:48 +000033839 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033840 desret_xmlChar_ptr(ret_val);
33841 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033842 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033843 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033844 xmlResetLastError();
33845 if (mem_base != xmlMemBlocks()) {
33846 printf("Leak of %d blocks found in xmlStrndup",
33847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033848 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033849 printf(" %d", n_cur);
33850 printf(" %d", n_len);
33851 printf("\n");
33852 }
33853 }
33854 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033855 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033856
Daniel Veillard42595322004-11-08 10:52:06 +000033857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033858}
33859
33860
33861static int
33862test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033865 int mem_base;
33866 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033867 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033868 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033869 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033870 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033871
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033872 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33873 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33874 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033875 str = gen_const_xmlChar_ptr(n_str, 0);
33876 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033877
William M. Brackf13f77f2004-11-12 16:03:48 +000033878 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033879 desret_const_xmlChar_ptr(ret_val);
33880 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033881 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33882 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033883 xmlResetLastError();
33884 if (mem_base != xmlMemBlocks()) {
33885 printf("Leak of %d blocks found in xmlStrstr",
33886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033887 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033888 printf(" %d", n_str);
33889 printf(" %d", n_val);
33890 printf("\n");
33891 }
33892 }
33893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033895
Daniel Veillard42595322004-11-08 10:52:06 +000033896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033897}
33898
33899
33900static int
33901test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033903
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033904 int mem_base;
33905 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033906 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033907 int n_str;
33908 int start; /* the index of the first char (zero based) */
33909 int n_start;
33910 int len; /* the length of the substring */
33911 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033912
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033913 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33914 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33915 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033917 str = gen_const_xmlChar_ptr(n_str, 0);
33918 start = gen_int(n_start, 1);
33919 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033920
William M. Brackf13f77f2004-11-12 16:03:48 +000033921 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033922 desret_xmlChar_ptr(ret_val);
33923 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033924 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033925 des_int(n_start, start, 1);
33926 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033927 xmlResetLastError();
33928 if (mem_base != xmlMemBlocks()) {
33929 printf("Leak of %d blocks found in xmlStrsub",
33930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033931 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033932 printf(" %d", n_str);
33933 printf(" %d", n_start);
33934 printf(" %d", n_len);
33935 printf("\n");
33936 }
33937 }
33938 }
33939 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033940 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033941
Daniel Veillard42595322004-11-08 10:52:06 +000033942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033943}
33944
33945
33946static int
33947test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033949
33950 int mem_base;
33951 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033952 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033953 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033954 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033955 int n_utf2;
33956
33957 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33958 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33959 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033960 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33961 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033962
William M. Brackf13f77f2004-11-12 16:03:48 +000033963 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033964 desret_int(ret_val);
33965 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033966 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33967 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033968 xmlResetLastError();
33969 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033970 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033972 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033973 printf(" %d", n_utf1);
33974 printf(" %d", n_utf2);
33975 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033976 }
33977 }
33978 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033979 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033980
Daniel Veillard42595322004-11-08 10:52:06 +000033981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033982}
33983
33984
33985static int
33986test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033988
33989 int mem_base;
33990 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033991 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033992 int n_utf;
33993
33994 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033996 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033997
William M. Brackf13f77f2004-11-12 16:03:48 +000033998 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033999 desret_int(ret_val);
34000 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034001 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034002 xmlResetLastError();
34003 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034004 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034007 printf(" %d", n_utf);
34008 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034009 }
34010 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034011 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034012
Daniel Veillard42595322004-11-08 10:52:06 +000034013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034014}
34015
34016
34017static int
34018test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034020
34021 int mem_base;
34022 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034023 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034024 int n_utf;
34025
34026 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034028 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034029
William M. Brackf13f77f2004-11-12 16:03:48 +000034030 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034031 desret_int(ret_val);
34032 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034033 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034034 xmlResetLastError();
34035 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034036 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034038 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034039 printf(" %d", n_utf);
34040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034041 }
34042 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034044
Daniel Veillard42595322004-11-08 10:52:06 +000034045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034046}
34047
34048
34049static int
34050test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034052
34053 int mem_base;
34054 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034055 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034056 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034057 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034058 int n_utfchar;
34059
34060 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34061 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034063 utf = gen_const_xmlChar_ptr(n_utf, 0);
34064 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034065
William M. Brackf13f77f2004-11-12 16:03:48 +000034066 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034067 desret_int(ret_val);
34068 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034069 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34070 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034071 xmlResetLastError();
34072 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034073 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034075 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034076 printf(" %d", n_utf);
34077 printf(" %d", n_utfchar);
34078 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034079 }
34080 }
34081 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034082 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034083
Daniel Veillard42595322004-11-08 10:52:06 +000034084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034085}
34086
34087
34088static int
34089test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034091
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034092 int mem_base;
34093 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034094 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034095 int n_utf;
34096 int len; /* the len of @utf (in chars) */
34097 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034098
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034099 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34100 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34101 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034102 utf = gen_const_xmlChar_ptr(n_utf, 0);
34103 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034104
William M. Brackf13f77f2004-11-12 16:03:48 +000034105 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034106 desret_xmlChar_ptr(ret_val);
34107 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034108 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034109 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034110 xmlResetLastError();
34111 if (mem_base != xmlMemBlocks()) {
34112 printf("Leak of %d blocks found in xmlUTF8Strndup",
34113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034114 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034115 printf(" %d", n_utf);
34116 printf(" %d", n_len);
34117 printf("\n");
34118 }
34119 }
34120 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034122
Daniel Veillard42595322004-11-08 10:52:06 +000034123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034124}
34125
34126
34127static int
34128test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034130
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034131 int mem_base;
34132 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034133 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034134 int n_utf;
34135 int pos; /* the position of the desired UTF8 char (in chars) */
34136 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034137
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034138 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34139 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034141 utf = gen_const_xmlChar_ptr(n_utf, 0);
34142 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034143
William M. Brackf13f77f2004-11-12 16:03:48 +000034144 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034145 desret_const_xmlChar_ptr(ret_val);
34146 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034147 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034148 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034149 xmlResetLastError();
34150 if (mem_base != xmlMemBlocks()) {
34151 printf("Leak of %d blocks found in xmlUTF8Strpos",
34152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034153 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034154 printf(" %d", n_utf);
34155 printf(" %d", n_pos);
34156 printf("\n");
34157 }
34158 }
34159 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034161
Daniel Veillard42595322004-11-08 10:52:06 +000034162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034163}
34164
34165
34166static int
34167test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034169
34170 int mem_base;
34171 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034172 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034173 int n_utf;
34174 int len; /* the number of characters in the array */
34175 int n_len;
34176
34177 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34178 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034180 utf = gen_const_xmlChar_ptr(n_utf, 0);
34181 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034182
William M. Brackf13f77f2004-11-12 16:03:48 +000034183 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034184 desret_int(ret_val);
34185 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034186 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034187 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034188 xmlResetLastError();
34189 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034190 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034192 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034193 printf(" %d", n_utf);
34194 printf(" %d", n_len);
34195 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034196 }
34197 }
34198 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034199 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034200
Daniel Veillard42595322004-11-08 10:52:06 +000034201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034202}
34203
34204
34205static int
34206test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034208
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034209 int mem_base;
34210 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034211 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034212 int n_utf;
34213 int start; /* relative pos of first char */
34214 int n_start;
34215 int len; /* total number to copy */
34216 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034217
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034218 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34219 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34220 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034222 utf = gen_const_xmlChar_ptr(n_utf, 0);
34223 start = gen_int(n_start, 1);
34224 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034225
William M. Brackf13f77f2004-11-12 16:03:48 +000034226 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034227 desret_xmlChar_ptr(ret_val);
34228 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034229 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034230 des_int(n_start, start, 1);
34231 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034232 xmlResetLastError();
34233 if (mem_base != xmlMemBlocks()) {
34234 printf("Leak of %d blocks found in xmlUTF8Strsub",
34235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034236 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034237 printf(" %d", n_utf);
34238 printf(" %d", n_start);
34239 printf(" %d", n_len);
34240 printf("\n");
34241 }
34242 }
34243 }
34244 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034246
Daniel Veillard42595322004-11-08 10:52:06 +000034247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034248}
34249
34250static int
34251test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034253
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034254 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034255 test_ret += test_xmlCharStrdup();
34256 test_ret += test_xmlCharStrndup();
34257 test_ret += test_xmlCheckUTF8();
34258 test_ret += test_xmlGetUTF8Char();
34259 test_ret += test_xmlStrEqual();
34260 test_ret += test_xmlStrPrintf();
34261 test_ret += test_xmlStrQEqual();
34262 test_ret += test_xmlStrVPrintf();
34263 test_ret += test_xmlStrcasecmp();
34264 test_ret += test_xmlStrcasestr();
34265 test_ret += test_xmlStrchr();
34266 test_ret += test_xmlStrcmp();
34267 test_ret += test_xmlStrdup();
34268 test_ret += test_xmlStrlen();
34269 test_ret += test_xmlStrncasecmp();
34270 test_ret += test_xmlStrncatNew();
34271 test_ret += test_xmlStrncmp();
34272 test_ret += test_xmlStrndup();
34273 test_ret += test_xmlStrstr();
34274 test_ret += test_xmlStrsub();
34275 test_ret += test_xmlUTF8Charcmp();
34276 test_ret += test_xmlUTF8Size();
34277 test_ret += test_xmlUTF8Strlen();
34278 test_ret += test_xmlUTF8Strloc();
34279 test_ret += test_xmlUTF8Strndup();
34280 test_ret += test_xmlUTF8Strpos();
34281 test_ret += test_xmlUTF8Strsize();
34282 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034283
Daniel Veillard42595322004-11-08 10:52:06 +000034284 if (test_ret != 0)
34285 printf("Module xmlstring: %d errors\n", test_ret);
34286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034287}
34288
34289static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034290test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034292
William M. Brack21e4ef22005-01-02 09:53:13 +000034293#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034294 int mem_base;
34295 int ret_val;
34296 int code; /* UCS code point */
34297 int n_code;
34298
34299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34300 mem_base = xmlMemBlocks();
34301 code = gen_int(n_code, 0);
34302
34303 ret_val = xmlUCSIsAegeanNumbers(code);
34304 desret_int(ret_val);
34305 call_tests++;
34306 des_int(n_code, code, 0);
34307 xmlResetLastError();
34308 if (mem_base != xmlMemBlocks()) {
34309 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034312 printf(" %d", n_code);
34313 printf("\n");
34314 }
34315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034317#endif
34318
Daniel Veillard42595322004-11-08 10:52:06 +000034319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034320}
34321
34322
34323static int
34324test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034326
William M. Brack21e4ef22005-01-02 09:53:13 +000034327#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034328 int mem_base;
34329 int ret_val;
34330 int code; /* UCS code point */
34331 int n_code;
34332
34333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34334 mem_base = xmlMemBlocks();
34335 code = gen_int(n_code, 0);
34336
34337 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34338 desret_int(ret_val);
34339 call_tests++;
34340 des_int(n_code, code, 0);
34341 xmlResetLastError();
34342 if (mem_base != xmlMemBlocks()) {
34343 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034346 printf(" %d", n_code);
34347 printf("\n");
34348 }
34349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034351#endif
34352
Daniel Veillard42595322004-11-08 10:52:06 +000034353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034354}
34355
34356
34357static int
34358test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034360
William M. Brack21e4ef22005-01-02 09:53:13 +000034361#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034362 int mem_base;
34363 int ret_val;
34364 int code; /* UCS code point */
34365 int n_code;
34366
34367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34368 mem_base = xmlMemBlocks();
34369 code = gen_int(n_code, 0);
34370
34371 ret_val = xmlUCSIsArabic(code);
34372 desret_int(ret_val);
34373 call_tests++;
34374 des_int(n_code, code, 0);
34375 xmlResetLastError();
34376 if (mem_base != xmlMemBlocks()) {
34377 printf("Leak of %d blocks found in xmlUCSIsArabic",
34378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034380 printf(" %d", n_code);
34381 printf("\n");
34382 }
34383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034385#endif
34386
Daniel Veillard42595322004-11-08 10:52:06 +000034387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034388}
34389
34390
34391static int
34392test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034394
William M. Brack21e4ef22005-01-02 09:53:13 +000034395#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034396 int mem_base;
34397 int ret_val;
34398 int code; /* UCS code point */
34399 int n_code;
34400
34401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34402 mem_base = xmlMemBlocks();
34403 code = gen_int(n_code, 0);
34404
34405 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34406 desret_int(ret_val);
34407 call_tests++;
34408 des_int(n_code, code, 0);
34409 xmlResetLastError();
34410 if (mem_base != xmlMemBlocks()) {
34411 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034414 printf(" %d", n_code);
34415 printf("\n");
34416 }
34417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034419#endif
34420
Daniel Veillard42595322004-11-08 10:52:06 +000034421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034422}
34423
34424
34425static int
34426test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034428
William M. Brack21e4ef22005-01-02 09:53:13 +000034429#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034430 int mem_base;
34431 int ret_val;
34432 int code; /* UCS code point */
34433 int n_code;
34434
34435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34436 mem_base = xmlMemBlocks();
34437 code = gen_int(n_code, 0);
34438
34439 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34440 desret_int(ret_val);
34441 call_tests++;
34442 des_int(n_code, code, 0);
34443 xmlResetLastError();
34444 if (mem_base != xmlMemBlocks()) {
34445 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034448 printf(" %d", n_code);
34449 printf("\n");
34450 }
34451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034453#endif
34454
Daniel Veillard42595322004-11-08 10:52:06 +000034455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034456}
34457
34458
34459static int
34460test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034461 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034462
William M. Brack21e4ef22005-01-02 09:53:13 +000034463#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034464 int mem_base;
34465 int ret_val;
34466 int code; /* UCS code point */
34467 int n_code;
34468
34469 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34470 mem_base = xmlMemBlocks();
34471 code = gen_int(n_code, 0);
34472
34473 ret_val = xmlUCSIsArmenian(code);
34474 desret_int(ret_val);
34475 call_tests++;
34476 des_int(n_code, code, 0);
34477 xmlResetLastError();
34478 if (mem_base != xmlMemBlocks()) {
34479 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034481 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034482 printf(" %d", n_code);
34483 printf("\n");
34484 }
34485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034486 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034487#endif
34488
Daniel Veillard42595322004-11-08 10:52:06 +000034489 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034490}
34491
34492
34493static int
34494test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034495 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034496
William M. Brack21e4ef22005-01-02 09:53:13 +000034497#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034498 int mem_base;
34499 int ret_val;
34500 int code; /* UCS code point */
34501 int n_code;
34502
34503 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34504 mem_base = xmlMemBlocks();
34505 code = gen_int(n_code, 0);
34506
34507 ret_val = xmlUCSIsArrows(code);
34508 desret_int(ret_val);
34509 call_tests++;
34510 des_int(n_code, code, 0);
34511 xmlResetLastError();
34512 if (mem_base != xmlMemBlocks()) {
34513 printf("Leak of %d blocks found in xmlUCSIsArrows",
34514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034515 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034516 printf(" %d", n_code);
34517 printf("\n");
34518 }
34519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034520 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034521#endif
34522
Daniel Veillard42595322004-11-08 10:52:06 +000034523 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034524}
34525
34526
34527static int
34528test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034529 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034530
William M. Brack21e4ef22005-01-02 09:53:13 +000034531#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034532 int mem_base;
34533 int ret_val;
34534 int code; /* UCS code point */
34535 int n_code;
34536
34537 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34538 mem_base = xmlMemBlocks();
34539 code = gen_int(n_code, 0);
34540
34541 ret_val = xmlUCSIsBasicLatin(code);
34542 desret_int(ret_val);
34543 call_tests++;
34544 des_int(n_code, code, 0);
34545 xmlResetLastError();
34546 if (mem_base != xmlMemBlocks()) {
34547 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034549 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034550 printf(" %d", n_code);
34551 printf("\n");
34552 }
34553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034554 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034555#endif
34556
Daniel Veillard42595322004-11-08 10:52:06 +000034557 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034558}
34559
34560
34561static int
34562test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034563 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034564
William M. Brack21e4ef22005-01-02 09:53:13 +000034565#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034566 int mem_base;
34567 int ret_val;
34568 int code; /* UCS code point */
34569 int n_code;
34570
34571 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34572 mem_base = xmlMemBlocks();
34573 code = gen_int(n_code, 0);
34574
34575 ret_val = xmlUCSIsBengali(code);
34576 desret_int(ret_val);
34577 call_tests++;
34578 des_int(n_code, code, 0);
34579 xmlResetLastError();
34580 if (mem_base != xmlMemBlocks()) {
34581 printf("Leak of %d blocks found in xmlUCSIsBengali",
34582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034583 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034584 printf(" %d", n_code);
34585 printf("\n");
34586 }
34587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034588 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034589#endif
34590
Daniel Veillard42595322004-11-08 10:52:06 +000034591 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034592}
34593
34594
34595static int
34596test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034597 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034598
William M. Brack21e4ef22005-01-02 09:53:13 +000034599#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034600 int mem_base;
34601 int ret_val;
34602 int code; /* UCS code point */
34603 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034604 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034605 int n_block;
34606
34607 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34608 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34609 mem_base = xmlMemBlocks();
34610 code = gen_int(n_code, 0);
34611 block = gen_const_char_ptr(n_block, 1);
34612
William M. Brackf13f77f2004-11-12 16:03:48 +000034613 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034614 desret_int(ret_val);
34615 call_tests++;
34616 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034617 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034618 xmlResetLastError();
34619 if (mem_base != xmlMemBlocks()) {
34620 printf("Leak of %d blocks found in xmlUCSIsBlock",
34621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034622 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034623 printf(" %d", n_code);
34624 printf(" %d", n_block);
34625 printf("\n");
34626 }
34627 }
34628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034629 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034630#endif
34631
Daniel Veillard42595322004-11-08 10:52:06 +000034632 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633}
34634
34635
34636static int
34637test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034638 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034639
William M. Brack21e4ef22005-01-02 09:53:13 +000034640#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034641 int mem_base;
34642 int ret_val;
34643 int code; /* UCS code point */
34644 int n_code;
34645
34646 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34647 mem_base = xmlMemBlocks();
34648 code = gen_int(n_code, 0);
34649
34650 ret_val = xmlUCSIsBlockElements(code);
34651 desret_int(ret_val);
34652 call_tests++;
34653 des_int(n_code, code, 0);
34654 xmlResetLastError();
34655 if (mem_base != xmlMemBlocks()) {
34656 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034658 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034659 printf(" %d", n_code);
34660 printf("\n");
34661 }
34662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034663 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034664#endif
34665
Daniel Veillard42595322004-11-08 10:52:06 +000034666 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667}
34668
34669
34670static int
34671test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034672 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034673
William M. Brack21e4ef22005-01-02 09:53:13 +000034674#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034675 int mem_base;
34676 int ret_val;
34677 int code; /* UCS code point */
34678 int n_code;
34679
34680 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34681 mem_base = xmlMemBlocks();
34682 code = gen_int(n_code, 0);
34683
34684 ret_val = xmlUCSIsBopomofo(code);
34685 desret_int(ret_val);
34686 call_tests++;
34687 des_int(n_code, code, 0);
34688 xmlResetLastError();
34689 if (mem_base != xmlMemBlocks()) {
34690 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034692 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034693 printf(" %d", n_code);
34694 printf("\n");
34695 }
34696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034697 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034698#endif
34699
Daniel Veillard42595322004-11-08 10:52:06 +000034700 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034701}
34702
34703
34704static int
34705test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034706 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034707
William M. Brack21e4ef22005-01-02 09:53:13 +000034708#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034709 int mem_base;
34710 int ret_val;
34711 int code; /* UCS code point */
34712 int n_code;
34713
34714 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34715 mem_base = xmlMemBlocks();
34716 code = gen_int(n_code, 0);
34717
34718 ret_val = xmlUCSIsBopomofoExtended(code);
34719 desret_int(ret_val);
34720 call_tests++;
34721 des_int(n_code, code, 0);
34722 xmlResetLastError();
34723 if (mem_base != xmlMemBlocks()) {
34724 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034726 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034727 printf(" %d", n_code);
34728 printf("\n");
34729 }
34730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034731 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034732#endif
34733
Daniel Veillard42595322004-11-08 10:52:06 +000034734 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034735}
34736
34737
34738static int
34739test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034740 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034741
William M. Brack21e4ef22005-01-02 09:53:13 +000034742#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034743 int mem_base;
34744 int ret_val;
34745 int code; /* UCS code point */
34746 int n_code;
34747
34748 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34749 mem_base = xmlMemBlocks();
34750 code = gen_int(n_code, 0);
34751
34752 ret_val = xmlUCSIsBoxDrawing(code);
34753 desret_int(ret_val);
34754 call_tests++;
34755 des_int(n_code, code, 0);
34756 xmlResetLastError();
34757 if (mem_base != xmlMemBlocks()) {
34758 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034760 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034761 printf(" %d", n_code);
34762 printf("\n");
34763 }
34764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034765 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034766#endif
34767
Daniel Veillard42595322004-11-08 10:52:06 +000034768 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034769}
34770
34771
34772static int
34773test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034774 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034775
William M. Brack21e4ef22005-01-02 09:53:13 +000034776#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034777 int mem_base;
34778 int ret_val;
34779 int code; /* UCS code point */
34780 int n_code;
34781
34782 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34783 mem_base = xmlMemBlocks();
34784 code = gen_int(n_code, 0);
34785
34786 ret_val = xmlUCSIsBraillePatterns(code);
34787 desret_int(ret_val);
34788 call_tests++;
34789 des_int(n_code, code, 0);
34790 xmlResetLastError();
34791 if (mem_base != xmlMemBlocks()) {
34792 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034794 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034795 printf(" %d", n_code);
34796 printf("\n");
34797 }
34798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034799 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034800#endif
34801
Daniel Veillard42595322004-11-08 10:52:06 +000034802 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034803}
34804
34805
34806static int
34807test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034808 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034809
William M. Brack21e4ef22005-01-02 09:53:13 +000034810#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034811 int mem_base;
34812 int ret_val;
34813 int code; /* UCS code point */
34814 int n_code;
34815
34816 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34817 mem_base = xmlMemBlocks();
34818 code = gen_int(n_code, 0);
34819
34820 ret_val = xmlUCSIsBuhid(code);
34821 desret_int(ret_val);
34822 call_tests++;
34823 des_int(n_code, code, 0);
34824 xmlResetLastError();
34825 if (mem_base != xmlMemBlocks()) {
34826 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034828 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034829 printf(" %d", n_code);
34830 printf("\n");
34831 }
34832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034833 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034834#endif
34835
Daniel Veillard42595322004-11-08 10:52:06 +000034836 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034837}
34838
34839
34840static int
34841test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034842 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034843
William M. Brack21e4ef22005-01-02 09:53:13 +000034844#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034845 int mem_base;
34846 int ret_val;
34847 int code; /* UCS code point */
34848 int n_code;
34849
34850 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34851 mem_base = xmlMemBlocks();
34852 code = gen_int(n_code, 0);
34853
34854 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34855 desret_int(ret_val);
34856 call_tests++;
34857 des_int(n_code, code, 0);
34858 xmlResetLastError();
34859 if (mem_base != xmlMemBlocks()) {
34860 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034862 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034863 printf(" %d", n_code);
34864 printf("\n");
34865 }
34866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034867 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034868#endif
34869
Daniel Veillard42595322004-11-08 10:52:06 +000034870 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034871}
34872
34873
34874static int
34875test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034876 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034877
William M. Brack21e4ef22005-01-02 09:53:13 +000034878#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034879 int mem_base;
34880 int ret_val;
34881 int code; /* UCS code point */
34882 int n_code;
34883
34884 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34885 mem_base = xmlMemBlocks();
34886 code = gen_int(n_code, 0);
34887
34888 ret_val = xmlUCSIsCJKCompatibility(code);
34889 desret_int(ret_val);
34890 call_tests++;
34891 des_int(n_code, code, 0);
34892 xmlResetLastError();
34893 if (mem_base != xmlMemBlocks()) {
34894 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034896 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034897 printf(" %d", n_code);
34898 printf("\n");
34899 }
34900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034901 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034902#endif
34903
Daniel Veillard42595322004-11-08 10:52:06 +000034904 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034905}
34906
34907
34908static int
34909test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034910 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034911
William M. Brack21e4ef22005-01-02 09:53:13 +000034912#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034913 int mem_base;
34914 int ret_val;
34915 int code; /* UCS code point */
34916 int n_code;
34917
34918 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34919 mem_base = xmlMemBlocks();
34920 code = gen_int(n_code, 0);
34921
34922 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34923 desret_int(ret_val);
34924 call_tests++;
34925 des_int(n_code, code, 0);
34926 xmlResetLastError();
34927 if (mem_base != xmlMemBlocks()) {
34928 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034930 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034931 printf(" %d", n_code);
34932 printf("\n");
34933 }
34934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034935 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936#endif
34937
Daniel Veillard42595322004-11-08 10:52:06 +000034938 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034939}
34940
34941
34942static int
34943test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034944 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034945
William M. Brack21e4ef22005-01-02 09:53:13 +000034946#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034947 int mem_base;
34948 int ret_val;
34949 int code; /* UCS code point */
34950 int n_code;
34951
34952 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34953 mem_base = xmlMemBlocks();
34954 code = gen_int(n_code, 0);
34955
34956 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34957 desret_int(ret_val);
34958 call_tests++;
34959 des_int(n_code, code, 0);
34960 xmlResetLastError();
34961 if (mem_base != xmlMemBlocks()) {
34962 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034964 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034965 printf(" %d", n_code);
34966 printf("\n");
34967 }
34968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034969 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034970#endif
34971
Daniel Veillard42595322004-11-08 10:52:06 +000034972 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034973}
34974
34975
34976static int
34977test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034978 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034979
William M. Brack21e4ef22005-01-02 09:53:13 +000034980#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034981 int mem_base;
34982 int ret_val;
34983 int code; /* UCS code point */
34984 int n_code;
34985
34986 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34987 mem_base = xmlMemBlocks();
34988 code = gen_int(n_code, 0);
34989
34990 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34991 desret_int(ret_val);
34992 call_tests++;
34993 des_int(n_code, code, 0);
34994 xmlResetLastError();
34995 if (mem_base != xmlMemBlocks()) {
34996 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034998 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034999 printf(" %d", n_code);
35000 printf("\n");
35001 }
35002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035003 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035004#endif
35005
Daniel Veillard42595322004-11-08 10:52:06 +000035006 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035007}
35008
35009
35010static int
35011test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035012 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035013
William M. Brack21e4ef22005-01-02 09:53:13 +000035014#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035015 int mem_base;
35016 int ret_val;
35017 int code; /* UCS code point */
35018 int n_code;
35019
35020 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35021 mem_base = xmlMemBlocks();
35022 code = gen_int(n_code, 0);
35023
35024 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35025 desret_int(ret_val);
35026 call_tests++;
35027 des_int(n_code, code, 0);
35028 xmlResetLastError();
35029 if (mem_base != xmlMemBlocks()) {
35030 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035032 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035033 printf(" %d", n_code);
35034 printf("\n");
35035 }
35036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035037 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035038#endif
35039
Daniel Veillard42595322004-11-08 10:52:06 +000035040 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035041}
35042
35043
35044static int
35045test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035046 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035047
William M. Brack21e4ef22005-01-02 09:53:13 +000035048#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035049 int mem_base;
35050 int ret_val;
35051 int code; /* UCS code point */
35052 int n_code;
35053
35054 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35055 mem_base = xmlMemBlocks();
35056 code = gen_int(n_code, 0);
35057
35058 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35059 desret_int(ret_val);
35060 call_tests++;
35061 des_int(n_code, code, 0);
35062 xmlResetLastError();
35063 if (mem_base != xmlMemBlocks()) {
35064 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035066 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035067 printf(" %d", n_code);
35068 printf("\n");
35069 }
35070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035071 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035072#endif
35073
Daniel Veillard42595322004-11-08 10:52:06 +000035074 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035075}
35076
35077
35078static int
35079test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035080 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035081
William M. Brack21e4ef22005-01-02 09:53:13 +000035082#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035083 int mem_base;
35084 int ret_val;
35085 int code; /* UCS code point */
35086 int n_code;
35087
35088 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35089 mem_base = xmlMemBlocks();
35090 code = gen_int(n_code, 0);
35091
35092 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35093 desret_int(ret_val);
35094 call_tests++;
35095 des_int(n_code, code, 0);
35096 xmlResetLastError();
35097 if (mem_base != xmlMemBlocks()) {
35098 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035100 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035101 printf(" %d", n_code);
35102 printf("\n");
35103 }
35104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035105 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035106#endif
35107
Daniel Veillard42595322004-11-08 10:52:06 +000035108 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035109}
35110
35111
35112static int
35113test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035114 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035115
William M. Brack21e4ef22005-01-02 09:53:13 +000035116#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035117 int mem_base;
35118 int ret_val;
35119 int code; /* UCS code point */
35120 int n_code;
35121
35122 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35123 mem_base = xmlMemBlocks();
35124 code = gen_int(n_code, 0);
35125
35126 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35127 desret_int(ret_val);
35128 call_tests++;
35129 des_int(n_code, code, 0);
35130 xmlResetLastError();
35131 if (mem_base != xmlMemBlocks()) {
35132 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035134 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035135 printf(" %d", n_code);
35136 printf("\n");
35137 }
35138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035139 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035140#endif
35141
Daniel Veillard42595322004-11-08 10:52:06 +000035142 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035143}
35144
35145
35146static int
35147test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035148 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035149
William M. Brack21e4ef22005-01-02 09:53:13 +000035150#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035151 int mem_base;
35152 int ret_val;
35153 int code; /* UCS code point */
35154 int n_code;
35155
35156 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35157 mem_base = xmlMemBlocks();
35158 code = gen_int(n_code, 0);
35159
35160 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35161 desret_int(ret_val);
35162 call_tests++;
35163 des_int(n_code, code, 0);
35164 xmlResetLastError();
35165 if (mem_base != xmlMemBlocks()) {
35166 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035168 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035169 printf(" %d", n_code);
35170 printf("\n");
35171 }
35172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035173 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035174#endif
35175
Daniel Veillard42595322004-11-08 10:52:06 +000035176 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035177}
35178
35179
35180static int
35181test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035182 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035183
William M. Brack21e4ef22005-01-02 09:53:13 +000035184#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035185 int mem_base;
35186 int ret_val;
35187 int code; /* UCS code point */
35188 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035189 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035190 int n_cat;
35191
35192 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35193 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35194 mem_base = xmlMemBlocks();
35195 code = gen_int(n_code, 0);
35196 cat = gen_const_char_ptr(n_cat, 1);
35197
William M. Brackf13f77f2004-11-12 16:03:48 +000035198 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035199 desret_int(ret_val);
35200 call_tests++;
35201 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035202 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035203 xmlResetLastError();
35204 if (mem_base != xmlMemBlocks()) {
35205 printf("Leak of %d blocks found in xmlUCSIsCat",
35206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035208 printf(" %d", n_code);
35209 printf(" %d", n_cat);
35210 printf("\n");
35211 }
35212 }
35213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035215#endif
35216
Daniel Veillard42595322004-11-08 10:52:06 +000035217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218}
35219
35220
35221static int
35222test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035224
William M. Brack21e4ef22005-01-02 09:53:13 +000035225#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035226 int mem_base;
35227 int ret_val;
35228 int code; /* UCS code point */
35229 int n_code;
35230
35231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35232 mem_base = xmlMemBlocks();
35233 code = gen_int(n_code, 0);
35234
35235 ret_val = xmlUCSIsCatC(code);
35236 desret_int(ret_val);
35237 call_tests++;
35238 des_int(n_code, code, 0);
35239 xmlResetLastError();
35240 if (mem_base != xmlMemBlocks()) {
35241 printf("Leak of %d blocks found in xmlUCSIsCatC",
35242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035244 printf(" %d", n_code);
35245 printf("\n");
35246 }
35247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035249#endif
35250
Daniel Veillard42595322004-11-08 10:52:06 +000035251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252}
35253
35254
35255static int
35256test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035258
William M. Brack21e4ef22005-01-02 09:53:13 +000035259#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035260 int mem_base;
35261 int ret_val;
35262 int code; /* UCS code point */
35263 int n_code;
35264
35265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35266 mem_base = xmlMemBlocks();
35267 code = gen_int(n_code, 0);
35268
35269 ret_val = xmlUCSIsCatCc(code);
35270 desret_int(ret_val);
35271 call_tests++;
35272 des_int(n_code, code, 0);
35273 xmlResetLastError();
35274 if (mem_base != xmlMemBlocks()) {
35275 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035278 printf(" %d", n_code);
35279 printf("\n");
35280 }
35281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035283#endif
35284
Daniel Veillard42595322004-11-08 10:52:06 +000035285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286}
35287
35288
35289static int
35290test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035292
William M. Brack21e4ef22005-01-02 09:53:13 +000035293#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035294 int mem_base;
35295 int ret_val;
35296 int code; /* UCS code point */
35297 int n_code;
35298
35299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35300 mem_base = xmlMemBlocks();
35301 code = gen_int(n_code, 0);
35302
35303 ret_val = xmlUCSIsCatCf(code);
35304 desret_int(ret_val);
35305 call_tests++;
35306 des_int(n_code, code, 0);
35307 xmlResetLastError();
35308 if (mem_base != xmlMemBlocks()) {
35309 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035312 printf(" %d", n_code);
35313 printf("\n");
35314 }
35315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035317#endif
35318
Daniel Veillard42595322004-11-08 10:52:06 +000035319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320}
35321
35322
35323static int
35324test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035326
William M. Brack21e4ef22005-01-02 09:53:13 +000035327#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035328 int mem_base;
35329 int ret_val;
35330 int code; /* UCS code point */
35331 int n_code;
35332
35333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35334 mem_base = xmlMemBlocks();
35335 code = gen_int(n_code, 0);
35336
35337 ret_val = xmlUCSIsCatCo(code);
35338 desret_int(ret_val);
35339 call_tests++;
35340 des_int(n_code, code, 0);
35341 xmlResetLastError();
35342 if (mem_base != xmlMemBlocks()) {
35343 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035346 printf(" %d", n_code);
35347 printf("\n");
35348 }
35349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035351#endif
35352
Daniel Veillard42595322004-11-08 10:52:06 +000035353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354}
35355
35356
35357static int
35358test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035360
William M. Brack21e4ef22005-01-02 09:53:13 +000035361#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035362 int mem_base;
35363 int ret_val;
35364 int code; /* UCS code point */
35365 int n_code;
35366
35367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35368 mem_base = xmlMemBlocks();
35369 code = gen_int(n_code, 0);
35370
35371 ret_val = xmlUCSIsCatCs(code);
35372 desret_int(ret_val);
35373 call_tests++;
35374 des_int(n_code, code, 0);
35375 xmlResetLastError();
35376 if (mem_base != xmlMemBlocks()) {
35377 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035380 printf(" %d", n_code);
35381 printf("\n");
35382 }
35383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035385#endif
35386
Daniel Veillard42595322004-11-08 10:52:06 +000035387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035388}
35389
35390
35391static int
35392test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035394
William M. Brack21e4ef22005-01-02 09:53:13 +000035395#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035396 int mem_base;
35397 int ret_val;
35398 int code; /* UCS code point */
35399 int n_code;
35400
35401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35402 mem_base = xmlMemBlocks();
35403 code = gen_int(n_code, 0);
35404
35405 ret_val = xmlUCSIsCatL(code);
35406 desret_int(ret_val);
35407 call_tests++;
35408 des_int(n_code, code, 0);
35409 xmlResetLastError();
35410 if (mem_base != xmlMemBlocks()) {
35411 printf("Leak of %d blocks found in xmlUCSIsCatL",
35412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035414 printf(" %d", n_code);
35415 printf("\n");
35416 }
35417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035419#endif
35420
Daniel Veillard42595322004-11-08 10:52:06 +000035421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035422}
35423
35424
35425static int
35426test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035428
William M. Brack21e4ef22005-01-02 09:53:13 +000035429#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035430 int mem_base;
35431 int ret_val;
35432 int code; /* UCS code point */
35433 int n_code;
35434
35435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35436 mem_base = xmlMemBlocks();
35437 code = gen_int(n_code, 0);
35438
35439 ret_val = xmlUCSIsCatLl(code);
35440 desret_int(ret_val);
35441 call_tests++;
35442 des_int(n_code, code, 0);
35443 xmlResetLastError();
35444 if (mem_base != xmlMemBlocks()) {
35445 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035448 printf(" %d", n_code);
35449 printf("\n");
35450 }
35451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035453#endif
35454
Daniel Veillard42595322004-11-08 10:52:06 +000035455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035456}
35457
35458
35459static int
35460test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035461 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035462
William M. Brack21e4ef22005-01-02 09:53:13 +000035463#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035464 int mem_base;
35465 int ret_val;
35466 int code; /* UCS code point */
35467 int n_code;
35468
35469 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35470 mem_base = xmlMemBlocks();
35471 code = gen_int(n_code, 0);
35472
35473 ret_val = xmlUCSIsCatLm(code);
35474 desret_int(ret_val);
35475 call_tests++;
35476 des_int(n_code, code, 0);
35477 xmlResetLastError();
35478 if (mem_base != xmlMemBlocks()) {
35479 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035481 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035482 printf(" %d", n_code);
35483 printf("\n");
35484 }
35485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035486 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035487#endif
35488
Daniel Veillard42595322004-11-08 10:52:06 +000035489 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035490}
35491
35492
35493static int
35494test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035495 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035496
William M. Brack21e4ef22005-01-02 09:53:13 +000035497#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035498 int mem_base;
35499 int ret_val;
35500 int code; /* UCS code point */
35501 int n_code;
35502
35503 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35504 mem_base = xmlMemBlocks();
35505 code = gen_int(n_code, 0);
35506
35507 ret_val = xmlUCSIsCatLo(code);
35508 desret_int(ret_val);
35509 call_tests++;
35510 des_int(n_code, code, 0);
35511 xmlResetLastError();
35512 if (mem_base != xmlMemBlocks()) {
35513 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035515 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035516 printf(" %d", n_code);
35517 printf("\n");
35518 }
35519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035520 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035521#endif
35522
Daniel Veillard42595322004-11-08 10:52:06 +000035523 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035524}
35525
35526
35527static int
35528test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035529 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035530
William M. Brack21e4ef22005-01-02 09:53:13 +000035531#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035532 int mem_base;
35533 int ret_val;
35534 int code; /* UCS code point */
35535 int n_code;
35536
35537 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35538 mem_base = xmlMemBlocks();
35539 code = gen_int(n_code, 0);
35540
35541 ret_val = xmlUCSIsCatLt(code);
35542 desret_int(ret_val);
35543 call_tests++;
35544 des_int(n_code, code, 0);
35545 xmlResetLastError();
35546 if (mem_base != xmlMemBlocks()) {
35547 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035549 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035550 printf(" %d", n_code);
35551 printf("\n");
35552 }
35553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035554 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035555#endif
35556
Daniel Veillard42595322004-11-08 10:52:06 +000035557 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035558}
35559
35560
35561static int
35562test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035563 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035564
William M. Brack21e4ef22005-01-02 09:53:13 +000035565#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035566 int mem_base;
35567 int ret_val;
35568 int code; /* UCS code point */
35569 int n_code;
35570
35571 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35572 mem_base = xmlMemBlocks();
35573 code = gen_int(n_code, 0);
35574
35575 ret_val = xmlUCSIsCatLu(code);
35576 desret_int(ret_val);
35577 call_tests++;
35578 des_int(n_code, code, 0);
35579 xmlResetLastError();
35580 if (mem_base != xmlMemBlocks()) {
35581 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035583 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584 printf(" %d", n_code);
35585 printf("\n");
35586 }
35587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035588 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035589#endif
35590
Daniel Veillard42595322004-11-08 10:52:06 +000035591 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035592}
35593
35594
35595static int
35596test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035597 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035598
William M. Brack21e4ef22005-01-02 09:53:13 +000035599#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035600 int mem_base;
35601 int ret_val;
35602 int code; /* UCS code point */
35603 int n_code;
35604
35605 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35606 mem_base = xmlMemBlocks();
35607 code = gen_int(n_code, 0);
35608
35609 ret_val = xmlUCSIsCatM(code);
35610 desret_int(ret_val);
35611 call_tests++;
35612 des_int(n_code, code, 0);
35613 xmlResetLastError();
35614 if (mem_base != xmlMemBlocks()) {
35615 printf("Leak of %d blocks found in xmlUCSIsCatM",
35616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035617 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618 printf(" %d", n_code);
35619 printf("\n");
35620 }
35621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035622 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035623#endif
35624
Daniel Veillard42595322004-11-08 10:52:06 +000035625 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035626}
35627
35628
35629static int
35630test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035631 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035632
William M. Brack21e4ef22005-01-02 09:53:13 +000035633#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035634 int mem_base;
35635 int ret_val;
35636 int code; /* UCS code point */
35637 int n_code;
35638
35639 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35640 mem_base = xmlMemBlocks();
35641 code = gen_int(n_code, 0);
35642
35643 ret_val = xmlUCSIsCatMc(code);
35644 desret_int(ret_val);
35645 call_tests++;
35646 des_int(n_code, code, 0);
35647 xmlResetLastError();
35648 if (mem_base != xmlMemBlocks()) {
35649 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035651 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652 printf(" %d", n_code);
35653 printf("\n");
35654 }
35655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035656 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035657#endif
35658
Daniel Veillard42595322004-11-08 10:52:06 +000035659 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035660}
35661
35662
35663static int
35664test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035665 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035666
William M. Brack21e4ef22005-01-02 09:53:13 +000035667#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035668 int mem_base;
35669 int ret_val;
35670 int code; /* UCS code point */
35671 int n_code;
35672
35673 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35674 mem_base = xmlMemBlocks();
35675 code = gen_int(n_code, 0);
35676
35677 ret_val = xmlUCSIsCatMe(code);
35678 desret_int(ret_val);
35679 call_tests++;
35680 des_int(n_code, code, 0);
35681 xmlResetLastError();
35682 if (mem_base != xmlMemBlocks()) {
35683 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035685 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686 printf(" %d", n_code);
35687 printf("\n");
35688 }
35689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035690 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035691#endif
35692
Daniel Veillard42595322004-11-08 10:52:06 +000035693 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035694}
35695
35696
35697static int
35698test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035699 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035700
William M. Brack21e4ef22005-01-02 09:53:13 +000035701#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035702 int mem_base;
35703 int ret_val;
35704 int code; /* UCS code point */
35705 int n_code;
35706
35707 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35708 mem_base = xmlMemBlocks();
35709 code = gen_int(n_code, 0);
35710
35711 ret_val = xmlUCSIsCatMn(code);
35712 desret_int(ret_val);
35713 call_tests++;
35714 des_int(n_code, code, 0);
35715 xmlResetLastError();
35716 if (mem_base != xmlMemBlocks()) {
35717 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035719 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720 printf(" %d", n_code);
35721 printf("\n");
35722 }
35723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035724 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035725#endif
35726
Daniel Veillard42595322004-11-08 10:52:06 +000035727 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035728}
35729
35730
35731static int
35732test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035733 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035734
William M. Brack21e4ef22005-01-02 09:53:13 +000035735#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035736 int mem_base;
35737 int ret_val;
35738 int code; /* UCS code point */
35739 int n_code;
35740
35741 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35742 mem_base = xmlMemBlocks();
35743 code = gen_int(n_code, 0);
35744
35745 ret_val = xmlUCSIsCatN(code);
35746 desret_int(ret_val);
35747 call_tests++;
35748 des_int(n_code, code, 0);
35749 xmlResetLastError();
35750 if (mem_base != xmlMemBlocks()) {
35751 printf("Leak of %d blocks found in xmlUCSIsCatN",
35752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035753 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754 printf(" %d", n_code);
35755 printf("\n");
35756 }
35757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035758 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035759#endif
35760
Daniel Veillard42595322004-11-08 10:52:06 +000035761 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035762}
35763
35764
35765static int
35766test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035767 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035768
William M. Brack21e4ef22005-01-02 09:53:13 +000035769#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035770 int mem_base;
35771 int ret_val;
35772 int code; /* UCS code point */
35773 int n_code;
35774
35775 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35776 mem_base = xmlMemBlocks();
35777 code = gen_int(n_code, 0);
35778
35779 ret_val = xmlUCSIsCatNd(code);
35780 desret_int(ret_val);
35781 call_tests++;
35782 des_int(n_code, code, 0);
35783 xmlResetLastError();
35784 if (mem_base != xmlMemBlocks()) {
35785 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035787 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788 printf(" %d", n_code);
35789 printf("\n");
35790 }
35791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035792 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035793#endif
35794
Daniel Veillard42595322004-11-08 10:52:06 +000035795 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035796}
35797
35798
35799static int
35800test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035801 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035802
William M. Brack21e4ef22005-01-02 09:53:13 +000035803#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035804 int mem_base;
35805 int ret_val;
35806 int code; /* UCS code point */
35807 int n_code;
35808
35809 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35810 mem_base = xmlMemBlocks();
35811 code = gen_int(n_code, 0);
35812
35813 ret_val = xmlUCSIsCatNl(code);
35814 desret_int(ret_val);
35815 call_tests++;
35816 des_int(n_code, code, 0);
35817 xmlResetLastError();
35818 if (mem_base != xmlMemBlocks()) {
35819 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035821 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822 printf(" %d", n_code);
35823 printf("\n");
35824 }
35825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035826 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035827#endif
35828
Daniel Veillard42595322004-11-08 10:52:06 +000035829 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035830}
35831
35832
35833static int
35834test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035835 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035836
William M. Brack21e4ef22005-01-02 09:53:13 +000035837#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035838 int mem_base;
35839 int ret_val;
35840 int code; /* UCS code point */
35841 int n_code;
35842
35843 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35844 mem_base = xmlMemBlocks();
35845 code = gen_int(n_code, 0);
35846
35847 ret_val = xmlUCSIsCatNo(code);
35848 desret_int(ret_val);
35849 call_tests++;
35850 des_int(n_code, code, 0);
35851 xmlResetLastError();
35852 if (mem_base != xmlMemBlocks()) {
35853 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035855 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856 printf(" %d", n_code);
35857 printf("\n");
35858 }
35859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035860 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035861#endif
35862
Daniel Veillard42595322004-11-08 10:52:06 +000035863 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035864}
35865
35866
35867static int
35868test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035869 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035870
William M. Brack21e4ef22005-01-02 09:53:13 +000035871#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035872 int mem_base;
35873 int ret_val;
35874 int code; /* UCS code point */
35875 int n_code;
35876
35877 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35878 mem_base = xmlMemBlocks();
35879 code = gen_int(n_code, 0);
35880
35881 ret_val = xmlUCSIsCatP(code);
35882 desret_int(ret_val);
35883 call_tests++;
35884 des_int(n_code, code, 0);
35885 xmlResetLastError();
35886 if (mem_base != xmlMemBlocks()) {
35887 printf("Leak of %d blocks found in xmlUCSIsCatP",
35888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035889 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890 printf(" %d", n_code);
35891 printf("\n");
35892 }
35893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035894 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035895#endif
35896
Daniel Veillard42595322004-11-08 10:52:06 +000035897 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035898}
35899
35900
35901static int
35902test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035903 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035904
William M. Brack21e4ef22005-01-02 09:53:13 +000035905#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035906 int mem_base;
35907 int ret_val;
35908 int code; /* UCS code point */
35909 int n_code;
35910
35911 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35912 mem_base = xmlMemBlocks();
35913 code = gen_int(n_code, 0);
35914
35915 ret_val = xmlUCSIsCatPc(code);
35916 desret_int(ret_val);
35917 call_tests++;
35918 des_int(n_code, code, 0);
35919 xmlResetLastError();
35920 if (mem_base != xmlMemBlocks()) {
35921 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035923 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924 printf(" %d", n_code);
35925 printf("\n");
35926 }
35927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035928 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035929#endif
35930
Daniel Veillard42595322004-11-08 10:52:06 +000035931 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035932}
35933
35934
35935static int
35936test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035937 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035938
William M. Brack21e4ef22005-01-02 09:53:13 +000035939#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035940 int mem_base;
35941 int ret_val;
35942 int code; /* UCS code point */
35943 int n_code;
35944
35945 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35946 mem_base = xmlMemBlocks();
35947 code = gen_int(n_code, 0);
35948
35949 ret_val = xmlUCSIsCatPd(code);
35950 desret_int(ret_val);
35951 call_tests++;
35952 des_int(n_code, code, 0);
35953 xmlResetLastError();
35954 if (mem_base != xmlMemBlocks()) {
35955 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035957 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958 printf(" %d", n_code);
35959 printf("\n");
35960 }
35961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035962 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035963#endif
35964
Daniel Veillard42595322004-11-08 10:52:06 +000035965 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035966}
35967
35968
35969static int
35970test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035971 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035972
William M. Brack21e4ef22005-01-02 09:53:13 +000035973#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035974 int mem_base;
35975 int ret_val;
35976 int code; /* UCS code point */
35977 int n_code;
35978
35979 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35980 mem_base = xmlMemBlocks();
35981 code = gen_int(n_code, 0);
35982
35983 ret_val = xmlUCSIsCatPe(code);
35984 desret_int(ret_val);
35985 call_tests++;
35986 des_int(n_code, code, 0);
35987 xmlResetLastError();
35988 if (mem_base != xmlMemBlocks()) {
35989 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035991 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992 printf(" %d", n_code);
35993 printf("\n");
35994 }
35995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035996 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035997#endif
35998
Daniel Veillard42595322004-11-08 10:52:06 +000035999 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036000}
36001
36002
36003static int
36004test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036005 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036006
William M. Brack21e4ef22005-01-02 09:53:13 +000036007#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036008 int mem_base;
36009 int ret_val;
36010 int code; /* UCS code point */
36011 int n_code;
36012
36013 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36014 mem_base = xmlMemBlocks();
36015 code = gen_int(n_code, 0);
36016
36017 ret_val = xmlUCSIsCatPf(code);
36018 desret_int(ret_val);
36019 call_tests++;
36020 des_int(n_code, code, 0);
36021 xmlResetLastError();
36022 if (mem_base != xmlMemBlocks()) {
36023 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036025 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026 printf(" %d", n_code);
36027 printf("\n");
36028 }
36029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036030 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036031#endif
36032
Daniel Veillard42595322004-11-08 10:52:06 +000036033 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036034}
36035
36036
36037static int
36038test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036039 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036040
William M. Brack21e4ef22005-01-02 09:53:13 +000036041#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036042 int mem_base;
36043 int ret_val;
36044 int code; /* UCS code point */
36045 int n_code;
36046
36047 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36048 mem_base = xmlMemBlocks();
36049 code = gen_int(n_code, 0);
36050
36051 ret_val = xmlUCSIsCatPi(code);
36052 desret_int(ret_val);
36053 call_tests++;
36054 des_int(n_code, code, 0);
36055 xmlResetLastError();
36056 if (mem_base != xmlMemBlocks()) {
36057 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036059 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060 printf(" %d", n_code);
36061 printf("\n");
36062 }
36063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036064 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036065#endif
36066
Daniel Veillard42595322004-11-08 10:52:06 +000036067 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036068}
36069
36070
36071static int
36072test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036073 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036074
William M. Brack21e4ef22005-01-02 09:53:13 +000036075#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036076 int mem_base;
36077 int ret_val;
36078 int code; /* UCS code point */
36079 int n_code;
36080
36081 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36082 mem_base = xmlMemBlocks();
36083 code = gen_int(n_code, 0);
36084
36085 ret_val = xmlUCSIsCatPo(code);
36086 desret_int(ret_val);
36087 call_tests++;
36088 des_int(n_code, code, 0);
36089 xmlResetLastError();
36090 if (mem_base != xmlMemBlocks()) {
36091 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036093 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094 printf(" %d", n_code);
36095 printf("\n");
36096 }
36097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036098 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036099#endif
36100
Daniel Veillard42595322004-11-08 10:52:06 +000036101 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036102}
36103
36104
36105static int
36106test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036107 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036108
William M. Brack21e4ef22005-01-02 09:53:13 +000036109#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036110 int mem_base;
36111 int ret_val;
36112 int code; /* UCS code point */
36113 int n_code;
36114
36115 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36116 mem_base = xmlMemBlocks();
36117 code = gen_int(n_code, 0);
36118
36119 ret_val = xmlUCSIsCatPs(code);
36120 desret_int(ret_val);
36121 call_tests++;
36122 des_int(n_code, code, 0);
36123 xmlResetLastError();
36124 if (mem_base != xmlMemBlocks()) {
36125 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036127 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128 printf(" %d", n_code);
36129 printf("\n");
36130 }
36131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036132 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036133#endif
36134
Daniel Veillard42595322004-11-08 10:52:06 +000036135 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036136}
36137
36138
36139static int
36140test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036141 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036142
William M. Brack21e4ef22005-01-02 09:53:13 +000036143#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036144 int mem_base;
36145 int ret_val;
36146 int code; /* UCS code point */
36147 int n_code;
36148
36149 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36150 mem_base = xmlMemBlocks();
36151 code = gen_int(n_code, 0);
36152
36153 ret_val = xmlUCSIsCatS(code);
36154 desret_int(ret_val);
36155 call_tests++;
36156 des_int(n_code, code, 0);
36157 xmlResetLastError();
36158 if (mem_base != xmlMemBlocks()) {
36159 printf("Leak of %d blocks found in xmlUCSIsCatS",
36160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036161 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162 printf(" %d", n_code);
36163 printf("\n");
36164 }
36165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036166 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036167#endif
36168
Daniel Veillard42595322004-11-08 10:52:06 +000036169 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036170}
36171
36172
36173static int
36174test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036175 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036176
William M. Brack21e4ef22005-01-02 09:53:13 +000036177#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036178 int mem_base;
36179 int ret_val;
36180 int code; /* UCS code point */
36181 int n_code;
36182
36183 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36184 mem_base = xmlMemBlocks();
36185 code = gen_int(n_code, 0);
36186
36187 ret_val = xmlUCSIsCatSc(code);
36188 desret_int(ret_val);
36189 call_tests++;
36190 des_int(n_code, code, 0);
36191 xmlResetLastError();
36192 if (mem_base != xmlMemBlocks()) {
36193 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036195 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036196 printf(" %d", n_code);
36197 printf("\n");
36198 }
36199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036200 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036201#endif
36202
Daniel Veillard42595322004-11-08 10:52:06 +000036203 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036204}
36205
36206
36207static int
36208test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036209 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036210
William M. Brack21e4ef22005-01-02 09:53:13 +000036211#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036212 int mem_base;
36213 int ret_val;
36214 int code; /* UCS code point */
36215 int n_code;
36216
36217 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36218 mem_base = xmlMemBlocks();
36219 code = gen_int(n_code, 0);
36220
36221 ret_val = xmlUCSIsCatSk(code);
36222 desret_int(ret_val);
36223 call_tests++;
36224 des_int(n_code, code, 0);
36225 xmlResetLastError();
36226 if (mem_base != xmlMemBlocks()) {
36227 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036229 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036230 printf(" %d", n_code);
36231 printf("\n");
36232 }
36233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036234 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036235#endif
36236
Daniel Veillard42595322004-11-08 10:52:06 +000036237 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036238}
36239
36240
36241static int
36242test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036243 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036244
William M. Brack21e4ef22005-01-02 09:53:13 +000036245#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036246 int mem_base;
36247 int ret_val;
36248 int code; /* UCS code point */
36249 int n_code;
36250
36251 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36252 mem_base = xmlMemBlocks();
36253 code = gen_int(n_code, 0);
36254
36255 ret_val = xmlUCSIsCatSm(code);
36256 desret_int(ret_val);
36257 call_tests++;
36258 des_int(n_code, code, 0);
36259 xmlResetLastError();
36260 if (mem_base != xmlMemBlocks()) {
36261 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036263 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036264 printf(" %d", n_code);
36265 printf("\n");
36266 }
36267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036268 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036269#endif
36270
Daniel Veillard42595322004-11-08 10:52:06 +000036271 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036272}
36273
36274
36275static int
36276test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036277 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036278
William M. Brack21e4ef22005-01-02 09:53:13 +000036279#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036280 int mem_base;
36281 int ret_val;
36282 int code; /* UCS code point */
36283 int n_code;
36284
36285 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36286 mem_base = xmlMemBlocks();
36287 code = gen_int(n_code, 0);
36288
36289 ret_val = xmlUCSIsCatSo(code);
36290 desret_int(ret_val);
36291 call_tests++;
36292 des_int(n_code, code, 0);
36293 xmlResetLastError();
36294 if (mem_base != xmlMemBlocks()) {
36295 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036297 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036298 printf(" %d", n_code);
36299 printf("\n");
36300 }
36301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036302 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036303#endif
36304
Daniel Veillard42595322004-11-08 10:52:06 +000036305 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036306}
36307
36308
36309static int
36310test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036311 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036312
William M. Brack21e4ef22005-01-02 09:53:13 +000036313#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036314 int mem_base;
36315 int ret_val;
36316 int code; /* UCS code point */
36317 int n_code;
36318
36319 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36320 mem_base = xmlMemBlocks();
36321 code = gen_int(n_code, 0);
36322
36323 ret_val = xmlUCSIsCatZ(code);
36324 desret_int(ret_val);
36325 call_tests++;
36326 des_int(n_code, code, 0);
36327 xmlResetLastError();
36328 if (mem_base != xmlMemBlocks()) {
36329 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036331 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036332 printf(" %d", n_code);
36333 printf("\n");
36334 }
36335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036336 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036337#endif
36338
Daniel Veillard42595322004-11-08 10:52:06 +000036339 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036340}
36341
36342
36343static int
36344test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036345 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036346
William M. Brack21e4ef22005-01-02 09:53:13 +000036347#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036348 int mem_base;
36349 int ret_val;
36350 int code; /* UCS code point */
36351 int n_code;
36352
36353 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36354 mem_base = xmlMemBlocks();
36355 code = gen_int(n_code, 0);
36356
36357 ret_val = xmlUCSIsCatZl(code);
36358 desret_int(ret_val);
36359 call_tests++;
36360 des_int(n_code, code, 0);
36361 xmlResetLastError();
36362 if (mem_base != xmlMemBlocks()) {
36363 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036365 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036366 printf(" %d", n_code);
36367 printf("\n");
36368 }
36369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036370 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036371#endif
36372
Daniel Veillard42595322004-11-08 10:52:06 +000036373 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036374}
36375
36376
36377static int
36378test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036379 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036380
William M. Brack21e4ef22005-01-02 09:53:13 +000036381#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036382 int mem_base;
36383 int ret_val;
36384 int code; /* UCS code point */
36385 int n_code;
36386
36387 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36388 mem_base = xmlMemBlocks();
36389 code = gen_int(n_code, 0);
36390
36391 ret_val = xmlUCSIsCatZp(code);
36392 desret_int(ret_val);
36393 call_tests++;
36394 des_int(n_code, code, 0);
36395 xmlResetLastError();
36396 if (mem_base != xmlMemBlocks()) {
36397 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036399 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036400 printf(" %d", n_code);
36401 printf("\n");
36402 }
36403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036404 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036405#endif
36406
Daniel Veillard42595322004-11-08 10:52:06 +000036407 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036408}
36409
36410
36411static int
36412test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036413 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036414
William M. Brack21e4ef22005-01-02 09:53:13 +000036415#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036416 int mem_base;
36417 int ret_val;
36418 int code; /* UCS code point */
36419 int n_code;
36420
36421 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36422 mem_base = xmlMemBlocks();
36423 code = gen_int(n_code, 0);
36424
36425 ret_val = xmlUCSIsCatZs(code);
36426 desret_int(ret_val);
36427 call_tests++;
36428 des_int(n_code, code, 0);
36429 xmlResetLastError();
36430 if (mem_base != xmlMemBlocks()) {
36431 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036433 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036434 printf(" %d", n_code);
36435 printf("\n");
36436 }
36437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036438 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036439#endif
36440
Daniel Veillard42595322004-11-08 10:52:06 +000036441 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036442}
36443
36444
36445static int
36446test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036447 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036448
William M. Brack21e4ef22005-01-02 09:53:13 +000036449#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036450 int mem_base;
36451 int ret_val;
36452 int code; /* UCS code point */
36453 int n_code;
36454
36455 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36456 mem_base = xmlMemBlocks();
36457 code = gen_int(n_code, 0);
36458
36459 ret_val = xmlUCSIsCherokee(code);
36460 desret_int(ret_val);
36461 call_tests++;
36462 des_int(n_code, code, 0);
36463 xmlResetLastError();
36464 if (mem_base != xmlMemBlocks()) {
36465 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036467 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036468 printf(" %d", n_code);
36469 printf("\n");
36470 }
36471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036472 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036473#endif
36474
Daniel Veillard42595322004-11-08 10:52:06 +000036475 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036476}
36477
36478
36479static int
36480test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036481 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036482
William M. Brack21e4ef22005-01-02 09:53:13 +000036483#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036484 int mem_base;
36485 int ret_val;
36486 int code; /* UCS code point */
36487 int n_code;
36488
36489 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36490 mem_base = xmlMemBlocks();
36491 code = gen_int(n_code, 0);
36492
36493 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36494 desret_int(ret_val);
36495 call_tests++;
36496 des_int(n_code, code, 0);
36497 xmlResetLastError();
36498 if (mem_base != xmlMemBlocks()) {
36499 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036501 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036502 printf(" %d", n_code);
36503 printf("\n");
36504 }
36505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036506 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036507#endif
36508
Daniel Veillard42595322004-11-08 10:52:06 +000036509 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036510}
36511
36512
36513static int
36514test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036515 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036516
William M. Brack21e4ef22005-01-02 09:53:13 +000036517#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036518 int mem_base;
36519 int ret_val;
36520 int code; /* UCS code point */
36521 int n_code;
36522
36523 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36524 mem_base = xmlMemBlocks();
36525 code = gen_int(n_code, 0);
36526
36527 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36528 desret_int(ret_val);
36529 call_tests++;
36530 des_int(n_code, code, 0);
36531 xmlResetLastError();
36532 if (mem_base != xmlMemBlocks()) {
36533 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036535 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036536 printf(" %d", n_code);
36537 printf("\n");
36538 }
36539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036540 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036541#endif
36542
Daniel Veillard42595322004-11-08 10:52:06 +000036543 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036544}
36545
36546
36547static int
36548test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036549 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036550
William M. Brack21e4ef22005-01-02 09:53:13 +000036551#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036552 int mem_base;
36553 int ret_val;
36554 int code; /* UCS code point */
36555 int n_code;
36556
36557 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36558 mem_base = xmlMemBlocks();
36559 code = gen_int(n_code, 0);
36560
36561 ret_val = xmlUCSIsCombiningHalfMarks(code);
36562 desret_int(ret_val);
36563 call_tests++;
36564 des_int(n_code, code, 0);
36565 xmlResetLastError();
36566 if (mem_base != xmlMemBlocks()) {
36567 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036569 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036570 printf(" %d", n_code);
36571 printf("\n");
36572 }
36573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036574 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036575#endif
36576
Daniel Veillard42595322004-11-08 10:52:06 +000036577 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036578}
36579
36580
36581static int
36582test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036583 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036584
William M. Brack21e4ef22005-01-02 09:53:13 +000036585#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036586 int mem_base;
36587 int ret_val;
36588 int code; /* UCS code point */
36589 int n_code;
36590
36591 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36592 mem_base = xmlMemBlocks();
36593 code = gen_int(n_code, 0);
36594
36595 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36596 desret_int(ret_val);
36597 call_tests++;
36598 des_int(n_code, code, 0);
36599 xmlResetLastError();
36600 if (mem_base != xmlMemBlocks()) {
36601 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036603 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036604 printf(" %d", n_code);
36605 printf("\n");
36606 }
36607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036608 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036609#endif
36610
Daniel Veillard42595322004-11-08 10:52:06 +000036611 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036612}
36613
36614
36615static int
36616test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036617 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036618
William M. Brack21e4ef22005-01-02 09:53:13 +000036619#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036620 int mem_base;
36621 int ret_val;
36622 int code; /* UCS code point */
36623 int n_code;
36624
36625 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36626 mem_base = xmlMemBlocks();
36627 code = gen_int(n_code, 0);
36628
36629 ret_val = xmlUCSIsControlPictures(code);
36630 desret_int(ret_val);
36631 call_tests++;
36632 des_int(n_code, code, 0);
36633 xmlResetLastError();
36634 if (mem_base != xmlMemBlocks()) {
36635 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036637 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036638 printf(" %d", n_code);
36639 printf("\n");
36640 }
36641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036642 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036643#endif
36644
Daniel Veillard42595322004-11-08 10:52:06 +000036645 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036646}
36647
36648
36649static int
36650test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036651 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036652
William M. Brack21e4ef22005-01-02 09:53:13 +000036653#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036654 int mem_base;
36655 int ret_val;
36656 int code; /* UCS code point */
36657 int n_code;
36658
36659 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36660 mem_base = xmlMemBlocks();
36661 code = gen_int(n_code, 0);
36662
36663 ret_val = xmlUCSIsCurrencySymbols(code);
36664 desret_int(ret_val);
36665 call_tests++;
36666 des_int(n_code, code, 0);
36667 xmlResetLastError();
36668 if (mem_base != xmlMemBlocks()) {
36669 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036671 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036672 printf(" %d", n_code);
36673 printf("\n");
36674 }
36675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036676 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036677#endif
36678
Daniel Veillard42595322004-11-08 10:52:06 +000036679 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036680}
36681
36682
36683static int
36684test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036685 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036686
William M. Brack21e4ef22005-01-02 09:53:13 +000036687#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036688 int mem_base;
36689 int ret_val;
36690 int code; /* UCS code point */
36691 int n_code;
36692
36693 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36694 mem_base = xmlMemBlocks();
36695 code = gen_int(n_code, 0);
36696
36697 ret_val = xmlUCSIsCypriotSyllabary(code);
36698 desret_int(ret_val);
36699 call_tests++;
36700 des_int(n_code, code, 0);
36701 xmlResetLastError();
36702 if (mem_base != xmlMemBlocks()) {
36703 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036705 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036706 printf(" %d", n_code);
36707 printf("\n");
36708 }
36709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036710 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036711#endif
36712
Daniel Veillard42595322004-11-08 10:52:06 +000036713 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036714}
36715
36716
36717static int
36718test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036719 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036720
William M. Brack21e4ef22005-01-02 09:53:13 +000036721#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036722 int mem_base;
36723 int ret_val;
36724 int code; /* UCS code point */
36725 int n_code;
36726
36727 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36728 mem_base = xmlMemBlocks();
36729 code = gen_int(n_code, 0);
36730
36731 ret_val = xmlUCSIsCyrillic(code);
36732 desret_int(ret_val);
36733 call_tests++;
36734 des_int(n_code, code, 0);
36735 xmlResetLastError();
36736 if (mem_base != xmlMemBlocks()) {
36737 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036739 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036740 printf(" %d", n_code);
36741 printf("\n");
36742 }
36743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036744 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036745#endif
36746
Daniel Veillard42595322004-11-08 10:52:06 +000036747 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036748}
36749
36750
36751static int
36752test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036753 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036754
William M. Brack21e4ef22005-01-02 09:53:13 +000036755#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036756 int mem_base;
36757 int ret_val;
36758 int code; /* UCS code point */
36759 int n_code;
36760
36761 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36762 mem_base = xmlMemBlocks();
36763 code = gen_int(n_code, 0);
36764
36765 ret_val = xmlUCSIsCyrillicSupplement(code);
36766 desret_int(ret_val);
36767 call_tests++;
36768 des_int(n_code, code, 0);
36769 xmlResetLastError();
36770 if (mem_base != xmlMemBlocks()) {
36771 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036773 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036774 printf(" %d", n_code);
36775 printf("\n");
36776 }
36777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036778 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036779#endif
36780
Daniel Veillard42595322004-11-08 10:52:06 +000036781 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036782}
36783
36784
36785static int
36786test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036787 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036788
William M. Brack21e4ef22005-01-02 09:53:13 +000036789#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036790 int mem_base;
36791 int ret_val;
36792 int code; /* UCS code point */
36793 int n_code;
36794
36795 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36796 mem_base = xmlMemBlocks();
36797 code = gen_int(n_code, 0);
36798
36799 ret_val = xmlUCSIsDeseret(code);
36800 desret_int(ret_val);
36801 call_tests++;
36802 des_int(n_code, code, 0);
36803 xmlResetLastError();
36804 if (mem_base != xmlMemBlocks()) {
36805 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036807 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036808 printf(" %d", n_code);
36809 printf("\n");
36810 }
36811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036812 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036813#endif
36814
Daniel Veillard42595322004-11-08 10:52:06 +000036815 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036816}
36817
36818
36819static int
36820test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036821 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036822
William M. Brack21e4ef22005-01-02 09:53:13 +000036823#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036824 int mem_base;
36825 int ret_val;
36826 int code; /* UCS code point */
36827 int n_code;
36828
36829 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36830 mem_base = xmlMemBlocks();
36831 code = gen_int(n_code, 0);
36832
36833 ret_val = xmlUCSIsDevanagari(code);
36834 desret_int(ret_val);
36835 call_tests++;
36836 des_int(n_code, code, 0);
36837 xmlResetLastError();
36838 if (mem_base != xmlMemBlocks()) {
36839 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036841 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036842 printf(" %d", n_code);
36843 printf("\n");
36844 }
36845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036846 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036847#endif
36848
Daniel Veillard42595322004-11-08 10:52:06 +000036849 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036850}
36851
36852
36853static int
36854test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036855 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036856
William M. Brack21e4ef22005-01-02 09:53:13 +000036857#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036858 int mem_base;
36859 int ret_val;
36860 int code; /* UCS code point */
36861 int n_code;
36862
36863 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36864 mem_base = xmlMemBlocks();
36865 code = gen_int(n_code, 0);
36866
36867 ret_val = xmlUCSIsDingbats(code);
36868 desret_int(ret_val);
36869 call_tests++;
36870 des_int(n_code, code, 0);
36871 xmlResetLastError();
36872 if (mem_base != xmlMemBlocks()) {
36873 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036875 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036876 printf(" %d", n_code);
36877 printf("\n");
36878 }
36879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036880 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036881#endif
36882
Daniel Veillard42595322004-11-08 10:52:06 +000036883 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036884}
36885
36886
36887static int
36888test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036889 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036890
William M. Brack21e4ef22005-01-02 09:53:13 +000036891#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036892 int mem_base;
36893 int ret_val;
36894 int code; /* UCS code point */
36895 int n_code;
36896
36897 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36898 mem_base = xmlMemBlocks();
36899 code = gen_int(n_code, 0);
36900
36901 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36902 desret_int(ret_val);
36903 call_tests++;
36904 des_int(n_code, code, 0);
36905 xmlResetLastError();
36906 if (mem_base != xmlMemBlocks()) {
36907 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036909 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036910 printf(" %d", n_code);
36911 printf("\n");
36912 }
36913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036914 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036915#endif
36916
Daniel Veillard42595322004-11-08 10:52:06 +000036917 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036918}
36919
36920
36921static int
36922test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036923 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036924
William M. Brack21e4ef22005-01-02 09:53:13 +000036925#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036926 int mem_base;
36927 int ret_val;
36928 int code; /* UCS code point */
36929 int n_code;
36930
36931 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36932 mem_base = xmlMemBlocks();
36933 code = gen_int(n_code, 0);
36934
36935 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36936 desret_int(ret_val);
36937 call_tests++;
36938 des_int(n_code, code, 0);
36939 xmlResetLastError();
36940 if (mem_base != xmlMemBlocks()) {
36941 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036943 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036944 printf(" %d", n_code);
36945 printf("\n");
36946 }
36947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036948 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036949#endif
36950
Daniel Veillard42595322004-11-08 10:52:06 +000036951 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036952}
36953
36954
36955static int
36956test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036957 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036958
William M. Brack21e4ef22005-01-02 09:53:13 +000036959#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036960 int mem_base;
36961 int ret_val;
36962 int code; /* UCS code point */
36963 int n_code;
36964
36965 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36966 mem_base = xmlMemBlocks();
36967 code = gen_int(n_code, 0);
36968
36969 ret_val = xmlUCSIsEthiopic(code);
36970 desret_int(ret_val);
36971 call_tests++;
36972 des_int(n_code, code, 0);
36973 xmlResetLastError();
36974 if (mem_base != xmlMemBlocks()) {
36975 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036977 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036978 printf(" %d", n_code);
36979 printf("\n");
36980 }
36981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036982 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036983#endif
36984
Daniel Veillard42595322004-11-08 10:52:06 +000036985 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036986}
36987
36988
36989static int
36990test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036991 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036992
William M. Brack21e4ef22005-01-02 09:53:13 +000036993#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036994 int mem_base;
36995 int ret_val;
36996 int code; /* UCS code point */
36997 int n_code;
36998
36999 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37000 mem_base = xmlMemBlocks();
37001 code = gen_int(n_code, 0);
37002
37003 ret_val = xmlUCSIsGeneralPunctuation(code);
37004 desret_int(ret_val);
37005 call_tests++;
37006 des_int(n_code, code, 0);
37007 xmlResetLastError();
37008 if (mem_base != xmlMemBlocks()) {
37009 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037011 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037012 printf(" %d", n_code);
37013 printf("\n");
37014 }
37015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037016 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037017#endif
37018
Daniel Veillard42595322004-11-08 10:52:06 +000037019 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037020}
37021
37022
37023static int
37024test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037025 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037026
William M. Brack21e4ef22005-01-02 09:53:13 +000037027#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037028 int mem_base;
37029 int ret_val;
37030 int code; /* UCS code point */
37031 int n_code;
37032
37033 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37034 mem_base = xmlMemBlocks();
37035 code = gen_int(n_code, 0);
37036
37037 ret_val = xmlUCSIsGeometricShapes(code);
37038 desret_int(ret_val);
37039 call_tests++;
37040 des_int(n_code, code, 0);
37041 xmlResetLastError();
37042 if (mem_base != xmlMemBlocks()) {
37043 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037045 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037046 printf(" %d", n_code);
37047 printf("\n");
37048 }
37049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037050 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037051#endif
37052
Daniel Veillard42595322004-11-08 10:52:06 +000037053 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037054}
37055
37056
37057static int
37058test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037059 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037060
William M. Brack21e4ef22005-01-02 09:53:13 +000037061#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037062 int mem_base;
37063 int ret_val;
37064 int code; /* UCS code point */
37065 int n_code;
37066
37067 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37068 mem_base = xmlMemBlocks();
37069 code = gen_int(n_code, 0);
37070
37071 ret_val = xmlUCSIsGeorgian(code);
37072 desret_int(ret_val);
37073 call_tests++;
37074 des_int(n_code, code, 0);
37075 xmlResetLastError();
37076 if (mem_base != xmlMemBlocks()) {
37077 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037079 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037080 printf(" %d", n_code);
37081 printf("\n");
37082 }
37083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037084 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037085#endif
37086
Daniel Veillard42595322004-11-08 10:52:06 +000037087 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037088}
37089
37090
37091static int
37092test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037093 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037094
William M. Brack21e4ef22005-01-02 09:53:13 +000037095#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037096 int mem_base;
37097 int ret_val;
37098 int code; /* UCS code point */
37099 int n_code;
37100
37101 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37102 mem_base = xmlMemBlocks();
37103 code = gen_int(n_code, 0);
37104
37105 ret_val = xmlUCSIsGothic(code);
37106 desret_int(ret_val);
37107 call_tests++;
37108 des_int(n_code, code, 0);
37109 xmlResetLastError();
37110 if (mem_base != xmlMemBlocks()) {
37111 printf("Leak of %d blocks found in xmlUCSIsGothic",
37112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037113 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037114 printf(" %d", n_code);
37115 printf("\n");
37116 }
37117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037118 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037119#endif
37120
Daniel Veillard42595322004-11-08 10:52:06 +000037121 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037122}
37123
37124
37125static int
37126test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037127 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037128
William M. Brack21e4ef22005-01-02 09:53:13 +000037129#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037130 int mem_base;
37131 int ret_val;
37132 int code; /* UCS code point */
37133 int n_code;
37134
37135 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37136 mem_base = xmlMemBlocks();
37137 code = gen_int(n_code, 0);
37138
37139 ret_val = xmlUCSIsGreek(code);
37140 desret_int(ret_val);
37141 call_tests++;
37142 des_int(n_code, code, 0);
37143 xmlResetLastError();
37144 if (mem_base != xmlMemBlocks()) {
37145 printf("Leak of %d blocks found in xmlUCSIsGreek",
37146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037147 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037148 printf(" %d", n_code);
37149 printf("\n");
37150 }
37151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037152 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037153#endif
37154
Daniel Veillard42595322004-11-08 10:52:06 +000037155 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037156}
37157
37158
37159static int
37160test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037161 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037162
William M. Brack21e4ef22005-01-02 09:53:13 +000037163#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037164 int mem_base;
37165 int ret_val;
37166 int code; /* UCS code point */
37167 int n_code;
37168
37169 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37170 mem_base = xmlMemBlocks();
37171 code = gen_int(n_code, 0);
37172
37173 ret_val = xmlUCSIsGreekExtended(code);
37174 desret_int(ret_val);
37175 call_tests++;
37176 des_int(n_code, code, 0);
37177 xmlResetLastError();
37178 if (mem_base != xmlMemBlocks()) {
37179 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037181 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037182 printf(" %d", n_code);
37183 printf("\n");
37184 }
37185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037186 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037187#endif
37188
Daniel Veillard42595322004-11-08 10:52:06 +000037189 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037190}
37191
37192
37193static int
37194test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037195 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037196
William M. Brack21e4ef22005-01-02 09:53:13 +000037197#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037198 int mem_base;
37199 int ret_val;
37200 int code; /* UCS code point */
37201 int n_code;
37202
37203 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37204 mem_base = xmlMemBlocks();
37205 code = gen_int(n_code, 0);
37206
37207 ret_val = xmlUCSIsGreekandCoptic(code);
37208 desret_int(ret_val);
37209 call_tests++;
37210 des_int(n_code, code, 0);
37211 xmlResetLastError();
37212 if (mem_base != xmlMemBlocks()) {
37213 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037215 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037216 printf(" %d", n_code);
37217 printf("\n");
37218 }
37219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037220 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037221#endif
37222
Daniel Veillard42595322004-11-08 10:52:06 +000037223 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037224}
37225
37226
37227static int
37228test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037229 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037230
William M. Brack21e4ef22005-01-02 09:53:13 +000037231#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037232 int mem_base;
37233 int ret_val;
37234 int code; /* UCS code point */
37235 int n_code;
37236
37237 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37238 mem_base = xmlMemBlocks();
37239 code = gen_int(n_code, 0);
37240
37241 ret_val = xmlUCSIsGujarati(code);
37242 desret_int(ret_val);
37243 call_tests++;
37244 des_int(n_code, code, 0);
37245 xmlResetLastError();
37246 if (mem_base != xmlMemBlocks()) {
37247 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037249 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037250 printf(" %d", n_code);
37251 printf("\n");
37252 }
37253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037254 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037255#endif
37256
Daniel Veillard42595322004-11-08 10:52:06 +000037257 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037258}
37259
37260
37261static int
37262test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037263 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037264
William M. Brack21e4ef22005-01-02 09:53:13 +000037265#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037266 int mem_base;
37267 int ret_val;
37268 int code; /* UCS code point */
37269 int n_code;
37270
37271 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37272 mem_base = xmlMemBlocks();
37273 code = gen_int(n_code, 0);
37274
37275 ret_val = xmlUCSIsGurmukhi(code);
37276 desret_int(ret_val);
37277 call_tests++;
37278 des_int(n_code, code, 0);
37279 xmlResetLastError();
37280 if (mem_base != xmlMemBlocks()) {
37281 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037283 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037284 printf(" %d", n_code);
37285 printf("\n");
37286 }
37287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037288 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037289#endif
37290
Daniel Veillard42595322004-11-08 10:52:06 +000037291 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037292}
37293
37294
37295static int
37296test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037297 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037298
William M. Brack21e4ef22005-01-02 09:53:13 +000037299#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037300 int mem_base;
37301 int ret_val;
37302 int code; /* UCS code point */
37303 int n_code;
37304
37305 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37306 mem_base = xmlMemBlocks();
37307 code = gen_int(n_code, 0);
37308
37309 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37310 desret_int(ret_val);
37311 call_tests++;
37312 des_int(n_code, code, 0);
37313 xmlResetLastError();
37314 if (mem_base != xmlMemBlocks()) {
37315 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037317 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037318 printf(" %d", n_code);
37319 printf("\n");
37320 }
37321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037322 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037323#endif
37324
Daniel Veillard42595322004-11-08 10:52:06 +000037325 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037326}
37327
37328
37329static int
37330test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037331 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037332
William M. Brack21e4ef22005-01-02 09:53:13 +000037333#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037334 int mem_base;
37335 int ret_val;
37336 int code; /* UCS code point */
37337 int n_code;
37338
37339 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37340 mem_base = xmlMemBlocks();
37341 code = gen_int(n_code, 0);
37342
37343 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37344 desret_int(ret_val);
37345 call_tests++;
37346 des_int(n_code, code, 0);
37347 xmlResetLastError();
37348 if (mem_base != xmlMemBlocks()) {
37349 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037351 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037352 printf(" %d", n_code);
37353 printf("\n");
37354 }
37355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037356 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037357#endif
37358
Daniel Veillard42595322004-11-08 10:52:06 +000037359 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037360}
37361
37362
37363static int
37364test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037365 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037366
William M. Brack21e4ef22005-01-02 09:53:13 +000037367#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037368 int mem_base;
37369 int ret_val;
37370 int code; /* UCS code point */
37371 int n_code;
37372
37373 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37374 mem_base = xmlMemBlocks();
37375 code = gen_int(n_code, 0);
37376
37377 ret_val = xmlUCSIsHangulJamo(code);
37378 desret_int(ret_val);
37379 call_tests++;
37380 des_int(n_code, code, 0);
37381 xmlResetLastError();
37382 if (mem_base != xmlMemBlocks()) {
37383 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037385 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037386 printf(" %d", n_code);
37387 printf("\n");
37388 }
37389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037390 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037391#endif
37392
Daniel Veillard42595322004-11-08 10:52:06 +000037393 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037394}
37395
37396
37397static int
37398test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037399 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037400
William M. Brack21e4ef22005-01-02 09:53:13 +000037401#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037402 int mem_base;
37403 int ret_val;
37404 int code; /* UCS code point */
37405 int n_code;
37406
37407 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37408 mem_base = xmlMemBlocks();
37409 code = gen_int(n_code, 0);
37410
37411 ret_val = xmlUCSIsHangulSyllables(code);
37412 desret_int(ret_val);
37413 call_tests++;
37414 des_int(n_code, code, 0);
37415 xmlResetLastError();
37416 if (mem_base != xmlMemBlocks()) {
37417 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037419 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037420 printf(" %d", n_code);
37421 printf("\n");
37422 }
37423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037424 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037425#endif
37426
Daniel Veillard42595322004-11-08 10:52:06 +000037427 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037428}
37429
37430
37431static int
37432test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037433 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037434
William M. Brack21e4ef22005-01-02 09:53:13 +000037435#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037436 int mem_base;
37437 int ret_val;
37438 int code; /* UCS code point */
37439 int n_code;
37440
37441 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37442 mem_base = xmlMemBlocks();
37443 code = gen_int(n_code, 0);
37444
37445 ret_val = xmlUCSIsHanunoo(code);
37446 desret_int(ret_val);
37447 call_tests++;
37448 des_int(n_code, code, 0);
37449 xmlResetLastError();
37450 if (mem_base != xmlMemBlocks()) {
37451 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037453 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037454 printf(" %d", n_code);
37455 printf("\n");
37456 }
37457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037458 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037459#endif
37460
Daniel Veillard42595322004-11-08 10:52:06 +000037461 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037462}
37463
37464
37465static int
37466test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037467 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037468
William M. Brack21e4ef22005-01-02 09:53:13 +000037469#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037470 int mem_base;
37471 int ret_val;
37472 int code; /* UCS code point */
37473 int n_code;
37474
37475 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37476 mem_base = xmlMemBlocks();
37477 code = gen_int(n_code, 0);
37478
37479 ret_val = xmlUCSIsHebrew(code);
37480 desret_int(ret_val);
37481 call_tests++;
37482 des_int(n_code, code, 0);
37483 xmlResetLastError();
37484 if (mem_base != xmlMemBlocks()) {
37485 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037487 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037488 printf(" %d", n_code);
37489 printf("\n");
37490 }
37491 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037492 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037493#endif
37494
Daniel Veillard42595322004-11-08 10:52:06 +000037495 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037496}
37497
37498
37499static int
37500test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037501 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037502
William M. Brack21e4ef22005-01-02 09:53:13 +000037503#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037504 int mem_base;
37505 int ret_val;
37506 int code; /* UCS code point */
37507 int n_code;
37508
37509 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37510 mem_base = xmlMemBlocks();
37511 code = gen_int(n_code, 0);
37512
37513 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37514 desret_int(ret_val);
37515 call_tests++;
37516 des_int(n_code, code, 0);
37517 xmlResetLastError();
37518 if (mem_base != xmlMemBlocks()) {
37519 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037521 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037522 printf(" %d", n_code);
37523 printf("\n");
37524 }
37525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037526 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037527#endif
37528
Daniel Veillard42595322004-11-08 10:52:06 +000037529 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037530}
37531
37532
37533static int
37534test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037535 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037536
William M. Brack21e4ef22005-01-02 09:53:13 +000037537#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037538 int mem_base;
37539 int ret_val;
37540 int code; /* UCS code point */
37541 int n_code;
37542
37543 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37544 mem_base = xmlMemBlocks();
37545 code = gen_int(n_code, 0);
37546
37547 ret_val = xmlUCSIsHighSurrogates(code);
37548 desret_int(ret_val);
37549 call_tests++;
37550 des_int(n_code, code, 0);
37551 xmlResetLastError();
37552 if (mem_base != xmlMemBlocks()) {
37553 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037555 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037556 printf(" %d", n_code);
37557 printf("\n");
37558 }
37559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037560 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037561#endif
37562
Daniel Veillard42595322004-11-08 10:52:06 +000037563 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037564}
37565
37566
37567static int
37568test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037569 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037570
William M. Brack21e4ef22005-01-02 09:53:13 +000037571#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037572 int mem_base;
37573 int ret_val;
37574 int code; /* UCS code point */
37575 int n_code;
37576
37577 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37578 mem_base = xmlMemBlocks();
37579 code = gen_int(n_code, 0);
37580
37581 ret_val = xmlUCSIsHiragana(code);
37582 desret_int(ret_val);
37583 call_tests++;
37584 des_int(n_code, code, 0);
37585 xmlResetLastError();
37586 if (mem_base != xmlMemBlocks()) {
37587 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037589 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037590 printf(" %d", n_code);
37591 printf("\n");
37592 }
37593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037594 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037595#endif
37596
Daniel Veillard42595322004-11-08 10:52:06 +000037597 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037598}
37599
37600
37601static int
37602test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037603 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037604
William M. Brack21e4ef22005-01-02 09:53:13 +000037605#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037606 int mem_base;
37607 int ret_val;
37608 int code; /* UCS code point */
37609 int n_code;
37610
37611 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37612 mem_base = xmlMemBlocks();
37613 code = gen_int(n_code, 0);
37614
37615 ret_val = xmlUCSIsIPAExtensions(code);
37616 desret_int(ret_val);
37617 call_tests++;
37618 des_int(n_code, code, 0);
37619 xmlResetLastError();
37620 if (mem_base != xmlMemBlocks()) {
37621 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037623 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037624 printf(" %d", n_code);
37625 printf("\n");
37626 }
37627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037628 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037629#endif
37630
Daniel Veillard42595322004-11-08 10:52:06 +000037631 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037632}
37633
37634
37635static int
37636test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037637 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037638
William M. Brack21e4ef22005-01-02 09:53:13 +000037639#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037640 int mem_base;
37641 int ret_val;
37642 int code; /* UCS code point */
37643 int n_code;
37644
37645 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37646 mem_base = xmlMemBlocks();
37647 code = gen_int(n_code, 0);
37648
37649 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37650 desret_int(ret_val);
37651 call_tests++;
37652 des_int(n_code, code, 0);
37653 xmlResetLastError();
37654 if (mem_base != xmlMemBlocks()) {
37655 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037657 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037658 printf(" %d", n_code);
37659 printf("\n");
37660 }
37661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037662 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037663#endif
37664
Daniel Veillard42595322004-11-08 10:52:06 +000037665 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037666}
37667
37668
37669static int
37670test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037671 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037672
William M. Brack21e4ef22005-01-02 09:53:13 +000037673#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037674 int mem_base;
37675 int ret_val;
37676 int code; /* UCS code point */
37677 int n_code;
37678
37679 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37680 mem_base = xmlMemBlocks();
37681 code = gen_int(n_code, 0);
37682
37683 ret_val = xmlUCSIsKanbun(code);
37684 desret_int(ret_val);
37685 call_tests++;
37686 des_int(n_code, code, 0);
37687 xmlResetLastError();
37688 if (mem_base != xmlMemBlocks()) {
37689 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037691 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037692 printf(" %d", n_code);
37693 printf("\n");
37694 }
37695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037696 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037697#endif
37698
Daniel Veillard42595322004-11-08 10:52:06 +000037699 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037700}
37701
37702
37703static int
37704test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037705 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037706
William M. Brack21e4ef22005-01-02 09:53:13 +000037707#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037708 int mem_base;
37709 int ret_val;
37710 int code; /* UCS code point */
37711 int n_code;
37712
37713 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37714 mem_base = xmlMemBlocks();
37715 code = gen_int(n_code, 0);
37716
37717 ret_val = xmlUCSIsKangxiRadicals(code);
37718 desret_int(ret_val);
37719 call_tests++;
37720 des_int(n_code, code, 0);
37721 xmlResetLastError();
37722 if (mem_base != xmlMemBlocks()) {
37723 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037725 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037726 printf(" %d", n_code);
37727 printf("\n");
37728 }
37729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037730 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037731#endif
37732
Daniel Veillard42595322004-11-08 10:52:06 +000037733 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037734}
37735
37736
37737static int
37738test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037739 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037740
William M. Brack21e4ef22005-01-02 09:53:13 +000037741#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037742 int mem_base;
37743 int ret_val;
37744 int code; /* UCS code point */
37745 int n_code;
37746
37747 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37748 mem_base = xmlMemBlocks();
37749 code = gen_int(n_code, 0);
37750
37751 ret_val = xmlUCSIsKannada(code);
37752 desret_int(ret_val);
37753 call_tests++;
37754 des_int(n_code, code, 0);
37755 xmlResetLastError();
37756 if (mem_base != xmlMemBlocks()) {
37757 printf("Leak of %d blocks found in xmlUCSIsKannada",
37758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037759 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037760 printf(" %d", n_code);
37761 printf("\n");
37762 }
37763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037764 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037765#endif
37766
Daniel Veillard42595322004-11-08 10:52:06 +000037767 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037768}
37769
37770
37771static int
37772test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037773 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037774
William M. Brack21e4ef22005-01-02 09:53:13 +000037775#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037776 int mem_base;
37777 int ret_val;
37778 int code; /* UCS code point */
37779 int n_code;
37780
37781 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37782 mem_base = xmlMemBlocks();
37783 code = gen_int(n_code, 0);
37784
37785 ret_val = xmlUCSIsKatakana(code);
37786 desret_int(ret_val);
37787 call_tests++;
37788 des_int(n_code, code, 0);
37789 xmlResetLastError();
37790 if (mem_base != xmlMemBlocks()) {
37791 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037793 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037794 printf(" %d", n_code);
37795 printf("\n");
37796 }
37797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037798 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037799#endif
37800
Daniel Veillard42595322004-11-08 10:52:06 +000037801 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037802}
37803
37804
37805static int
37806test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037807 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037808
William M. Brack21e4ef22005-01-02 09:53:13 +000037809#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037810 int mem_base;
37811 int ret_val;
37812 int code; /* UCS code point */
37813 int n_code;
37814
37815 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37816 mem_base = xmlMemBlocks();
37817 code = gen_int(n_code, 0);
37818
37819 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37820 desret_int(ret_val);
37821 call_tests++;
37822 des_int(n_code, code, 0);
37823 xmlResetLastError();
37824 if (mem_base != xmlMemBlocks()) {
37825 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037827 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037828 printf(" %d", n_code);
37829 printf("\n");
37830 }
37831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037832 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037833#endif
37834
Daniel Veillard42595322004-11-08 10:52:06 +000037835 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037836}
37837
37838
37839static int
37840test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037841 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037842
William M. Brack21e4ef22005-01-02 09:53:13 +000037843#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037844 int mem_base;
37845 int ret_val;
37846 int code; /* UCS code point */
37847 int n_code;
37848
37849 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37850 mem_base = xmlMemBlocks();
37851 code = gen_int(n_code, 0);
37852
37853 ret_val = xmlUCSIsKhmer(code);
37854 desret_int(ret_val);
37855 call_tests++;
37856 des_int(n_code, code, 0);
37857 xmlResetLastError();
37858 if (mem_base != xmlMemBlocks()) {
37859 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037861 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037862 printf(" %d", n_code);
37863 printf("\n");
37864 }
37865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037866 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037867#endif
37868
Daniel Veillard42595322004-11-08 10:52:06 +000037869 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037870}
37871
37872
37873static int
37874test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037875 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037876
William M. Brack21e4ef22005-01-02 09:53:13 +000037877#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037878 int mem_base;
37879 int ret_val;
37880 int code; /* UCS code point */
37881 int n_code;
37882
37883 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37884 mem_base = xmlMemBlocks();
37885 code = gen_int(n_code, 0);
37886
37887 ret_val = xmlUCSIsKhmerSymbols(code);
37888 desret_int(ret_val);
37889 call_tests++;
37890 des_int(n_code, code, 0);
37891 xmlResetLastError();
37892 if (mem_base != xmlMemBlocks()) {
37893 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037895 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037896 printf(" %d", n_code);
37897 printf("\n");
37898 }
37899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037900 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037901#endif
37902
Daniel Veillard42595322004-11-08 10:52:06 +000037903 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037904}
37905
37906
37907static int
37908test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037909 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037910
William M. Brack21e4ef22005-01-02 09:53:13 +000037911#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037912 int mem_base;
37913 int ret_val;
37914 int code; /* UCS code point */
37915 int n_code;
37916
37917 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37918 mem_base = xmlMemBlocks();
37919 code = gen_int(n_code, 0);
37920
37921 ret_val = xmlUCSIsLao(code);
37922 desret_int(ret_val);
37923 call_tests++;
37924 des_int(n_code, code, 0);
37925 xmlResetLastError();
37926 if (mem_base != xmlMemBlocks()) {
37927 printf("Leak of %d blocks found in xmlUCSIsLao",
37928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037929 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037930 printf(" %d", n_code);
37931 printf("\n");
37932 }
37933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037934 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037935#endif
37936
Daniel Veillard42595322004-11-08 10:52:06 +000037937 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037938}
37939
37940
37941static int
37942test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037943 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037944
William M. Brack21e4ef22005-01-02 09:53:13 +000037945#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037946 int mem_base;
37947 int ret_val;
37948 int code; /* UCS code point */
37949 int n_code;
37950
37951 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37952 mem_base = xmlMemBlocks();
37953 code = gen_int(n_code, 0);
37954
37955 ret_val = xmlUCSIsLatin1Supplement(code);
37956 desret_int(ret_val);
37957 call_tests++;
37958 des_int(n_code, code, 0);
37959 xmlResetLastError();
37960 if (mem_base != xmlMemBlocks()) {
37961 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037963 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037964 printf(" %d", n_code);
37965 printf("\n");
37966 }
37967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037968 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037969#endif
37970
Daniel Veillard42595322004-11-08 10:52:06 +000037971 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037972}
37973
37974
37975static int
37976test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037977 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037978
William M. Brack21e4ef22005-01-02 09:53:13 +000037979#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037980 int mem_base;
37981 int ret_val;
37982 int code; /* UCS code point */
37983 int n_code;
37984
37985 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37986 mem_base = xmlMemBlocks();
37987 code = gen_int(n_code, 0);
37988
37989 ret_val = xmlUCSIsLatinExtendedA(code);
37990 desret_int(ret_val);
37991 call_tests++;
37992 des_int(n_code, code, 0);
37993 xmlResetLastError();
37994 if (mem_base != xmlMemBlocks()) {
37995 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037997 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037998 printf(" %d", n_code);
37999 printf("\n");
38000 }
38001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038002 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038003#endif
38004
Daniel Veillard42595322004-11-08 10:52:06 +000038005 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038006}
38007
38008
38009static int
38010test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038011 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038012
William M. Brack21e4ef22005-01-02 09:53:13 +000038013#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038014 int mem_base;
38015 int ret_val;
38016 int code; /* UCS code point */
38017 int n_code;
38018
38019 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38020 mem_base = xmlMemBlocks();
38021 code = gen_int(n_code, 0);
38022
38023 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38024 desret_int(ret_val);
38025 call_tests++;
38026 des_int(n_code, code, 0);
38027 xmlResetLastError();
38028 if (mem_base != xmlMemBlocks()) {
38029 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038031 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038032 printf(" %d", n_code);
38033 printf("\n");
38034 }
38035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038036 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038037#endif
38038
Daniel Veillard42595322004-11-08 10:52:06 +000038039 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038040}
38041
38042
38043static int
38044test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038045 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038046
William M. Brack21e4ef22005-01-02 09:53:13 +000038047#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038048 int mem_base;
38049 int ret_val;
38050 int code; /* UCS code point */
38051 int n_code;
38052
38053 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38054 mem_base = xmlMemBlocks();
38055 code = gen_int(n_code, 0);
38056
38057 ret_val = xmlUCSIsLatinExtendedB(code);
38058 desret_int(ret_val);
38059 call_tests++;
38060 des_int(n_code, code, 0);
38061 xmlResetLastError();
38062 if (mem_base != xmlMemBlocks()) {
38063 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038065 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038066 printf(" %d", n_code);
38067 printf("\n");
38068 }
38069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038070 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038071#endif
38072
Daniel Veillard42595322004-11-08 10:52:06 +000038073 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038074}
38075
38076
38077static int
38078test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038079 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038080
William M. Brack21e4ef22005-01-02 09:53:13 +000038081#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038082 int mem_base;
38083 int ret_val;
38084 int code; /* UCS code point */
38085 int n_code;
38086
38087 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38088 mem_base = xmlMemBlocks();
38089 code = gen_int(n_code, 0);
38090
38091 ret_val = xmlUCSIsLetterlikeSymbols(code);
38092 desret_int(ret_val);
38093 call_tests++;
38094 des_int(n_code, code, 0);
38095 xmlResetLastError();
38096 if (mem_base != xmlMemBlocks()) {
38097 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038099 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038100 printf(" %d", n_code);
38101 printf("\n");
38102 }
38103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038104 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038105#endif
38106
Daniel Veillard42595322004-11-08 10:52:06 +000038107 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038108}
38109
38110
38111static int
38112test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038113 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038114
William M. Brack21e4ef22005-01-02 09:53:13 +000038115#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038116 int mem_base;
38117 int ret_val;
38118 int code; /* UCS code point */
38119 int n_code;
38120
38121 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38122 mem_base = xmlMemBlocks();
38123 code = gen_int(n_code, 0);
38124
38125 ret_val = xmlUCSIsLimbu(code);
38126 desret_int(ret_val);
38127 call_tests++;
38128 des_int(n_code, code, 0);
38129 xmlResetLastError();
38130 if (mem_base != xmlMemBlocks()) {
38131 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038133 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038134 printf(" %d", n_code);
38135 printf("\n");
38136 }
38137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038138 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038139#endif
38140
Daniel Veillard42595322004-11-08 10:52:06 +000038141 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038142}
38143
38144
38145static int
38146test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038147 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038148
William M. Brack21e4ef22005-01-02 09:53:13 +000038149#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038150 int mem_base;
38151 int ret_val;
38152 int code; /* UCS code point */
38153 int n_code;
38154
38155 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38156 mem_base = xmlMemBlocks();
38157 code = gen_int(n_code, 0);
38158
38159 ret_val = xmlUCSIsLinearBIdeograms(code);
38160 desret_int(ret_val);
38161 call_tests++;
38162 des_int(n_code, code, 0);
38163 xmlResetLastError();
38164 if (mem_base != xmlMemBlocks()) {
38165 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038167 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038168 printf(" %d", n_code);
38169 printf("\n");
38170 }
38171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038172 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038173#endif
38174
Daniel Veillard42595322004-11-08 10:52:06 +000038175 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038176}
38177
38178
38179static int
38180test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038181 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038182
William M. Brack21e4ef22005-01-02 09:53:13 +000038183#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038184 int mem_base;
38185 int ret_val;
38186 int code; /* UCS code point */
38187 int n_code;
38188
38189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38190 mem_base = xmlMemBlocks();
38191 code = gen_int(n_code, 0);
38192
38193 ret_val = xmlUCSIsLinearBSyllabary(code);
38194 desret_int(ret_val);
38195 call_tests++;
38196 des_int(n_code, code, 0);
38197 xmlResetLastError();
38198 if (mem_base != xmlMemBlocks()) {
38199 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038201 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038202 printf(" %d", n_code);
38203 printf("\n");
38204 }
38205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038206 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038207#endif
38208
Daniel Veillard42595322004-11-08 10:52:06 +000038209 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038210}
38211
38212
38213static int
38214test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038215 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038216
William M. Brack21e4ef22005-01-02 09:53:13 +000038217#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038218 int mem_base;
38219 int ret_val;
38220 int code; /* UCS code point */
38221 int n_code;
38222
38223 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38224 mem_base = xmlMemBlocks();
38225 code = gen_int(n_code, 0);
38226
38227 ret_val = xmlUCSIsLowSurrogates(code);
38228 desret_int(ret_val);
38229 call_tests++;
38230 des_int(n_code, code, 0);
38231 xmlResetLastError();
38232 if (mem_base != xmlMemBlocks()) {
38233 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038235 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038236 printf(" %d", n_code);
38237 printf("\n");
38238 }
38239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038240 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038241#endif
38242
Daniel Veillard42595322004-11-08 10:52:06 +000038243 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038244}
38245
38246
38247static int
38248test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038249 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038250
William M. Brack21e4ef22005-01-02 09:53:13 +000038251#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038252 int mem_base;
38253 int ret_val;
38254 int code; /* UCS code point */
38255 int n_code;
38256
38257 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38258 mem_base = xmlMemBlocks();
38259 code = gen_int(n_code, 0);
38260
38261 ret_val = xmlUCSIsMalayalam(code);
38262 desret_int(ret_val);
38263 call_tests++;
38264 des_int(n_code, code, 0);
38265 xmlResetLastError();
38266 if (mem_base != xmlMemBlocks()) {
38267 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038269 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038270 printf(" %d", n_code);
38271 printf("\n");
38272 }
38273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038274 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038275#endif
38276
Daniel Veillard42595322004-11-08 10:52:06 +000038277 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038278}
38279
38280
38281static int
38282test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038284
William M. Brack21e4ef22005-01-02 09:53:13 +000038285#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038286 int mem_base;
38287 int ret_val;
38288 int code; /* UCS code point */
38289 int n_code;
38290
38291 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38292 mem_base = xmlMemBlocks();
38293 code = gen_int(n_code, 0);
38294
38295 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38296 desret_int(ret_val);
38297 call_tests++;
38298 des_int(n_code, code, 0);
38299 xmlResetLastError();
38300 if (mem_base != xmlMemBlocks()) {
38301 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038303 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038304 printf(" %d", n_code);
38305 printf("\n");
38306 }
38307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038308 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038309#endif
38310
Daniel Veillard42595322004-11-08 10:52:06 +000038311 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038312}
38313
38314
38315static int
38316test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038317 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038318
William M. Brack21e4ef22005-01-02 09:53:13 +000038319#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038320 int mem_base;
38321 int ret_val;
38322 int code; /* UCS code point */
38323 int n_code;
38324
38325 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38326 mem_base = xmlMemBlocks();
38327 code = gen_int(n_code, 0);
38328
38329 ret_val = xmlUCSIsMathematicalOperators(code);
38330 desret_int(ret_val);
38331 call_tests++;
38332 des_int(n_code, code, 0);
38333 xmlResetLastError();
38334 if (mem_base != xmlMemBlocks()) {
38335 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038337 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038338 printf(" %d", n_code);
38339 printf("\n");
38340 }
38341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038342 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038343#endif
38344
Daniel Veillard42595322004-11-08 10:52:06 +000038345 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038346}
38347
38348
38349static int
38350test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038351 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038352
William M. Brack21e4ef22005-01-02 09:53:13 +000038353#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038354 int mem_base;
38355 int ret_val;
38356 int code; /* UCS code point */
38357 int n_code;
38358
38359 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38360 mem_base = xmlMemBlocks();
38361 code = gen_int(n_code, 0);
38362
38363 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38364 desret_int(ret_val);
38365 call_tests++;
38366 des_int(n_code, code, 0);
38367 xmlResetLastError();
38368 if (mem_base != xmlMemBlocks()) {
38369 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038371 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038372 printf(" %d", n_code);
38373 printf("\n");
38374 }
38375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038376 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038377#endif
38378
Daniel Veillard42595322004-11-08 10:52:06 +000038379 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038380}
38381
38382
38383static int
38384test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038385 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038386
William M. Brack21e4ef22005-01-02 09:53:13 +000038387#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038388 int mem_base;
38389 int ret_val;
38390 int code; /* UCS code point */
38391 int n_code;
38392
38393 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38394 mem_base = xmlMemBlocks();
38395 code = gen_int(n_code, 0);
38396
38397 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38398 desret_int(ret_val);
38399 call_tests++;
38400 des_int(n_code, code, 0);
38401 xmlResetLastError();
38402 if (mem_base != xmlMemBlocks()) {
38403 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038405 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038406 printf(" %d", n_code);
38407 printf("\n");
38408 }
38409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038410 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038411#endif
38412
Daniel Veillard42595322004-11-08 10:52:06 +000038413 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038414}
38415
38416
38417static int
38418test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038419 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038420
William M. Brack21e4ef22005-01-02 09:53:13 +000038421#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038422 int mem_base;
38423 int ret_val;
38424 int code; /* UCS code point */
38425 int n_code;
38426
38427 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38428 mem_base = xmlMemBlocks();
38429 code = gen_int(n_code, 0);
38430
38431 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38432 desret_int(ret_val);
38433 call_tests++;
38434 des_int(n_code, code, 0);
38435 xmlResetLastError();
38436 if (mem_base != xmlMemBlocks()) {
38437 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038439 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038440 printf(" %d", n_code);
38441 printf("\n");
38442 }
38443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038444 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038445#endif
38446
Daniel Veillard42595322004-11-08 10:52:06 +000038447 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038448}
38449
38450
38451static int
38452test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038453 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038454
William M. Brack21e4ef22005-01-02 09:53:13 +000038455#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038456 int mem_base;
38457 int ret_val;
38458 int code; /* UCS code point */
38459 int n_code;
38460
38461 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38462 mem_base = xmlMemBlocks();
38463 code = gen_int(n_code, 0);
38464
38465 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38466 desret_int(ret_val);
38467 call_tests++;
38468 des_int(n_code, code, 0);
38469 xmlResetLastError();
38470 if (mem_base != xmlMemBlocks()) {
38471 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038473 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038474 printf(" %d", n_code);
38475 printf("\n");
38476 }
38477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038478 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038479#endif
38480
Daniel Veillard42595322004-11-08 10:52:06 +000038481 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038482}
38483
38484
38485static int
38486test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038487 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038488
William M. Brack21e4ef22005-01-02 09:53:13 +000038489#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038490 int mem_base;
38491 int ret_val;
38492 int code; /* UCS code point */
38493 int n_code;
38494
38495 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38496 mem_base = xmlMemBlocks();
38497 code = gen_int(n_code, 0);
38498
38499 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38500 desret_int(ret_val);
38501 call_tests++;
38502 des_int(n_code, code, 0);
38503 xmlResetLastError();
38504 if (mem_base != xmlMemBlocks()) {
38505 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038507 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038508 printf(" %d", n_code);
38509 printf("\n");
38510 }
38511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038512 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038513#endif
38514
Daniel Veillard42595322004-11-08 10:52:06 +000038515 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038516}
38517
38518
38519static int
38520test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038521 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038522
William M. Brack21e4ef22005-01-02 09:53:13 +000038523#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038524 int mem_base;
38525 int ret_val;
38526 int code; /* UCS code point */
38527 int n_code;
38528
38529 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38530 mem_base = xmlMemBlocks();
38531 code = gen_int(n_code, 0);
38532
38533 ret_val = xmlUCSIsMongolian(code);
38534 desret_int(ret_val);
38535 call_tests++;
38536 des_int(n_code, code, 0);
38537 xmlResetLastError();
38538 if (mem_base != xmlMemBlocks()) {
38539 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038541 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038542 printf(" %d", n_code);
38543 printf("\n");
38544 }
38545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038546 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038547#endif
38548
Daniel Veillard42595322004-11-08 10:52:06 +000038549 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038550}
38551
38552
38553static int
38554test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038556
William M. Brack21e4ef22005-01-02 09:53:13 +000038557#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038558 int mem_base;
38559 int ret_val;
38560 int code; /* UCS code point */
38561 int n_code;
38562
38563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38564 mem_base = xmlMemBlocks();
38565 code = gen_int(n_code, 0);
38566
38567 ret_val = xmlUCSIsMusicalSymbols(code);
38568 desret_int(ret_val);
38569 call_tests++;
38570 des_int(n_code, code, 0);
38571 xmlResetLastError();
38572 if (mem_base != xmlMemBlocks()) {
38573 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038576 printf(" %d", n_code);
38577 printf("\n");
38578 }
38579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038580 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038581#endif
38582
Daniel Veillard42595322004-11-08 10:52:06 +000038583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038584}
38585
38586
38587static int
38588test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038590
William M. Brack21e4ef22005-01-02 09:53:13 +000038591#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038592 int mem_base;
38593 int ret_val;
38594 int code; /* UCS code point */
38595 int n_code;
38596
38597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38598 mem_base = xmlMemBlocks();
38599 code = gen_int(n_code, 0);
38600
38601 ret_val = xmlUCSIsMyanmar(code);
38602 desret_int(ret_val);
38603 call_tests++;
38604 des_int(n_code, code, 0);
38605 xmlResetLastError();
38606 if (mem_base != xmlMemBlocks()) {
38607 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038610 printf(" %d", n_code);
38611 printf("\n");
38612 }
38613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038614 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038615#endif
38616
Daniel Veillard42595322004-11-08 10:52:06 +000038617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038618}
38619
38620
38621static int
38622test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038624
William M. Brack21e4ef22005-01-02 09:53:13 +000038625#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038626 int mem_base;
38627 int ret_val;
38628 int code; /* UCS code point */
38629 int n_code;
38630
38631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38632 mem_base = xmlMemBlocks();
38633 code = gen_int(n_code, 0);
38634
38635 ret_val = xmlUCSIsNumberForms(code);
38636 desret_int(ret_val);
38637 call_tests++;
38638 des_int(n_code, code, 0);
38639 xmlResetLastError();
38640 if (mem_base != xmlMemBlocks()) {
38641 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038644 printf(" %d", n_code);
38645 printf("\n");
38646 }
38647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038648 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038649#endif
38650
Daniel Veillard42595322004-11-08 10:52:06 +000038651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038652}
38653
38654
38655static int
38656test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038658
William M. Brack21e4ef22005-01-02 09:53:13 +000038659#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038660 int mem_base;
38661 int ret_val;
38662 int code; /* UCS code point */
38663 int n_code;
38664
38665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38666 mem_base = xmlMemBlocks();
38667 code = gen_int(n_code, 0);
38668
38669 ret_val = xmlUCSIsOgham(code);
38670 desret_int(ret_val);
38671 call_tests++;
38672 des_int(n_code, code, 0);
38673 xmlResetLastError();
38674 if (mem_base != xmlMemBlocks()) {
38675 printf("Leak of %d blocks found in xmlUCSIsOgham",
38676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038678 printf(" %d", n_code);
38679 printf("\n");
38680 }
38681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038682 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038683#endif
38684
Daniel Veillard42595322004-11-08 10:52:06 +000038685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038686}
38687
38688
38689static int
38690test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038692
William M. Brack21e4ef22005-01-02 09:53:13 +000038693#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038694 int mem_base;
38695 int ret_val;
38696 int code; /* UCS code point */
38697 int n_code;
38698
38699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38700 mem_base = xmlMemBlocks();
38701 code = gen_int(n_code, 0);
38702
38703 ret_val = xmlUCSIsOldItalic(code);
38704 desret_int(ret_val);
38705 call_tests++;
38706 des_int(n_code, code, 0);
38707 xmlResetLastError();
38708 if (mem_base != xmlMemBlocks()) {
38709 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038712 printf(" %d", n_code);
38713 printf("\n");
38714 }
38715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038716 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038717#endif
38718
Daniel Veillard42595322004-11-08 10:52:06 +000038719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038720}
38721
38722
38723static int
38724test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038726
William M. Brack21e4ef22005-01-02 09:53:13 +000038727#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038728 int mem_base;
38729 int ret_val;
38730 int code; /* UCS code point */
38731 int n_code;
38732
38733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38734 mem_base = xmlMemBlocks();
38735 code = gen_int(n_code, 0);
38736
38737 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38738 desret_int(ret_val);
38739 call_tests++;
38740 des_int(n_code, code, 0);
38741 xmlResetLastError();
38742 if (mem_base != xmlMemBlocks()) {
38743 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038746 printf(" %d", n_code);
38747 printf("\n");
38748 }
38749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038750 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038751#endif
38752
Daniel Veillard42595322004-11-08 10:52:06 +000038753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038754}
38755
38756
38757static int
38758test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038760
William M. Brack21e4ef22005-01-02 09:53:13 +000038761#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038762 int mem_base;
38763 int ret_val;
38764 int code; /* UCS code point */
38765 int n_code;
38766
38767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38768 mem_base = xmlMemBlocks();
38769 code = gen_int(n_code, 0);
38770
38771 ret_val = xmlUCSIsOriya(code);
38772 desret_int(ret_val);
38773 call_tests++;
38774 des_int(n_code, code, 0);
38775 xmlResetLastError();
38776 if (mem_base != xmlMemBlocks()) {
38777 printf("Leak of %d blocks found in xmlUCSIsOriya",
38778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038780 printf(" %d", n_code);
38781 printf("\n");
38782 }
38783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038784 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038785#endif
38786
Daniel Veillard42595322004-11-08 10:52:06 +000038787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038788}
38789
38790
38791static int
38792test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038794
William M. Brack21e4ef22005-01-02 09:53:13 +000038795#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038796 int mem_base;
38797 int ret_val;
38798 int code; /* UCS code point */
38799 int n_code;
38800
38801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38802 mem_base = xmlMemBlocks();
38803 code = gen_int(n_code, 0);
38804
38805 ret_val = xmlUCSIsOsmanya(code);
38806 desret_int(ret_val);
38807 call_tests++;
38808 des_int(n_code, code, 0);
38809 xmlResetLastError();
38810 if (mem_base != xmlMemBlocks()) {
38811 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038814 printf(" %d", n_code);
38815 printf("\n");
38816 }
38817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038818 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038819#endif
38820
Daniel Veillard42595322004-11-08 10:52:06 +000038821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038822}
38823
38824
38825static int
38826test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038828
William M. Brack21e4ef22005-01-02 09:53:13 +000038829#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038830 int mem_base;
38831 int ret_val;
38832 int code; /* UCS code point */
38833 int n_code;
38834
38835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38836 mem_base = xmlMemBlocks();
38837 code = gen_int(n_code, 0);
38838
38839 ret_val = xmlUCSIsPhoneticExtensions(code);
38840 desret_int(ret_val);
38841 call_tests++;
38842 des_int(n_code, code, 0);
38843 xmlResetLastError();
38844 if (mem_base != xmlMemBlocks()) {
38845 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038848 printf(" %d", n_code);
38849 printf("\n");
38850 }
38851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038852 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038853#endif
38854
Daniel Veillard42595322004-11-08 10:52:06 +000038855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038856}
38857
38858
38859static int
38860test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038862
William M. Brack21e4ef22005-01-02 09:53:13 +000038863#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038864 int mem_base;
38865 int ret_val;
38866 int code; /* UCS code point */
38867 int n_code;
38868
38869 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38870 mem_base = xmlMemBlocks();
38871 code = gen_int(n_code, 0);
38872
38873 ret_val = xmlUCSIsPrivateUse(code);
38874 desret_int(ret_val);
38875 call_tests++;
38876 des_int(n_code, code, 0);
38877 xmlResetLastError();
38878 if (mem_base != xmlMemBlocks()) {
38879 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038881 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038882 printf(" %d", n_code);
38883 printf("\n");
38884 }
38885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038886 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038887#endif
38888
Daniel Veillard42595322004-11-08 10:52:06 +000038889 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038890}
38891
38892
38893static int
38894test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038895 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038896
William M. Brack21e4ef22005-01-02 09:53:13 +000038897#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038898 int mem_base;
38899 int ret_val;
38900 int code; /* UCS code point */
38901 int n_code;
38902
38903 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38904 mem_base = xmlMemBlocks();
38905 code = gen_int(n_code, 0);
38906
38907 ret_val = xmlUCSIsPrivateUseArea(code);
38908 desret_int(ret_val);
38909 call_tests++;
38910 des_int(n_code, code, 0);
38911 xmlResetLastError();
38912 if (mem_base != xmlMemBlocks()) {
38913 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038915 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038916 printf(" %d", n_code);
38917 printf("\n");
38918 }
38919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038920 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038921#endif
38922
Daniel Veillard42595322004-11-08 10:52:06 +000038923 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038924}
38925
38926
38927static int
38928test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038929 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038930
William M. Brack21e4ef22005-01-02 09:53:13 +000038931#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038932 int mem_base;
38933 int ret_val;
38934 int code; /* UCS code point */
38935 int n_code;
38936
38937 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38938 mem_base = xmlMemBlocks();
38939 code = gen_int(n_code, 0);
38940
38941 ret_val = xmlUCSIsRunic(code);
38942 desret_int(ret_val);
38943 call_tests++;
38944 des_int(n_code, code, 0);
38945 xmlResetLastError();
38946 if (mem_base != xmlMemBlocks()) {
38947 printf("Leak of %d blocks found in xmlUCSIsRunic",
38948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038949 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038950 printf(" %d", n_code);
38951 printf("\n");
38952 }
38953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038954 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038955#endif
38956
Daniel Veillard42595322004-11-08 10:52:06 +000038957 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038958}
38959
38960
38961static int
38962test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038963 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038964
William M. Brack21e4ef22005-01-02 09:53:13 +000038965#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038966 int mem_base;
38967 int ret_val;
38968 int code; /* UCS code point */
38969 int n_code;
38970
38971 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38972 mem_base = xmlMemBlocks();
38973 code = gen_int(n_code, 0);
38974
38975 ret_val = xmlUCSIsShavian(code);
38976 desret_int(ret_val);
38977 call_tests++;
38978 des_int(n_code, code, 0);
38979 xmlResetLastError();
38980 if (mem_base != xmlMemBlocks()) {
38981 printf("Leak of %d blocks found in xmlUCSIsShavian",
38982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038983 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038984 printf(" %d", n_code);
38985 printf("\n");
38986 }
38987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038988 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038989#endif
38990
Daniel Veillard42595322004-11-08 10:52:06 +000038991 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038992}
38993
38994
38995static int
38996test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038997 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038998
William M. Brack21e4ef22005-01-02 09:53:13 +000038999#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039000 int mem_base;
39001 int ret_val;
39002 int code; /* UCS code point */
39003 int n_code;
39004
39005 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39006 mem_base = xmlMemBlocks();
39007 code = gen_int(n_code, 0);
39008
39009 ret_val = xmlUCSIsSinhala(code);
39010 desret_int(ret_val);
39011 call_tests++;
39012 des_int(n_code, code, 0);
39013 xmlResetLastError();
39014 if (mem_base != xmlMemBlocks()) {
39015 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039017 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039018 printf(" %d", n_code);
39019 printf("\n");
39020 }
39021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039022 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039023#endif
39024
Daniel Veillard42595322004-11-08 10:52:06 +000039025 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039026}
39027
39028
39029static int
39030test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039031 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039032
William M. Brack21e4ef22005-01-02 09:53:13 +000039033#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039034 int mem_base;
39035 int ret_val;
39036 int code; /* UCS code point */
39037 int n_code;
39038
39039 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39040 mem_base = xmlMemBlocks();
39041 code = gen_int(n_code, 0);
39042
39043 ret_val = xmlUCSIsSmallFormVariants(code);
39044 desret_int(ret_val);
39045 call_tests++;
39046 des_int(n_code, code, 0);
39047 xmlResetLastError();
39048 if (mem_base != xmlMemBlocks()) {
39049 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039051 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039052 printf(" %d", n_code);
39053 printf("\n");
39054 }
39055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039056 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039057#endif
39058
Daniel Veillard42595322004-11-08 10:52:06 +000039059 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039060}
39061
39062
39063static int
39064test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039065 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039066
William M. Brack21e4ef22005-01-02 09:53:13 +000039067#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039068 int mem_base;
39069 int ret_val;
39070 int code; /* UCS code point */
39071 int n_code;
39072
39073 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39074 mem_base = xmlMemBlocks();
39075 code = gen_int(n_code, 0);
39076
39077 ret_val = xmlUCSIsSpacingModifierLetters(code);
39078 desret_int(ret_val);
39079 call_tests++;
39080 des_int(n_code, code, 0);
39081 xmlResetLastError();
39082 if (mem_base != xmlMemBlocks()) {
39083 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039085 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039086 printf(" %d", n_code);
39087 printf("\n");
39088 }
39089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039090 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039091#endif
39092
Daniel Veillard42595322004-11-08 10:52:06 +000039093 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039094}
39095
39096
39097static int
39098test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039099 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039100
William M. Brack21e4ef22005-01-02 09:53:13 +000039101#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039102 int mem_base;
39103 int ret_val;
39104 int code; /* UCS code point */
39105 int n_code;
39106
39107 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39108 mem_base = xmlMemBlocks();
39109 code = gen_int(n_code, 0);
39110
39111 ret_val = xmlUCSIsSpecials(code);
39112 desret_int(ret_val);
39113 call_tests++;
39114 des_int(n_code, code, 0);
39115 xmlResetLastError();
39116 if (mem_base != xmlMemBlocks()) {
39117 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039119 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039120 printf(" %d", n_code);
39121 printf("\n");
39122 }
39123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039124 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039125#endif
39126
Daniel Veillard42595322004-11-08 10:52:06 +000039127 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039128}
39129
39130
39131static int
39132test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039133 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039134
William M. Brack21e4ef22005-01-02 09:53:13 +000039135#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039136 int mem_base;
39137 int ret_val;
39138 int code; /* UCS code point */
39139 int n_code;
39140
39141 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39142 mem_base = xmlMemBlocks();
39143 code = gen_int(n_code, 0);
39144
39145 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39146 desret_int(ret_val);
39147 call_tests++;
39148 des_int(n_code, code, 0);
39149 xmlResetLastError();
39150 if (mem_base != xmlMemBlocks()) {
39151 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039153 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039154 printf(" %d", n_code);
39155 printf("\n");
39156 }
39157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039158 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039159#endif
39160
Daniel Veillard42595322004-11-08 10:52:06 +000039161 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039162}
39163
39164
39165static int
39166test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039167 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039168
William M. Brack21e4ef22005-01-02 09:53:13 +000039169#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039170 int mem_base;
39171 int ret_val;
39172 int code; /* UCS code point */
39173 int n_code;
39174
39175 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39176 mem_base = xmlMemBlocks();
39177 code = gen_int(n_code, 0);
39178
39179 ret_val = xmlUCSIsSupplementalArrowsA(code);
39180 desret_int(ret_val);
39181 call_tests++;
39182 des_int(n_code, code, 0);
39183 xmlResetLastError();
39184 if (mem_base != xmlMemBlocks()) {
39185 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039187 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039188 printf(" %d", n_code);
39189 printf("\n");
39190 }
39191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039192 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039193#endif
39194
Daniel Veillard42595322004-11-08 10:52:06 +000039195 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039196}
39197
39198
39199static int
39200test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039201 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039202
William M. Brack21e4ef22005-01-02 09:53:13 +000039203#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039204 int mem_base;
39205 int ret_val;
39206 int code; /* UCS code point */
39207 int n_code;
39208
39209 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39210 mem_base = xmlMemBlocks();
39211 code = gen_int(n_code, 0);
39212
39213 ret_val = xmlUCSIsSupplementalArrowsB(code);
39214 desret_int(ret_val);
39215 call_tests++;
39216 des_int(n_code, code, 0);
39217 xmlResetLastError();
39218 if (mem_base != xmlMemBlocks()) {
39219 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039221 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039222 printf(" %d", n_code);
39223 printf("\n");
39224 }
39225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039226 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039227#endif
39228
Daniel Veillard42595322004-11-08 10:52:06 +000039229 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039230}
39231
39232
39233static int
39234test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039235 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039236
William M. Brack21e4ef22005-01-02 09:53:13 +000039237#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039238 int mem_base;
39239 int ret_val;
39240 int code; /* UCS code point */
39241 int n_code;
39242
39243 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39244 mem_base = xmlMemBlocks();
39245 code = gen_int(n_code, 0);
39246
39247 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39248 desret_int(ret_val);
39249 call_tests++;
39250 des_int(n_code, code, 0);
39251 xmlResetLastError();
39252 if (mem_base != xmlMemBlocks()) {
39253 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039255 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039256 printf(" %d", n_code);
39257 printf("\n");
39258 }
39259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039260 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039261#endif
39262
Daniel Veillard42595322004-11-08 10:52:06 +000039263 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039264}
39265
39266
39267static int
39268test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039269 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039270
William M. Brack21e4ef22005-01-02 09:53:13 +000039271#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039272 int mem_base;
39273 int ret_val;
39274 int code; /* UCS code point */
39275 int n_code;
39276
39277 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39278 mem_base = xmlMemBlocks();
39279 code = gen_int(n_code, 0);
39280
39281 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39282 desret_int(ret_val);
39283 call_tests++;
39284 des_int(n_code, code, 0);
39285 xmlResetLastError();
39286 if (mem_base != xmlMemBlocks()) {
39287 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039289 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039290 printf(" %d", n_code);
39291 printf("\n");
39292 }
39293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039294 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039295#endif
39296
Daniel Veillard42595322004-11-08 10:52:06 +000039297 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039298}
39299
39300
39301static int
39302test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039303 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039304
William M. Brack21e4ef22005-01-02 09:53:13 +000039305#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039306 int mem_base;
39307 int ret_val;
39308 int code; /* UCS code point */
39309 int n_code;
39310
39311 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39312 mem_base = xmlMemBlocks();
39313 code = gen_int(n_code, 0);
39314
39315 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39316 desret_int(ret_val);
39317 call_tests++;
39318 des_int(n_code, code, 0);
39319 xmlResetLastError();
39320 if (mem_base != xmlMemBlocks()) {
39321 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039323 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039324 printf(" %d", n_code);
39325 printf("\n");
39326 }
39327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039328 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039329#endif
39330
Daniel Veillard42595322004-11-08 10:52:06 +000039331 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039332}
39333
39334
39335static int
39336test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039337 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039338
William M. Brack21e4ef22005-01-02 09:53:13 +000039339#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039340 int mem_base;
39341 int ret_val;
39342 int code; /* UCS code point */
39343 int n_code;
39344
39345 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39346 mem_base = xmlMemBlocks();
39347 code = gen_int(n_code, 0);
39348
39349 ret_val = xmlUCSIsSyriac(code);
39350 desret_int(ret_val);
39351 call_tests++;
39352 des_int(n_code, code, 0);
39353 xmlResetLastError();
39354 if (mem_base != xmlMemBlocks()) {
39355 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039357 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039358 printf(" %d", n_code);
39359 printf("\n");
39360 }
39361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039362 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039363#endif
39364
Daniel Veillard42595322004-11-08 10:52:06 +000039365 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039366}
39367
39368
39369static int
39370test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039371 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039372
William M. Brack21e4ef22005-01-02 09:53:13 +000039373#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039374 int mem_base;
39375 int ret_val;
39376 int code; /* UCS code point */
39377 int n_code;
39378
39379 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39380 mem_base = xmlMemBlocks();
39381 code = gen_int(n_code, 0);
39382
39383 ret_val = xmlUCSIsTagalog(code);
39384 desret_int(ret_val);
39385 call_tests++;
39386 des_int(n_code, code, 0);
39387 xmlResetLastError();
39388 if (mem_base != xmlMemBlocks()) {
39389 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039391 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039392 printf(" %d", n_code);
39393 printf("\n");
39394 }
39395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039396 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039397#endif
39398
Daniel Veillard42595322004-11-08 10:52:06 +000039399 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039400}
39401
39402
39403static int
39404test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039405 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039406
William M. Brack21e4ef22005-01-02 09:53:13 +000039407#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039408 int mem_base;
39409 int ret_val;
39410 int code; /* UCS code point */
39411 int n_code;
39412
39413 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39414 mem_base = xmlMemBlocks();
39415 code = gen_int(n_code, 0);
39416
39417 ret_val = xmlUCSIsTagbanwa(code);
39418 desret_int(ret_val);
39419 call_tests++;
39420 des_int(n_code, code, 0);
39421 xmlResetLastError();
39422 if (mem_base != xmlMemBlocks()) {
39423 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039425 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039426 printf(" %d", n_code);
39427 printf("\n");
39428 }
39429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039430 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039431#endif
39432
Daniel Veillard42595322004-11-08 10:52:06 +000039433 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039434}
39435
39436
39437static int
39438test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039439 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039440
William M. Brack21e4ef22005-01-02 09:53:13 +000039441#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039442 int mem_base;
39443 int ret_val;
39444 int code; /* UCS code point */
39445 int n_code;
39446
39447 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39448 mem_base = xmlMemBlocks();
39449 code = gen_int(n_code, 0);
39450
39451 ret_val = xmlUCSIsTags(code);
39452 desret_int(ret_val);
39453 call_tests++;
39454 des_int(n_code, code, 0);
39455 xmlResetLastError();
39456 if (mem_base != xmlMemBlocks()) {
39457 printf("Leak of %d blocks found in xmlUCSIsTags",
39458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039459 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039460 printf(" %d", n_code);
39461 printf("\n");
39462 }
39463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039464 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039465#endif
39466
Daniel Veillard42595322004-11-08 10:52:06 +000039467 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039468}
39469
39470
39471static int
39472test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039473 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039474
William M. Brack21e4ef22005-01-02 09:53:13 +000039475#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039476 int mem_base;
39477 int ret_val;
39478 int code; /* UCS code point */
39479 int n_code;
39480
39481 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39482 mem_base = xmlMemBlocks();
39483 code = gen_int(n_code, 0);
39484
39485 ret_val = xmlUCSIsTaiLe(code);
39486 desret_int(ret_val);
39487 call_tests++;
39488 des_int(n_code, code, 0);
39489 xmlResetLastError();
39490 if (mem_base != xmlMemBlocks()) {
39491 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039493 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039494 printf(" %d", n_code);
39495 printf("\n");
39496 }
39497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039498 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039499#endif
39500
Daniel Veillard42595322004-11-08 10:52:06 +000039501 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039502}
39503
39504
39505static int
39506test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039507 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039508
William M. Brack21e4ef22005-01-02 09:53:13 +000039509#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039510 int mem_base;
39511 int ret_val;
39512 int code; /* UCS code point */
39513 int n_code;
39514
39515 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39516 mem_base = xmlMemBlocks();
39517 code = gen_int(n_code, 0);
39518
39519 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39520 desret_int(ret_val);
39521 call_tests++;
39522 des_int(n_code, code, 0);
39523 xmlResetLastError();
39524 if (mem_base != xmlMemBlocks()) {
39525 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039527 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039528 printf(" %d", n_code);
39529 printf("\n");
39530 }
39531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039532 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039533#endif
39534
Daniel Veillard42595322004-11-08 10:52:06 +000039535 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039536}
39537
39538
39539static int
39540test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039541 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039542
William M. Brack21e4ef22005-01-02 09:53:13 +000039543#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039544 int mem_base;
39545 int ret_val;
39546 int code; /* UCS code point */
39547 int n_code;
39548
39549 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39550 mem_base = xmlMemBlocks();
39551 code = gen_int(n_code, 0);
39552
39553 ret_val = xmlUCSIsTamil(code);
39554 desret_int(ret_val);
39555 call_tests++;
39556 des_int(n_code, code, 0);
39557 xmlResetLastError();
39558 if (mem_base != xmlMemBlocks()) {
39559 printf("Leak of %d blocks found in xmlUCSIsTamil",
39560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039561 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039562 printf(" %d", n_code);
39563 printf("\n");
39564 }
39565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039566 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039567#endif
39568
Daniel Veillard42595322004-11-08 10:52:06 +000039569 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039570}
39571
39572
39573static int
39574test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039575 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039576
William M. Brack21e4ef22005-01-02 09:53:13 +000039577#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039578 int mem_base;
39579 int ret_val;
39580 int code; /* UCS code point */
39581 int n_code;
39582
39583 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39584 mem_base = xmlMemBlocks();
39585 code = gen_int(n_code, 0);
39586
39587 ret_val = xmlUCSIsTelugu(code);
39588 desret_int(ret_val);
39589 call_tests++;
39590 des_int(n_code, code, 0);
39591 xmlResetLastError();
39592 if (mem_base != xmlMemBlocks()) {
39593 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039595 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039596 printf(" %d", n_code);
39597 printf("\n");
39598 }
39599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039600 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039601#endif
39602
Daniel Veillard42595322004-11-08 10:52:06 +000039603 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039604}
39605
39606
39607static int
39608test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039609 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039610
William M. Brack21e4ef22005-01-02 09:53:13 +000039611#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039612 int mem_base;
39613 int ret_val;
39614 int code; /* UCS code point */
39615 int n_code;
39616
39617 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39618 mem_base = xmlMemBlocks();
39619 code = gen_int(n_code, 0);
39620
39621 ret_val = xmlUCSIsThaana(code);
39622 desret_int(ret_val);
39623 call_tests++;
39624 des_int(n_code, code, 0);
39625 xmlResetLastError();
39626 if (mem_base != xmlMemBlocks()) {
39627 printf("Leak of %d blocks found in xmlUCSIsThaana",
39628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039629 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039630 printf(" %d", n_code);
39631 printf("\n");
39632 }
39633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039634 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039635#endif
39636
Daniel Veillard42595322004-11-08 10:52:06 +000039637 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039638}
39639
39640
39641static int
39642test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039643 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039644
William M. Brack21e4ef22005-01-02 09:53:13 +000039645#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039646 int mem_base;
39647 int ret_val;
39648 int code; /* UCS code point */
39649 int n_code;
39650
39651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39652 mem_base = xmlMemBlocks();
39653 code = gen_int(n_code, 0);
39654
39655 ret_val = xmlUCSIsThai(code);
39656 desret_int(ret_val);
39657 call_tests++;
39658 des_int(n_code, code, 0);
39659 xmlResetLastError();
39660 if (mem_base != xmlMemBlocks()) {
39661 printf("Leak of %d blocks found in xmlUCSIsThai",
39662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039663 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039664 printf(" %d", n_code);
39665 printf("\n");
39666 }
39667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039668 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039669#endif
39670
Daniel Veillard42595322004-11-08 10:52:06 +000039671 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039672}
39673
39674
39675static int
39676test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039677 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039678
William M. Brack21e4ef22005-01-02 09:53:13 +000039679#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039680 int mem_base;
39681 int ret_val;
39682 int code; /* UCS code point */
39683 int n_code;
39684
39685 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39686 mem_base = xmlMemBlocks();
39687 code = gen_int(n_code, 0);
39688
39689 ret_val = xmlUCSIsTibetan(code);
39690 desret_int(ret_val);
39691 call_tests++;
39692 des_int(n_code, code, 0);
39693 xmlResetLastError();
39694 if (mem_base != xmlMemBlocks()) {
39695 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039697 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039698 printf(" %d", n_code);
39699 printf("\n");
39700 }
39701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039702 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039703#endif
39704
Daniel Veillard42595322004-11-08 10:52:06 +000039705 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039706}
39707
39708
39709static int
39710test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039711 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039712
William M. Brack21e4ef22005-01-02 09:53:13 +000039713#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039714 int mem_base;
39715 int ret_val;
39716 int code; /* UCS code point */
39717 int n_code;
39718
39719 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39720 mem_base = xmlMemBlocks();
39721 code = gen_int(n_code, 0);
39722
39723 ret_val = xmlUCSIsUgaritic(code);
39724 desret_int(ret_val);
39725 call_tests++;
39726 des_int(n_code, code, 0);
39727 xmlResetLastError();
39728 if (mem_base != xmlMemBlocks()) {
39729 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039731 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039732 printf(" %d", n_code);
39733 printf("\n");
39734 }
39735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039736 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039737#endif
39738
Daniel Veillard42595322004-11-08 10:52:06 +000039739 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039740}
39741
39742
39743static int
39744test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039745 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039746
William M. Brack21e4ef22005-01-02 09:53:13 +000039747#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039748 int mem_base;
39749 int ret_val;
39750 int code; /* UCS code point */
39751 int n_code;
39752
39753 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39754 mem_base = xmlMemBlocks();
39755 code = gen_int(n_code, 0);
39756
39757 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39758 desret_int(ret_val);
39759 call_tests++;
39760 des_int(n_code, code, 0);
39761 xmlResetLastError();
39762 if (mem_base != xmlMemBlocks()) {
39763 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039765 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039766 printf(" %d", n_code);
39767 printf("\n");
39768 }
39769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039770 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039771#endif
39772
Daniel Veillard42595322004-11-08 10:52:06 +000039773 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039774}
39775
39776
39777static int
39778test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039779 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039780
William M. Brack21e4ef22005-01-02 09:53:13 +000039781#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039782 int mem_base;
39783 int ret_val;
39784 int code; /* UCS code point */
39785 int n_code;
39786
39787 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39788 mem_base = xmlMemBlocks();
39789 code = gen_int(n_code, 0);
39790
39791 ret_val = xmlUCSIsVariationSelectors(code);
39792 desret_int(ret_val);
39793 call_tests++;
39794 des_int(n_code, code, 0);
39795 xmlResetLastError();
39796 if (mem_base != xmlMemBlocks()) {
39797 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039799 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039800 printf(" %d", n_code);
39801 printf("\n");
39802 }
39803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039804 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039805#endif
39806
Daniel Veillard42595322004-11-08 10:52:06 +000039807 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039808}
39809
39810
39811static int
39812test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039813 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039814
William M. Brack21e4ef22005-01-02 09:53:13 +000039815#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039816 int mem_base;
39817 int ret_val;
39818 int code; /* UCS code point */
39819 int n_code;
39820
39821 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39822 mem_base = xmlMemBlocks();
39823 code = gen_int(n_code, 0);
39824
39825 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39826 desret_int(ret_val);
39827 call_tests++;
39828 des_int(n_code, code, 0);
39829 xmlResetLastError();
39830 if (mem_base != xmlMemBlocks()) {
39831 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039833 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039834 printf(" %d", n_code);
39835 printf("\n");
39836 }
39837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039838 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039839#endif
39840
Daniel Veillard42595322004-11-08 10:52:06 +000039841 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039842}
39843
39844
39845static int
39846test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039847 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039848
William M. Brack21e4ef22005-01-02 09:53:13 +000039849#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039850 int mem_base;
39851 int ret_val;
39852 int code; /* UCS code point */
39853 int n_code;
39854
39855 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39856 mem_base = xmlMemBlocks();
39857 code = gen_int(n_code, 0);
39858
39859 ret_val = xmlUCSIsYiRadicals(code);
39860 desret_int(ret_val);
39861 call_tests++;
39862 des_int(n_code, code, 0);
39863 xmlResetLastError();
39864 if (mem_base != xmlMemBlocks()) {
39865 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039867 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039868 printf(" %d", n_code);
39869 printf("\n");
39870 }
39871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039872 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039873#endif
39874
Daniel Veillard42595322004-11-08 10:52:06 +000039875 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039876}
39877
39878
39879static int
39880test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039881 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039882
William M. Brack21e4ef22005-01-02 09:53:13 +000039883#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039884 int mem_base;
39885 int ret_val;
39886 int code; /* UCS code point */
39887 int n_code;
39888
39889 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39890 mem_base = xmlMemBlocks();
39891 code = gen_int(n_code, 0);
39892
39893 ret_val = xmlUCSIsYiSyllables(code);
39894 desret_int(ret_val);
39895 call_tests++;
39896 des_int(n_code, code, 0);
39897 xmlResetLastError();
39898 if (mem_base != xmlMemBlocks()) {
39899 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039901 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039902 printf(" %d", n_code);
39903 printf("\n");
39904 }
39905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039906 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039907#endif
39908
Daniel Veillard42595322004-11-08 10:52:06 +000039909 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039910}
39911
39912
39913static int
39914test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039915 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039916
William M. Brack21e4ef22005-01-02 09:53:13 +000039917#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039918 int mem_base;
39919 int ret_val;
39920 int code; /* UCS code point */
39921 int n_code;
39922
39923 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39924 mem_base = xmlMemBlocks();
39925 code = gen_int(n_code, 0);
39926
39927 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39928 desret_int(ret_val);
39929 call_tests++;
39930 des_int(n_code, code, 0);
39931 xmlResetLastError();
39932 if (mem_base != xmlMemBlocks()) {
39933 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039936 printf(" %d", n_code);
39937 printf("\n");
39938 }
39939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039940 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039941#endif
39942
Daniel Veillard42595322004-11-08 10:52:06 +000039943 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039944}
39945
39946static int
39947test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039948 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039949
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039950 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039951 test_ret += test_xmlUCSIsAegeanNumbers();
39952 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39953 test_ret += test_xmlUCSIsArabic();
39954 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39955 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39956 test_ret += test_xmlUCSIsArmenian();
39957 test_ret += test_xmlUCSIsArrows();
39958 test_ret += test_xmlUCSIsBasicLatin();
39959 test_ret += test_xmlUCSIsBengali();
39960 test_ret += test_xmlUCSIsBlock();
39961 test_ret += test_xmlUCSIsBlockElements();
39962 test_ret += test_xmlUCSIsBopomofo();
39963 test_ret += test_xmlUCSIsBopomofoExtended();
39964 test_ret += test_xmlUCSIsBoxDrawing();
39965 test_ret += test_xmlUCSIsBraillePatterns();
39966 test_ret += test_xmlUCSIsBuhid();
39967 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39968 test_ret += test_xmlUCSIsCJKCompatibility();
39969 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39970 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39971 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39972 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39973 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39974 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39975 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39976 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39977 test_ret += test_xmlUCSIsCat();
39978 test_ret += test_xmlUCSIsCatC();
39979 test_ret += test_xmlUCSIsCatCc();
39980 test_ret += test_xmlUCSIsCatCf();
39981 test_ret += test_xmlUCSIsCatCo();
39982 test_ret += test_xmlUCSIsCatCs();
39983 test_ret += test_xmlUCSIsCatL();
39984 test_ret += test_xmlUCSIsCatLl();
39985 test_ret += test_xmlUCSIsCatLm();
39986 test_ret += test_xmlUCSIsCatLo();
39987 test_ret += test_xmlUCSIsCatLt();
39988 test_ret += test_xmlUCSIsCatLu();
39989 test_ret += test_xmlUCSIsCatM();
39990 test_ret += test_xmlUCSIsCatMc();
39991 test_ret += test_xmlUCSIsCatMe();
39992 test_ret += test_xmlUCSIsCatMn();
39993 test_ret += test_xmlUCSIsCatN();
39994 test_ret += test_xmlUCSIsCatNd();
39995 test_ret += test_xmlUCSIsCatNl();
39996 test_ret += test_xmlUCSIsCatNo();
39997 test_ret += test_xmlUCSIsCatP();
39998 test_ret += test_xmlUCSIsCatPc();
39999 test_ret += test_xmlUCSIsCatPd();
40000 test_ret += test_xmlUCSIsCatPe();
40001 test_ret += test_xmlUCSIsCatPf();
40002 test_ret += test_xmlUCSIsCatPi();
40003 test_ret += test_xmlUCSIsCatPo();
40004 test_ret += test_xmlUCSIsCatPs();
40005 test_ret += test_xmlUCSIsCatS();
40006 test_ret += test_xmlUCSIsCatSc();
40007 test_ret += test_xmlUCSIsCatSk();
40008 test_ret += test_xmlUCSIsCatSm();
40009 test_ret += test_xmlUCSIsCatSo();
40010 test_ret += test_xmlUCSIsCatZ();
40011 test_ret += test_xmlUCSIsCatZl();
40012 test_ret += test_xmlUCSIsCatZp();
40013 test_ret += test_xmlUCSIsCatZs();
40014 test_ret += test_xmlUCSIsCherokee();
40015 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40016 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40017 test_ret += test_xmlUCSIsCombiningHalfMarks();
40018 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40019 test_ret += test_xmlUCSIsControlPictures();
40020 test_ret += test_xmlUCSIsCurrencySymbols();
40021 test_ret += test_xmlUCSIsCypriotSyllabary();
40022 test_ret += test_xmlUCSIsCyrillic();
40023 test_ret += test_xmlUCSIsCyrillicSupplement();
40024 test_ret += test_xmlUCSIsDeseret();
40025 test_ret += test_xmlUCSIsDevanagari();
40026 test_ret += test_xmlUCSIsDingbats();
40027 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40028 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40029 test_ret += test_xmlUCSIsEthiopic();
40030 test_ret += test_xmlUCSIsGeneralPunctuation();
40031 test_ret += test_xmlUCSIsGeometricShapes();
40032 test_ret += test_xmlUCSIsGeorgian();
40033 test_ret += test_xmlUCSIsGothic();
40034 test_ret += test_xmlUCSIsGreek();
40035 test_ret += test_xmlUCSIsGreekExtended();
40036 test_ret += test_xmlUCSIsGreekandCoptic();
40037 test_ret += test_xmlUCSIsGujarati();
40038 test_ret += test_xmlUCSIsGurmukhi();
40039 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40040 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40041 test_ret += test_xmlUCSIsHangulJamo();
40042 test_ret += test_xmlUCSIsHangulSyllables();
40043 test_ret += test_xmlUCSIsHanunoo();
40044 test_ret += test_xmlUCSIsHebrew();
40045 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40046 test_ret += test_xmlUCSIsHighSurrogates();
40047 test_ret += test_xmlUCSIsHiragana();
40048 test_ret += test_xmlUCSIsIPAExtensions();
40049 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40050 test_ret += test_xmlUCSIsKanbun();
40051 test_ret += test_xmlUCSIsKangxiRadicals();
40052 test_ret += test_xmlUCSIsKannada();
40053 test_ret += test_xmlUCSIsKatakana();
40054 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40055 test_ret += test_xmlUCSIsKhmer();
40056 test_ret += test_xmlUCSIsKhmerSymbols();
40057 test_ret += test_xmlUCSIsLao();
40058 test_ret += test_xmlUCSIsLatin1Supplement();
40059 test_ret += test_xmlUCSIsLatinExtendedA();
40060 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40061 test_ret += test_xmlUCSIsLatinExtendedB();
40062 test_ret += test_xmlUCSIsLetterlikeSymbols();
40063 test_ret += test_xmlUCSIsLimbu();
40064 test_ret += test_xmlUCSIsLinearBIdeograms();
40065 test_ret += test_xmlUCSIsLinearBSyllabary();
40066 test_ret += test_xmlUCSIsLowSurrogates();
40067 test_ret += test_xmlUCSIsMalayalam();
40068 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40069 test_ret += test_xmlUCSIsMathematicalOperators();
40070 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40071 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40072 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40073 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40074 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40075 test_ret += test_xmlUCSIsMongolian();
40076 test_ret += test_xmlUCSIsMusicalSymbols();
40077 test_ret += test_xmlUCSIsMyanmar();
40078 test_ret += test_xmlUCSIsNumberForms();
40079 test_ret += test_xmlUCSIsOgham();
40080 test_ret += test_xmlUCSIsOldItalic();
40081 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40082 test_ret += test_xmlUCSIsOriya();
40083 test_ret += test_xmlUCSIsOsmanya();
40084 test_ret += test_xmlUCSIsPhoneticExtensions();
40085 test_ret += test_xmlUCSIsPrivateUse();
40086 test_ret += test_xmlUCSIsPrivateUseArea();
40087 test_ret += test_xmlUCSIsRunic();
40088 test_ret += test_xmlUCSIsShavian();
40089 test_ret += test_xmlUCSIsSinhala();
40090 test_ret += test_xmlUCSIsSmallFormVariants();
40091 test_ret += test_xmlUCSIsSpacingModifierLetters();
40092 test_ret += test_xmlUCSIsSpecials();
40093 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40094 test_ret += test_xmlUCSIsSupplementalArrowsA();
40095 test_ret += test_xmlUCSIsSupplementalArrowsB();
40096 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40097 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40098 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40099 test_ret += test_xmlUCSIsSyriac();
40100 test_ret += test_xmlUCSIsTagalog();
40101 test_ret += test_xmlUCSIsTagbanwa();
40102 test_ret += test_xmlUCSIsTags();
40103 test_ret += test_xmlUCSIsTaiLe();
40104 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40105 test_ret += test_xmlUCSIsTamil();
40106 test_ret += test_xmlUCSIsTelugu();
40107 test_ret += test_xmlUCSIsThaana();
40108 test_ret += test_xmlUCSIsThai();
40109 test_ret += test_xmlUCSIsTibetan();
40110 test_ret += test_xmlUCSIsUgaritic();
40111 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40112 test_ret += test_xmlUCSIsVariationSelectors();
40113 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40114 test_ret += test_xmlUCSIsYiRadicals();
40115 test_ret += test_xmlUCSIsYiSyllables();
40116 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040117
Daniel Veillard42595322004-11-08 10:52:06 +000040118 if (test_ret != 0)
40119 printf("Module xmlunicode: %d errors\n", test_ret);
40120 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040121}
40122
40123static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040124test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040126
William M. Brack21e4ef22005-01-02 09:53:13 +000040127#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040128 int mem_base;
40129 xmlTextWriterPtr ret_val;
40130 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40131 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040132
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040133 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40134 mem_base = xmlMemBlocks();
40135 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040136
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040137 ret_val = xmlNewTextWriter(out);
40138 if (ret_val != NULL) out = NULL;
40139 desret_xmlTextWriterPtr(ret_val);
40140 call_tests++;
40141 des_xmlOutputBufferPtr(n_out, out, 0);
40142 xmlResetLastError();
40143 if (mem_base != xmlMemBlocks()) {
40144 printf("Leak of %d blocks found in xmlNewTextWriter",
40145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040146 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040147 printf(" %d", n_out);
40148 printf("\n");
40149 }
40150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040151 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040152#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040153
Daniel Veillard42595322004-11-08 10:52:06 +000040154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040155}
40156
40157
40158static int
40159test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040161
William M. Brack21e4ef22005-01-02 09:53:13 +000040162#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040163 int mem_base;
40164 xmlTextWriterPtr ret_val;
40165 const char * uri; /* the URI of the resource for the output */
40166 int n_uri;
40167 int compression; /* compress the output? */
40168 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040169
Daniel Veillard42595322004-11-08 10:52:06 +000040170 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040171 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40172 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040173 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040174 compression = gen_int(n_compression, 1);
40175
40176 ret_val = xmlNewTextWriterFilename(uri, compression);
40177 desret_xmlTextWriterPtr(ret_val);
40178 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040179 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040180 des_int(n_compression, compression, 1);
40181 xmlResetLastError();
40182 if (mem_base != xmlMemBlocks()) {
40183 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040185 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040186 printf(" %d", n_uri);
40187 printf(" %d", n_compression);
40188 printf("\n");
40189 }
40190 }
40191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040192 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040193#endif
40194
Daniel Veillard42595322004-11-08 10:52:06 +000040195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040196}
40197
40198
40199static int
40200test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040202
William M. Brack21e4ef22005-01-02 09:53:13 +000040203#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040204 int mem_base;
40205 xmlTextWriterPtr ret_val;
40206 xmlBufferPtr buf; /* xmlBufferPtr */
40207 int n_buf;
40208 int compression; /* compress the output? */
40209 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040210
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040211 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40212 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40213 mem_base = xmlMemBlocks();
40214 buf = gen_xmlBufferPtr(n_buf, 0);
40215 compression = gen_int(n_compression, 1);
40216
40217 ret_val = xmlNewTextWriterMemory(buf, compression);
40218 desret_xmlTextWriterPtr(ret_val);
40219 call_tests++;
40220 des_xmlBufferPtr(n_buf, buf, 0);
40221 des_int(n_compression, compression, 1);
40222 xmlResetLastError();
40223 if (mem_base != xmlMemBlocks()) {
40224 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040226 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040227 printf(" %d", n_buf);
40228 printf(" %d", n_compression);
40229 printf("\n");
40230 }
40231 }
40232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040233 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040234#endif
40235
Daniel Veillard42595322004-11-08 10:52:06 +000040236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040237}
40238
40239
40240static int
40241test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040243
William M. Brack21e4ef22005-01-02 09:53:13 +000040244#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040245 int mem_base;
40246 xmlTextWriterPtr ret_val;
40247 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40248 int n_ctxt;
40249 int compression; /* compress the output? */
40250 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040251
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040252 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40253 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40254 mem_base = xmlMemBlocks();
40255 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40256 compression = gen_int(n_compression, 1);
40257
40258 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040259 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040260 desret_xmlTextWriterPtr(ret_val);
40261 call_tests++;
40262 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40263 des_int(n_compression, compression, 1);
40264 xmlResetLastError();
40265 if (mem_base != xmlMemBlocks()) {
40266 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040268 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040269 printf(" %d", n_ctxt);
40270 printf(" %d", n_compression);
40271 printf("\n");
40272 }
40273 }
40274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040275 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040276#endif
40277
Daniel Veillard42595322004-11-08 10:52:06 +000040278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040279}
40280
40281
40282static int
40283test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040285
William M. Brack21e4ef22005-01-02 09:53:13 +000040286#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040287 int mem_base;
40288 xmlTextWriterPtr ret_val;
40289 xmlDocPtr doc; /* xmlDocPtr */
40290 int n_doc;
40291 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40292 int n_node;
40293 int compression; /* compress the output? */
40294 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040295
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40297 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40298 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40299 mem_base = xmlMemBlocks();
40300 doc = gen_xmlDocPtr(n_doc, 0);
40301 node = gen_xmlNodePtr(n_node, 1);
40302 compression = gen_int(n_compression, 2);
40303
40304 ret_val = xmlNewTextWriterTree(doc, node, compression);
40305 desret_xmlTextWriterPtr(ret_val);
40306 call_tests++;
40307 des_xmlDocPtr(n_doc, doc, 0);
40308 des_xmlNodePtr(n_node, node, 1);
40309 des_int(n_compression, compression, 2);
40310 xmlResetLastError();
40311 if (mem_base != xmlMemBlocks()) {
40312 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040314 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040315 printf(" %d", n_doc);
40316 printf(" %d", n_node);
40317 printf(" %d", n_compression);
40318 printf("\n");
40319 }
40320 }
40321 }
40322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040323 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040324#endif
40325
Daniel Veillard42595322004-11-08 10:52:06 +000040326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040327}
40328
40329
40330static int
40331test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040333
William M. Brack21e4ef22005-01-02 09:53:13 +000040334#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040335 int mem_base;
40336 int ret_val;
40337 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40338 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040339
Daniel Veillarde43cc572004-11-03 11:50:29 +000040340 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40341 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040342 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040343
40344 ret_val = xmlTextWriterEndAttribute(writer);
40345 desret_int(ret_val);
40346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040347 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040348 xmlResetLastError();
40349 if (mem_base != xmlMemBlocks()) {
40350 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040352 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040353 printf(" %d", n_writer);
40354 printf("\n");
40355 }
40356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040357 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040358#endif
40359
Daniel Veillard42595322004-11-08 10:52:06 +000040360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040361}
40362
40363
40364static int
40365test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040367
William M. Brack21e4ef22005-01-02 09:53:13 +000040368#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040369 int mem_base;
40370 int ret_val;
40371 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40372 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040373
Daniel Veillarde43cc572004-11-03 11:50:29 +000040374 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040376 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040377
40378 ret_val = xmlTextWriterEndCDATA(writer);
40379 desret_int(ret_val);
40380 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040381 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040382 xmlResetLastError();
40383 if (mem_base != xmlMemBlocks()) {
40384 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040386 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040387 printf(" %d", n_writer);
40388 printf("\n");
40389 }
40390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040391 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040392#endif
40393
Daniel Veillard42595322004-11-08 10:52:06 +000040394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040395}
40396
40397
40398static int
40399test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040401
William M. Brack21e4ef22005-01-02 09:53:13 +000040402#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040403 int mem_base;
40404 int ret_val;
40405 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40406 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040407
Daniel Veillarde43cc572004-11-03 11:50:29 +000040408 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040410 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040411
40412 ret_val = xmlTextWriterEndComment(writer);
40413 desret_int(ret_val);
40414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040415 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040416 xmlResetLastError();
40417 if (mem_base != xmlMemBlocks()) {
40418 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040420 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040421 printf(" %d", n_writer);
40422 printf("\n");
40423 }
40424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040425 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040426#endif
40427
Daniel Veillard42595322004-11-08 10:52:06 +000040428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040429}
40430
40431
40432static int
40433test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040435
William M. Brack21e4ef22005-01-02 09:53:13 +000040436#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040437 int mem_base;
40438 int ret_val;
40439 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40440 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040441
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40443 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040444 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040445
40446 ret_val = xmlTextWriterEndDTD(writer);
40447 desret_int(ret_val);
40448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040449 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040450 xmlResetLastError();
40451 if (mem_base != xmlMemBlocks()) {
40452 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040454 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040455 printf(" %d", n_writer);
40456 printf("\n");
40457 }
40458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040459 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040460#endif
40461
Daniel Veillard42595322004-11-08 10:52:06 +000040462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040463}
40464
40465
40466static int
40467test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040469
William M. Brack21e4ef22005-01-02 09:53:13 +000040470#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040471 int mem_base;
40472 int ret_val;
40473 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40474 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040475
Daniel Veillarde43cc572004-11-03 11:50:29 +000040476 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040478 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040479
40480 ret_val = xmlTextWriterEndDTDAttlist(writer);
40481 desret_int(ret_val);
40482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040483 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040484 xmlResetLastError();
40485 if (mem_base != xmlMemBlocks()) {
40486 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040488 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040489 printf(" %d", n_writer);
40490 printf("\n");
40491 }
40492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040493 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494#endif
40495
Daniel Veillard42595322004-11-08 10:52:06 +000040496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040497}
40498
40499
40500static int
40501test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040503
William M. Brack21e4ef22005-01-02 09:53:13 +000040504#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040505 int mem_base;
40506 int ret_val;
40507 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40508 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040509
Daniel Veillarde43cc572004-11-03 11:50:29 +000040510 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040512 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040513
40514 ret_val = xmlTextWriterEndDTDElement(writer);
40515 desret_int(ret_val);
40516 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040517 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040518 xmlResetLastError();
40519 if (mem_base != xmlMemBlocks()) {
40520 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040522 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040523 printf(" %d", n_writer);
40524 printf("\n");
40525 }
40526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040527 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040528#endif
40529
Daniel Veillard42595322004-11-08 10:52:06 +000040530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040531}
40532
40533
40534static int
40535test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040537
William M. Brack21e4ef22005-01-02 09:53:13 +000040538#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040539 int mem_base;
40540 int ret_val;
40541 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40542 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040543
Daniel Veillarde43cc572004-11-03 11:50:29 +000040544 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040546 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040547
40548 ret_val = xmlTextWriterEndDTDEntity(writer);
40549 desret_int(ret_val);
40550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040551 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040552 xmlResetLastError();
40553 if (mem_base != xmlMemBlocks()) {
40554 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040556 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040557 printf(" %d", n_writer);
40558 printf("\n");
40559 }
40560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040561 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040562#endif
40563
Daniel Veillard42595322004-11-08 10:52:06 +000040564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040565}
40566
40567
40568static int
40569test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040571
William M. Brack21e4ef22005-01-02 09:53:13 +000040572#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040573 int mem_base;
40574 int ret_val;
40575 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40576 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040577
Daniel Veillarde43cc572004-11-03 11:50:29 +000040578 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040580 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040581
40582 ret_val = xmlTextWriterEndDocument(writer);
40583 desret_int(ret_val);
40584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040585 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040586 xmlResetLastError();
40587 if (mem_base != xmlMemBlocks()) {
40588 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040590 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040591 printf(" %d", n_writer);
40592 printf("\n");
40593 }
40594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040595 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040596#endif
40597
Daniel Veillard42595322004-11-08 10:52:06 +000040598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040599}
40600
40601
40602static int
40603test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040605
William M. Brack21e4ef22005-01-02 09:53:13 +000040606#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040607 int mem_base;
40608 int ret_val;
40609 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40610 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040611
Daniel Veillarde43cc572004-11-03 11:50:29 +000040612 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040614 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040615
40616 ret_val = xmlTextWriterEndElement(writer);
40617 desret_int(ret_val);
40618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040619 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040620 xmlResetLastError();
40621 if (mem_base != xmlMemBlocks()) {
40622 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040624 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040625 printf(" %d", n_writer);
40626 printf("\n");
40627 }
40628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040629 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040630#endif
40631
Daniel Veillard42595322004-11-08 10:52:06 +000040632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040633}
40634
40635
40636static int
40637test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040639
William M. Brack21e4ef22005-01-02 09:53:13 +000040640#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040641 int mem_base;
40642 int ret_val;
40643 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40644 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040645
Daniel Veillarde43cc572004-11-03 11:50:29 +000040646 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40647 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040648 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040649
40650 ret_val = xmlTextWriterEndPI(writer);
40651 desret_int(ret_val);
40652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040653 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040654 xmlResetLastError();
40655 if (mem_base != xmlMemBlocks()) {
40656 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040658 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040659 printf(" %d", n_writer);
40660 printf("\n");
40661 }
40662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040663 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664#endif
40665
Daniel Veillard42595322004-11-08 10:52:06 +000040666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040667}
40668
40669
40670static int
40671test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040673
William M. Brack21e4ef22005-01-02 09:53:13 +000040674#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040675 int mem_base;
40676 int ret_val;
40677 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40678 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040679
Daniel Veillarde43cc572004-11-03 11:50:29 +000040680 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040682 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040683
40684 ret_val = xmlTextWriterFlush(writer);
40685 desret_int(ret_val);
40686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040687 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688 xmlResetLastError();
40689 if (mem_base != xmlMemBlocks()) {
40690 printf("Leak of %d blocks found in xmlTextWriterFlush",
40691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040692 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693 printf(" %d", n_writer);
40694 printf("\n");
40695 }
40696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040697 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040698#endif
40699
Daniel Veillard42595322004-11-08 10:52:06 +000040700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040701}
40702
40703
40704static int
40705test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040707
William M. Brack21e4ef22005-01-02 09:53:13 +000040708#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040709 int mem_base;
40710 int ret_val;
40711 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40712 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040713
Daniel Veillarde43cc572004-11-03 11:50:29 +000040714 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40715 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040716 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717
40718 ret_val = xmlTextWriterFullEndElement(writer);
40719 desret_int(ret_val);
40720 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040721 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722 xmlResetLastError();
40723 if (mem_base != xmlMemBlocks()) {
40724 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040726 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727 printf(" %d", n_writer);
40728 printf("\n");
40729 }
40730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040731 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732#endif
40733
Daniel Veillard42595322004-11-08 10:52:06 +000040734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040735}
40736
40737
40738static int
40739test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040741
William M. Brack21e4ef22005-01-02 09:53:13 +000040742#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040743 int mem_base;
40744 int ret_val;
40745 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40746 int n_writer;
40747 int indent; /* do indentation? */
40748 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040749
Daniel Veillarde43cc572004-11-03 11:50:29 +000040750 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40751 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040753 writer = gen_xmlTextWriterPtr(n_writer, 0);
40754 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040755
40756 ret_val = xmlTextWriterSetIndent(writer, indent);
40757 desret_int(ret_val);
40758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040759 des_xmlTextWriterPtr(n_writer, writer, 0);
40760 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761 xmlResetLastError();
40762 if (mem_base != xmlMemBlocks()) {
40763 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040765 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766 printf(" %d", n_writer);
40767 printf(" %d", n_indent);
40768 printf("\n");
40769 }
40770 }
40771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040772 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040773#endif
40774
Daniel Veillard42595322004-11-08 10:52:06 +000040775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040776}
40777
40778
40779static int
40780test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040782
William M. Brack21e4ef22005-01-02 09:53:13 +000040783#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784 int mem_base;
40785 int ret_val;
40786 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40787 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040788 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040789 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040790
Daniel Veillarde43cc572004-11-03 11:50:29 +000040791 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40792 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040794 writer = gen_xmlTextWriterPtr(n_writer, 0);
40795 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040796
William M. Brackf13f77f2004-11-12 16:03:48 +000040797 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040798 desret_int(ret_val);
40799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040800 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040801 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802 xmlResetLastError();
40803 if (mem_base != xmlMemBlocks()) {
40804 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040806 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040807 printf(" %d", n_writer);
40808 printf(" %d", n_str);
40809 printf("\n");
40810 }
40811 }
40812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040813 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040814#endif
40815
Daniel Veillard42595322004-11-08 10:52:06 +000040816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040817}
40818
40819
40820static int
40821test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040823
William M. Brack21e4ef22005-01-02 09:53:13 +000040824#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040825 int mem_base;
40826 int ret_val;
40827 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40828 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040829 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040830 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040831
Daniel Veillarde43cc572004-11-03 11:50:29 +000040832 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40834 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040835 writer = gen_xmlTextWriterPtr(n_writer, 0);
40836 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040837
William M. Brackf13f77f2004-11-12 16:03:48 +000040838 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040839 desret_int(ret_val);
40840 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040841 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040842 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040843 xmlResetLastError();
40844 if (mem_base != xmlMemBlocks()) {
40845 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040847 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040848 printf(" %d", n_writer);
40849 printf(" %d", n_name);
40850 printf("\n");
40851 }
40852 }
40853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040854 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040855#endif
40856
Daniel Veillard42595322004-11-08 10:52:06 +000040857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040858}
40859
40860
40861static int
40862test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040864
William M. Brack21e4ef22005-01-02 09:53:13 +000040865#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040866 int mem_base;
40867 int ret_val;
40868 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40869 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040870 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040871 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040872 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040873 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040874 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040875 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040876
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40878 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40880 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040882 writer = gen_xmlTextWriterPtr(n_writer, 0);
40883 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40884 name = gen_const_xmlChar_ptr(n_name, 2);
40885 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040886
William M. Brackf13f77f2004-11-12 16:03:48 +000040887 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040888 desret_int(ret_val);
40889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040890 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040891 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40892 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40893 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040894 xmlResetLastError();
40895 if (mem_base != xmlMemBlocks()) {
40896 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040899 printf(" %d", n_writer);
40900 printf(" %d", n_prefix);
40901 printf(" %d", n_name);
40902 printf(" %d", n_namespaceURI);
40903 printf("\n");
40904 }
40905 }
40906 }
40907 }
40908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040909 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040910#endif
40911
Daniel Veillard42595322004-11-08 10:52:06 +000040912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040913}
40914
40915
40916static int
40917test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040919
William M. Brack21e4ef22005-01-02 09:53:13 +000040920#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040921 int mem_base;
40922 int ret_val;
40923 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40924 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040925
Daniel Veillarde43cc572004-11-03 11:50:29 +000040926 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040928 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040929
40930 ret_val = xmlTextWriterStartCDATA(writer);
40931 desret_int(ret_val);
40932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040933 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040934 xmlResetLastError();
40935 if (mem_base != xmlMemBlocks()) {
40936 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040938 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 printf(" %d", n_writer);
40940 printf("\n");
40941 }
40942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040943 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040944#endif
40945
Daniel Veillard42595322004-11-08 10:52:06 +000040946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040947}
40948
40949
40950static int
40951test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040953
William M. Brack21e4ef22005-01-02 09:53:13 +000040954#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040955 int mem_base;
40956 int ret_val;
40957 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40958 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040959
Daniel Veillarde43cc572004-11-03 11:50:29 +000040960 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040962 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040963
40964 ret_val = xmlTextWriterStartComment(writer);
40965 desret_int(ret_val);
40966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040967 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968 xmlResetLastError();
40969 if (mem_base != xmlMemBlocks()) {
40970 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040972 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973 printf(" %d", n_writer);
40974 printf("\n");
40975 }
40976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040977 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040978#endif
40979
Daniel Veillard42595322004-11-08 10:52:06 +000040980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040981}
40982
40983
40984static int
40985test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040987
William M. Brack21e4ef22005-01-02 09:53:13 +000040988#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040989 int mem_base;
40990 int ret_val;
40991 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40992 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040993 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040994 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040995 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040996 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040997 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040998 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040999
Daniel Veillarde43cc572004-11-03 11:50:29 +000041000 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41001 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41002 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41003 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041005 writer = gen_xmlTextWriterPtr(n_writer, 0);
41006 name = gen_const_xmlChar_ptr(n_name, 1);
41007 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41008 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041009
William M. Brackf13f77f2004-11-12 16:03:48 +000041010 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041011 desret_int(ret_val);
41012 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041013 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041014 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41015 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41016 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 xmlResetLastError();
41018 if (mem_base != xmlMemBlocks()) {
41019 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041021 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022 printf(" %d", n_writer);
41023 printf(" %d", n_name);
41024 printf(" %d", n_pubid);
41025 printf(" %d", n_sysid);
41026 printf("\n");
41027 }
41028 }
41029 }
41030 }
41031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041032 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041033#endif
41034
Daniel Veillard42595322004-11-08 10:52:06 +000041035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041036}
41037
41038
41039static int
41040test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041042
William M. Brack21e4ef22005-01-02 09:53:13 +000041043#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041044 int mem_base;
41045 int ret_val;
41046 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41047 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041048 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041049 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041050
Daniel Veillarde43cc572004-11-03 11:50:29 +000041051 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41052 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041054 writer = gen_xmlTextWriterPtr(n_writer, 0);
41055 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041056
William M. Brackf13f77f2004-11-12 16:03:48 +000041057 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041058 desret_int(ret_val);
41059 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041060 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041061 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041062 xmlResetLastError();
41063 if (mem_base != xmlMemBlocks()) {
41064 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041066 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067 printf(" %d", n_writer);
41068 printf(" %d", n_name);
41069 printf("\n");
41070 }
41071 }
41072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041073 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041074#endif
41075
Daniel Veillard42595322004-11-08 10:52:06 +000041076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041077}
41078
41079
41080static int
41081test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041083
William M. Brack21e4ef22005-01-02 09:53:13 +000041084#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041085 int mem_base;
41086 int ret_val;
41087 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41088 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041089 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041090 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041091
Daniel Veillarde43cc572004-11-03 11:50:29 +000041092 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41093 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041095 writer = gen_xmlTextWriterPtr(n_writer, 0);
41096 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041097
William M. Brackf13f77f2004-11-12 16:03:48 +000041098 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041099 desret_int(ret_val);
41100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041101 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041102 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041103 xmlResetLastError();
41104 if (mem_base != xmlMemBlocks()) {
41105 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041107 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041108 printf(" %d", n_writer);
41109 printf(" %d", n_name);
41110 printf("\n");
41111 }
41112 }
41113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041114 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041115#endif
41116
Daniel Veillard42595322004-11-08 10:52:06 +000041117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041118}
41119
41120
41121static int
41122test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041124
William M. Brack21e4ef22005-01-02 09:53:13 +000041125#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041126 int mem_base;
41127 int ret_val;
41128 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41129 int n_writer;
41130 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41131 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041132 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041133 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041134
Daniel Veillarde43cc572004-11-03 11:50:29 +000041135 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41136 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041139 writer = gen_xmlTextWriterPtr(n_writer, 0);
41140 pe = gen_int(n_pe, 1);
41141 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041142
William M. Brackf13f77f2004-11-12 16:03:48 +000041143 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041144 desret_int(ret_val);
41145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041146 des_xmlTextWriterPtr(n_writer, writer, 0);
41147 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041148 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041149 xmlResetLastError();
41150 if (mem_base != xmlMemBlocks()) {
41151 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041153 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041154 printf(" %d", n_writer);
41155 printf(" %d", n_pe);
41156 printf(" %d", n_name);
41157 printf("\n");
41158 }
41159 }
41160 }
41161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041162 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163#endif
41164
Daniel Veillard42595322004-11-08 10:52:06 +000041165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041166}
41167
41168
41169static int
41170test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041172
William M. Brack21e4ef22005-01-02 09:53:13 +000041173#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041174 int mem_base;
41175 int ret_val;
41176 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41177 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041178 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041180 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041181 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041182 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041183 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041184
Daniel Veillarde43cc572004-11-03 11:50:29 +000041185 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41186 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41187 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41188 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41189 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041190 writer = gen_xmlTextWriterPtr(n_writer, 0);
41191 version = gen_const_char_ptr(n_version, 1);
41192 encoding = gen_const_char_ptr(n_encoding, 2);
41193 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041194
William M. Brackf13f77f2004-11-12 16:03:48 +000041195 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041196 desret_int(ret_val);
41197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041198 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041199 des_const_char_ptr(n_version, (const char *)version, 1);
41200 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41201 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041202 xmlResetLastError();
41203 if (mem_base != xmlMemBlocks()) {
41204 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041206 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041207 printf(" %d", n_writer);
41208 printf(" %d", n_version);
41209 printf(" %d", n_encoding);
41210 printf(" %d", n_standalone);
41211 printf("\n");
41212 }
41213 }
41214 }
41215 }
41216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041217 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218#endif
41219
Daniel Veillard42595322004-11-08 10:52:06 +000041220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041221}
41222
41223
41224static int
41225test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041227
William M. Brack21e4ef22005-01-02 09:53:13 +000041228#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041229 int mem_base;
41230 int ret_val;
41231 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41232 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041233 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041234 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041235
Daniel Veillarde43cc572004-11-03 11:50:29 +000041236 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41237 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041239 writer = gen_xmlTextWriterPtr(n_writer, 0);
41240 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041241
William M. Brackf13f77f2004-11-12 16:03:48 +000041242 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041243 desret_int(ret_val);
41244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041245 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041246 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041247 xmlResetLastError();
41248 if (mem_base != xmlMemBlocks()) {
41249 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041251 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041252 printf(" %d", n_writer);
41253 printf(" %d", n_name);
41254 printf("\n");
41255 }
41256 }
41257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041258 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041259#endif
41260
Daniel Veillard42595322004-11-08 10:52:06 +000041261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041262}
41263
41264
41265static int
41266test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041268
William M. Brack21e4ef22005-01-02 09:53:13 +000041269#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041270 int mem_base;
41271 int ret_val;
41272 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41273 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041274 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041275 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041276 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041277 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041278 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041280
Daniel Veillarde43cc572004-11-03 11:50:29 +000041281 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41282 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41283 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41284 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041286 writer = gen_xmlTextWriterPtr(n_writer, 0);
41287 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41288 name = gen_const_xmlChar_ptr(n_name, 2);
41289 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041290
William M. Brackf13f77f2004-11-12 16:03:48 +000041291 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292 desret_int(ret_val);
41293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041294 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041295 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41296 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41297 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298 xmlResetLastError();
41299 if (mem_base != xmlMemBlocks()) {
41300 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041302 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041303 printf(" %d", n_writer);
41304 printf(" %d", n_prefix);
41305 printf(" %d", n_name);
41306 printf(" %d", n_namespaceURI);
41307 printf("\n");
41308 }
41309 }
41310 }
41311 }
41312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041313 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041314#endif
41315
Daniel Veillard42595322004-11-08 10:52:06 +000041316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041317}
41318
41319
41320static int
41321test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041323
William M. Brack21e4ef22005-01-02 09:53:13 +000041324#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041325 int mem_base;
41326 int ret_val;
41327 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41328 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041329 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041330 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041331
Daniel Veillarde43cc572004-11-03 11:50:29 +000041332 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41333 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041335 writer = gen_xmlTextWriterPtr(n_writer, 0);
41336 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337
William M. Brackf13f77f2004-11-12 16:03:48 +000041338 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041339 desret_int(ret_val);
41340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041341 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041342 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041343 xmlResetLastError();
41344 if (mem_base != xmlMemBlocks()) {
41345 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041347 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041348 printf(" %d", n_writer);
41349 printf(" %d", n_target);
41350 printf("\n");
41351 }
41352 }
41353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041354 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041355#endif
41356
Daniel Veillard42595322004-11-08 10:52:06 +000041357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041358}
41359
41360
41361static int
41362test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041364
William M. Brack21e4ef22005-01-02 09:53:13 +000041365#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041366 int mem_base;
41367 int ret_val;
41368 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41369 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041370 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041371 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041372 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041373 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041374
Daniel Veillarde43cc572004-11-03 11:50:29 +000041375 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41376 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41377 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041379 writer = gen_xmlTextWriterPtr(n_writer, 0);
41380 name = gen_const_xmlChar_ptr(n_name, 1);
41381 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382
William M. Brackf13f77f2004-11-12 16:03:48 +000041383 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041384 desret_int(ret_val);
41385 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041386 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041387 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41388 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041389 xmlResetLastError();
41390 if (mem_base != xmlMemBlocks()) {
41391 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041393 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041394 printf(" %d", n_writer);
41395 printf(" %d", n_name);
41396 printf(" %d", n_content);
41397 printf("\n");
41398 }
41399 }
41400 }
41401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041402 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041403#endif
41404
Daniel Veillard42595322004-11-08 10:52:06 +000041405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041406}
41407
41408
41409static int
41410test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041412
William M. Brack21e4ef22005-01-02 09:53:13 +000041413#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041414 int mem_base;
41415 int ret_val;
41416 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41417 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041418 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041420 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041422 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041424 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041426
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41428 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41429 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41430 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41431 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041433 writer = gen_xmlTextWriterPtr(n_writer, 0);
41434 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41435 name = gen_const_xmlChar_ptr(n_name, 2);
41436 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41437 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438
William M. Brackf13f77f2004-11-12 16:03:48 +000041439 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041440 desret_int(ret_val);
41441 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041442 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041443 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41444 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41445 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41446 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041447 xmlResetLastError();
41448 if (mem_base != xmlMemBlocks()) {
41449 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041451 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041452 printf(" %d", n_writer);
41453 printf(" %d", n_prefix);
41454 printf(" %d", n_name);
41455 printf(" %d", n_namespaceURI);
41456 printf(" %d", n_content);
41457 printf("\n");
41458 }
41459 }
41460 }
41461 }
41462 }
41463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041464 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041465#endif
41466
Daniel Veillard42595322004-11-08 10:52:06 +000041467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041468}
41469
41470
41471static int
41472test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041474
William M. Brack21e4ef22005-01-02 09:53:13 +000041475#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041476 int mem_base;
41477 int ret_val;
41478 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41479 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041480 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041481 int n_data;
41482 int start; /* the position within the data of the first byte to encode */
41483 int n_start;
41484 int len; /* the number of bytes to encode */
41485 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041486
Daniel Veillarde43cc572004-11-03 11:50:29 +000041487 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41488 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41489 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41490 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41491 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041492 writer = gen_xmlTextWriterPtr(n_writer, 0);
41493 data = gen_const_char_ptr(n_data, 1);
41494 start = gen_int(n_start, 2);
41495 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041496
William M. Brackf13f77f2004-11-12 16:03:48 +000041497 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041498 desret_int(ret_val);
41499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041500 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041501 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041502 des_int(n_start, start, 2);
41503 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041504 xmlResetLastError();
41505 if (mem_base != xmlMemBlocks()) {
41506 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041508 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041509 printf(" %d", n_writer);
41510 printf(" %d", n_data);
41511 printf(" %d", n_start);
41512 printf(" %d", n_len);
41513 printf("\n");
41514 }
41515 }
41516 }
41517 }
41518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041519 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520#endif
41521
Daniel Veillard42595322004-11-08 10:52:06 +000041522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041523}
41524
41525
41526static int
41527test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041529
William M. Brack21e4ef22005-01-02 09:53:13 +000041530#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 int mem_base;
41532 int ret_val;
41533 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41534 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041535 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041536 int n_data;
41537 int start; /* the position within the data of the first byte to encode */
41538 int n_start;
41539 int len; /* the number of bytes to encode */
41540 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041541
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41543 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41544 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41545 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041547 writer = gen_xmlTextWriterPtr(n_writer, 0);
41548 data = gen_const_char_ptr(n_data, 1);
41549 start = gen_int(n_start, 2);
41550 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041551
William M. Brackf13f77f2004-11-12 16:03:48 +000041552 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041553 desret_int(ret_val);
41554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041555 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041556 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041557 des_int(n_start, start, 2);
41558 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041559 xmlResetLastError();
41560 if (mem_base != xmlMemBlocks()) {
41561 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041563 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041564 printf(" %d", n_writer);
41565 printf(" %d", n_data);
41566 printf(" %d", n_start);
41567 printf(" %d", n_len);
41568 printf("\n");
41569 }
41570 }
41571 }
41572 }
41573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041574 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041575#endif
41576
Daniel Veillard42595322004-11-08 10:52:06 +000041577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041578}
41579
41580
41581static int
41582test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041584
William M. Brack21e4ef22005-01-02 09:53:13 +000041585#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586 int mem_base;
41587 int ret_val;
41588 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41589 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041590 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041591 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041592
Daniel Veillarde43cc572004-11-03 11:50:29 +000041593 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41594 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041596 writer = gen_xmlTextWriterPtr(n_writer, 0);
41597 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041598
William M. Brackf13f77f2004-11-12 16:03:48 +000041599 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041600 desret_int(ret_val);
41601 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041602 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041603 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604 xmlResetLastError();
41605 if (mem_base != xmlMemBlocks()) {
41606 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041608 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041609 printf(" %d", n_writer);
41610 printf(" %d", n_content);
41611 printf("\n");
41612 }
41613 }
41614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041615 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041616#endif
41617
Daniel Veillard42595322004-11-08 10:52:06 +000041618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041619}
41620
41621
41622static int
41623test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041625
William M. Brack21e4ef22005-01-02 09:53:13 +000041626#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041627 int mem_base;
41628 int ret_val;
41629 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41630 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041631 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041632 int n_content;
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 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041637 writer = gen_xmlTextWriterPtr(n_writer, 0);
41638 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041639
William M. Brackf13f77f2004-11-12 16:03:48 +000041640 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041641 desret_int(ret_val);
41642 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041643 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041644 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041645 xmlResetLastError();
41646 if (mem_base != xmlMemBlocks()) {
41647 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041649 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041650 printf(" %d", n_writer);
41651 printf(" %d", n_content);
41652 printf("\n");
41653 }
41654 }
41655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041656 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041657#endif
41658
Daniel Veillard42595322004-11-08 10:52:06 +000041659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041660}
41661
41662
41663static int
41664test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041666
William M. Brack21e4ef22005-01-02 09:53:13 +000041667#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 int mem_base;
41669 int ret_val;
41670 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41671 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041672 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041673 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041674 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041675 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041676 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041677 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041678 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041679 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041680
Daniel Veillarde43cc572004-11-03 11:50:29 +000041681 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41682 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41683 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41684 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41685 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41686 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041687 writer = gen_xmlTextWriterPtr(n_writer, 0);
41688 name = gen_const_xmlChar_ptr(n_name, 1);
41689 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41690 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41691 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041692
William M. Brackf13f77f2004-11-12 16:03:48 +000041693 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041694 desret_int(ret_val);
41695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041696 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041697 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41698 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41699 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41700 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701 xmlResetLastError();
41702 if (mem_base != xmlMemBlocks()) {
41703 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041705 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041706 printf(" %d", n_writer);
41707 printf(" %d", n_name);
41708 printf(" %d", n_pubid);
41709 printf(" %d", n_sysid);
41710 printf(" %d", n_subset);
41711 printf("\n");
41712 }
41713 }
41714 }
41715 }
41716 }
41717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041718 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041719#endif
41720
Daniel Veillard42595322004-11-08 10:52:06 +000041721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041722}
41723
41724
41725static int
41726test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041728
William M. Brack21e4ef22005-01-02 09:53:13 +000041729#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041730 int mem_base;
41731 int ret_val;
41732 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41733 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041734 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041735 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041736 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041737 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041738
Daniel Veillarde43cc572004-11-03 11:50:29 +000041739 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41740 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41741 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41742 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041743 writer = gen_xmlTextWriterPtr(n_writer, 0);
41744 name = gen_const_xmlChar_ptr(n_name, 1);
41745 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041746
William M. Brackf13f77f2004-11-12 16:03:48 +000041747 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041748 desret_int(ret_val);
41749 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041750 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041751 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41752 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041753 xmlResetLastError();
41754 if (mem_base != xmlMemBlocks()) {
41755 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041757 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041758 printf(" %d", n_writer);
41759 printf(" %d", n_name);
41760 printf(" %d", n_content);
41761 printf("\n");
41762 }
41763 }
41764 }
41765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041766 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041767#endif
41768
Daniel Veillard42595322004-11-08 10:52:06 +000041769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041770}
41771
41772
41773static int
41774test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041776
William M. Brack21e4ef22005-01-02 09:53:13 +000041777#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041778 int mem_base;
41779 int ret_val;
41780 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41781 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041782 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041783 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041784 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041785 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041786
Daniel Veillarde43cc572004-11-03 11:50:29 +000041787 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41788 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41789 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041791 writer = gen_xmlTextWriterPtr(n_writer, 0);
41792 name = gen_const_xmlChar_ptr(n_name, 1);
41793 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041794
William M. Brackf13f77f2004-11-12 16:03:48 +000041795 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041796 desret_int(ret_val);
41797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041798 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041799 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41800 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041801 xmlResetLastError();
41802 if (mem_base != xmlMemBlocks()) {
41803 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041805 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041806 printf(" %d", n_writer);
41807 printf(" %d", n_name);
41808 printf(" %d", n_content);
41809 printf("\n");
41810 }
41811 }
41812 }
41813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041814 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041815#endif
41816
Daniel Veillard42595322004-11-08 10:52:06 +000041817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041818}
41819
41820
41821static int
41822test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041824
William M. Brack21e4ef22005-01-02 09:53:13 +000041825#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041826 int mem_base;
41827 int ret_val;
41828 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41829 int n_writer;
41830 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41831 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041832 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041833 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041834 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041835 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041836 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041837 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041838 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041839 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041840 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041841 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041842
Daniel Veillarde43cc572004-11-03 11:50:29 +000041843 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41844 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41845 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41846 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41847 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41848 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41849 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041851 writer = gen_xmlTextWriterPtr(n_writer, 0);
41852 pe = gen_int(n_pe, 1);
41853 name = gen_const_xmlChar_ptr(n_name, 2);
41854 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41855 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41856 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41857 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041858
William M. Brackf13f77f2004-11-12 16:03:48 +000041859 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 +000041860 desret_int(ret_val);
41861 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041862 des_xmlTextWriterPtr(n_writer, writer, 0);
41863 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041864 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41865 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41866 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41867 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41868 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041869 xmlResetLastError();
41870 if (mem_base != xmlMemBlocks()) {
41871 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041873 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041874 printf(" %d", n_writer);
41875 printf(" %d", n_pe);
41876 printf(" %d", n_name);
41877 printf(" %d", n_pubid);
41878 printf(" %d", n_sysid);
41879 printf(" %d", n_ndataid);
41880 printf(" %d", n_content);
41881 printf("\n");
41882 }
41883 }
41884 }
41885 }
41886 }
41887 }
41888 }
41889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041890 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041891#endif
41892
Daniel Veillard42595322004-11-08 10:52:06 +000041893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041894}
41895
41896
41897static int
41898test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041900
William M. Brack21e4ef22005-01-02 09:53:13 +000041901#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041902 int mem_base;
41903 int ret_val;
41904 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41905 int n_writer;
41906 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41907 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041908 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041909 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041910 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041911 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041912 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041913 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041914 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041915 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916
Daniel Veillarde43cc572004-11-03 11:50:29 +000041917 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41918 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41919 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41920 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41921 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41922 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041924 writer = gen_xmlTextWriterPtr(n_writer, 0);
41925 pe = gen_int(n_pe, 1);
41926 name = gen_const_xmlChar_ptr(n_name, 2);
41927 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41928 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41929 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041930
William M. Brackf13f77f2004-11-12 16:03:48 +000041931 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041932 desret_int(ret_val);
41933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041934 des_xmlTextWriterPtr(n_writer, writer, 0);
41935 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041936 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41937 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41938 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41939 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041940 xmlResetLastError();
41941 if (mem_base != xmlMemBlocks()) {
41942 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041944 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041945 printf(" %d", n_writer);
41946 printf(" %d", n_pe);
41947 printf(" %d", n_name);
41948 printf(" %d", n_pubid);
41949 printf(" %d", n_sysid);
41950 printf(" %d", n_ndataid);
41951 printf("\n");
41952 }
41953 }
41954 }
41955 }
41956 }
41957 }
41958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041959 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041960#endif
41961
Daniel Veillard42595322004-11-08 10:52:06 +000041962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041963}
41964
41965
41966static int
41967test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041969
William M. Brack21e4ef22005-01-02 09:53:13 +000041970#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041971 int mem_base;
41972 int ret_val;
41973 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41974 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041975 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041977 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041978 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041979 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041980 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041981
Daniel Veillarde43cc572004-11-03 11:50:29 +000041982 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41983 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41984 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41985 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41986 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041987 writer = gen_xmlTextWriterPtr(n_writer, 0);
41988 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41989 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41990 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041991
William M. Brackf13f77f2004-11-12 16:03:48 +000041992 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041993 desret_int(ret_val);
41994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041995 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041996 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41997 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41998 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041999 xmlResetLastError();
42000 if (mem_base != xmlMemBlocks()) {
42001 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042003 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042004 printf(" %d", n_writer);
42005 printf(" %d", n_pubid);
42006 printf(" %d", n_sysid);
42007 printf(" %d", n_ndataid);
42008 printf("\n");
42009 }
42010 }
42011 }
42012 }
42013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042014 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042015#endif
42016
Daniel Veillard42595322004-11-08 10:52:06 +000042017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042018}
42019
42020
42021static int
42022test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042024
William M. Brack21e4ef22005-01-02 09:53:13 +000042025#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042026 int mem_base;
42027 int ret_val;
42028 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42029 int n_writer;
42030 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42031 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042032 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042033 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042034 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042035 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042036
Daniel Veillarde43cc572004-11-03 11:50:29 +000042037 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42038 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42039 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42040 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042042 writer = gen_xmlTextWriterPtr(n_writer, 0);
42043 pe = gen_int(n_pe, 1);
42044 name = gen_const_xmlChar_ptr(n_name, 2);
42045 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042046
William M. Brackf13f77f2004-11-12 16:03:48 +000042047 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042048 desret_int(ret_val);
42049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042050 des_xmlTextWriterPtr(n_writer, writer, 0);
42051 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042052 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42053 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042054 xmlResetLastError();
42055 if (mem_base != xmlMemBlocks()) {
42056 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042058 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042059 printf(" %d", n_writer);
42060 printf(" %d", n_pe);
42061 printf(" %d", n_name);
42062 printf(" %d", n_content);
42063 printf("\n");
42064 }
42065 }
42066 }
42067 }
42068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042069 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070#endif
42071
Daniel Veillard42595322004-11-08 10:52:06 +000042072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042073}
42074
42075
42076static int
42077test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042079
William M. Brack21e4ef22005-01-02 09:53:13 +000042080#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042081 int mem_base;
42082 int ret_val;
42083 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42084 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042085 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042086 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042087 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042088 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042089 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042090 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042091
Daniel Veillarde43cc572004-11-03 11:50:29 +000042092 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42093 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42094 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42095 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042097 writer = gen_xmlTextWriterPtr(n_writer, 0);
42098 name = gen_const_xmlChar_ptr(n_name, 1);
42099 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42100 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042101
William M. Brackf13f77f2004-11-12 16:03:48 +000042102 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042103 desret_int(ret_val);
42104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042105 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042106 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42107 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42108 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042109 xmlResetLastError();
42110 if (mem_base != xmlMemBlocks()) {
42111 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042113 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042114 printf(" %d", n_writer);
42115 printf(" %d", n_name);
42116 printf(" %d", n_pubid);
42117 printf(" %d", n_sysid);
42118 printf("\n");
42119 }
42120 }
42121 }
42122 }
42123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042124 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125#endif
42126
Daniel Veillard42595322004-11-08 10:52:06 +000042127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042128}
42129
42130
42131static int
42132test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042134
William M. Brack21e4ef22005-01-02 09:53:13 +000042135#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042136 int mem_base;
42137 int ret_val;
42138 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42139 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042140 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042141 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042142 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042143 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042144
Daniel Veillarde43cc572004-11-03 11:50:29 +000042145 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42146 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42147 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42148 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042149 writer = gen_xmlTextWriterPtr(n_writer, 0);
42150 name = gen_const_xmlChar_ptr(n_name, 1);
42151 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042152
William M. Brackf13f77f2004-11-12 16:03:48 +000042153 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042154 desret_int(ret_val);
42155 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042156 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042157 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42158 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042159 xmlResetLastError();
42160 if (mem_base != xmlMemBlocks()) {
42161 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042163 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042164 printf(" %d", n_writer);
42165 printf(" %d", n_name);
42166 printf(" %d", n_content);
42167 printf("\n");
42168 }
42169 }
42170 }
42171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042172 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042173#endif
42174
Daniel Veillard42595322004-11-08 10:52:06 +000042175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042176}
42177
42178
42179static int
42180test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042182
William M. Brack21e4ef22005-01-02 09:53:13 +000042183#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042184 int mem_base;
42185 int ret_val;
42186 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42187 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042188 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042189 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042190 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042191 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042192 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042193 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042194 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042195 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042196
Daniel Veillarde43cc572004-11-03 11:50:29 +000042197 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42198 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42199 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42200 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42201 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042203 writer = gen_xmlTextWriterPtr(n_writer, 0);
42204 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42205 name = gen_const_xmlChar_ptr(n_name, 2);
42206 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42207 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042208
William M. Brackf13f77f2004-11-12 16:03:48 +000042209 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042210 desret_int(ret_val);
42211 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042212 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042213 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42214 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42215 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42216 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217 xmlResetLastError();
42218 if (mem_base != xmlMemBlocks()) {
42219 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042221 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042222 printf(" %d", n_writer);
42223 printf(" %d", n_prefix);
42224 printf(" %d", n_name);
42225 printf(" %d", n_namespaceURI);
42226 printf(" %d", n_content);
42227 printf("\n");
42228 }
42229 }
42230 }
42231 }
42232 }
42233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042234 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042235#endif
42236
Daniel Veillard42595322004-11-08 10:52:06 +000042237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042238}
42239
42240
42241static int
42242test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042244
42245
42246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042248}
42249
42250
42251static int
42252test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042254
42255
42256 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042258}
42259
42260
42261static int
42262test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042264
42265
42266 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042268}
42269
42270
42271static int
42272test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042274
42275
42276 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042278}
42279
42280
42281static int
42282test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042284
42285
42286 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042288}
42289
42290
42291static int
42292test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042294
42295
42296 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042298}
42299
42300
42301static int
42302test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042304
42305
42306 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042308}
42309
42310
42311static int
42312test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042314
42315
42316 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042318}
42319
42320
42321static int
42322test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042324
42325
42326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328}
42329
42330
42331static int
42332test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042334
42335
42336 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042338}
42339
42340
42341static int
42342test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042344
42345
42346 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042348}
42349
42350
42351static int
42352test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042354
42355
42356 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042358}
42359
42360
42361static int
42362test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364
42365
42366 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042368}
42369
42370
42371static int
42372test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042374
William M. Brack21e4ef22005-01-02 09:53:13 +000042375#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042376 int mem_base;
42377 int ret_val;
42378 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42379 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042380 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042381 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042382 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042383 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384
Daniel Veillarde43cc572004-11-03 11:50:29 +000042385 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42386 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42387 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042389 writer = gen_xmlTextWriterPtr(n_writer, 0);
42390 target = gen_const_xmlChar_ptr(n_target, 1);
42391 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042392
William M. Brackf13f77f2004-11-12 16:03:48 +000042393 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (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_target, (const xmlChar *)target, 1);
42398 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042399 xmlResetLastError();
42400 if (mem_base != xmlMemBlocks()) {
42401 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042403 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042404 printf(" %d", n_writer);
42405 printf(" %d", n_target);
42406 printf(" %d", n_content);
42407 printf("\n");
42408 }
42409 }
42410 }
42411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042412 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042413#endif
42414
Daniel Veillard42595322004-11-08 10:52:06 +000042415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042416}
42417
42418
42419static int
42420test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042422
William M. Brack21e4ef22005-01-02 09:53:13 +000042423#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042424 int mem_base;
42425 int ret_val;
42426 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42427 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042428 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042429 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042430
Daniel Veillarde43cc572004-11-03 11:50:29 +000042431 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42432 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042434 writer = gen_xmlTextWriterPtr(n_writer, 0);
42435 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042436
William M. Brackf13f77f2004-11-12 16:03:48 +000042437 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042438 desret_int(ret_val);
42439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042440 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042441 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042442 xmlResetLastError();
42443 if (mem_base != xmlMemBlocks()) {
42444 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042446 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042447 printf(" %d", n_writer);
42448 printf(" %d", n_content);
42449 printf("\n");
42450 }
42451 }
42452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042453 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042454#endif
42455
Daniel Veillard42595322004-11-08 10:52:06 +000042456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042457}
42458
42459
42460static int
42461test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042463
William M. Brack21e4ef22005-01-02 09:53:13 +000042464#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042465 int mem_base;
42466 int ret_val;
42467 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42468 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042469 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042470 int n_content;
42471 int len; /* length of the text string */
42472 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042473
Daniel Veillarde43cc572004-11-03 11:50:29 +000042474 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42475 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42476 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042478 writer = gen_xmlTextWriterPtr(n_writer, 0);
42479 content = gen_const_xmlChar_ptr(n_content, 1);
42480 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042481
William M. Brackf13f77f2004-11-12 16:03:48 +000042482 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042483 desret_int(ret_val);
42484 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042485 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042486 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042487 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042488 xmlResetLastError();
42489 if (mem_base != xmlMemBlocks()) {
42490 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042492 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042493 printf(" %d", n_writer);
42494 printf(" %d", n_content);
42495 printf(" %d", n_len);
42496 printf("\n");
42497 }
42498 }
42499 }
42500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042501 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042502#endif
42503
Daniel Veillard42595322004-11-08 10:52:06 +000042504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042505}
42506
42507
42508static int
42509test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042511
William M. Brack21e4ef22005-01-02 09:53:13 +000042512#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042513 int mem_base;
42514 int ret_val;
42515 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42516 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042517 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042518 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042519
Daniel Veillarde43cc572004-11-03 11:50:29 +000042520 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42521 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042523 writer = gen_xmlTextWriterPtr(n_writer, 0);
42524 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042525
William M. Brackf13f77f2004-11-12 16:03:48 +000042526 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042527 desret_int(ret_val);
42528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042529 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042530 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042531 xmlResetLastError();
42532 if (mem_base != xmlMemBlocks()) {
42533 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042535 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042536 printf(" %d", n_writer);
42537 printf(" %d", n_content);
42538 printf("\n");
42539 }
42540 }
42541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042542 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042543#endif
42544
Daniel Veillard42595322004-11-08 10:52:06 +000042545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042546}
42547
42548
42549static int
42550test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042552
42553
42554 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042556}
42557
42558
42559static int
42560test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042562
42563
42564 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042566}
42567
42568
42569static int
42570test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042572
42573
42574 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042576}
42577
42578
42579static int
42580test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042582
42583
42584 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042586}
42587
42588
42589static int
42590test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042592
42593
42594 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042596}
42597
42598
42599static int
42600test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042602
42603
42604 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042606}
42607
42608
42609static int
42610test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042612
42613
42614 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042616}
42617
42618
42619static int
42620test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042622
42623
42624 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042626}
42627
42628
42629static int
42630test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042632
42633
42634 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042636}
42637
42638
42639static int
42640test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042642
42643
42644 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042646}
42647
42648
42649static int
42650test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042652
42653
42654 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042656}
42657
42658
42659static int
42660test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042662
42663
42664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042666}
42667
42668
42669static int
42670test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042672
42673
42674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042676}
42677
42678static int
42679test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042681
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042682 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042683 test_ret += test_xmlNewTextWriter();
42684 test_ret += test_xmlNewTextWriterFilename();
42685 test_ret += test_xmlNewTextWriterMemory();
42686 test_ret += test_xmlNewTextWriterPushParser();
42687 test_ret += test_xmlNewTextWriterTree();
42688 test_ret += test_xmlTextWriterEndAttribute();
42689 test_ret += test_xmlTextWriterEndCDATA();
42690 test_ret += test_xmlTextWriterEndComment();
42691 test_ret += test_xmlTextWriterEndDTD();
42692 test_ret += test_xmlTextWriterEndDTDAttlist();
42693 test_ret += test_xmlTextWriterEndDTDElement();
42694 test_ret += test_xmlTextWriterEndDTDEntity();
42695 test_ret += test_xmlTextWriterEndDocument();
42696 test_ret += test_xmlTextWriterEndElement();
42697 test_ret += test_xmlTextWriterEndPI();
42698 test_ret += test_xmlTextWriterFlush();
42699 test_ret += test_xmlTextWriterFullEndElement();
42700 test_ret += test_xmlTextWriterSetIndent();
42701 test_ret += test_xmlTextWriterSetIndentString();
42702 test_ret += test_xmlTextWriterStartAttribute();
42703 test_ret += test_xmlTextWriterStartAttributeNS();
42704 test_ret += test_xmlTextWriterStartCDATA();
42705 test_ret += test_xmlTextWriterStartComment();
42706 test_ret += test_xmlTextWriterStartDTD();
42707 test_ret += test_xmlTextWriterStartDTDAttlist();
42708 test_ret += test_xmlTextWriterStartDTDElement();
42709 test_ret += test_xmlTextWriterStartDTDEntity();
42710 test_ret += test_xmlTextWriterStartDocument();
42711 test_ret += test_xmlTextWriterStartElement();
42712 test_ret += test_xmlTextWriterStartElementNS();
42713 test_ret += test_xmlTextWriterStartPI();
42714 test_ret += test_xmlTextWriterWriteAttribute();
42715 test_ret += test_xmlTextWriterWriteAttributeNS();
42716 test_ret += test_xmlTextWriterWriteBase64();
42717 test_ret += test_xmlTextWriterWriteBinHex();
42718 test_ret += test_xmlTextWriterWriteCDATA();
42719 test_ret += test_xmlTextWriterWriteComment();
42720 test_ret += test_xmlTextWriterWriteDTD();
42721 test_ret += test_xmlTextWriterWriteDTDAttlist();
42722 test_ret += test_xmlTextWriterWriteDTDElement();
42723 test_ret += test_xmlTextWriterWriteDTDEntity();
42724 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42725 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42726 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42727 test_ret += test_xmlTextWriterWriteDTDNotation();
42728 test_ret += test_xmlTextWriterWriteElement();
42729 test_ret += test_xmlTextWriterWriteElementNS();
42730 test_ret += test_xmlTextWriterWriteFormatAttribute();
42731 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42732 test_ret += test_xmlTextWriterWriteFormatCDATA();
42733 test_ret += test_xmlTextWriterWriteFormatComment();
42734 test_ret += test_xmlTextWriterWriteFormatDTD();
42735 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42736 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42737 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42738 test_ret += test_xmlTextWriterWriteFormatElement();
42739 test_ret += test_xmlTextWriterWriteFormatElementNS();
42740 test_ret += test_xmlTextWriterWriteFormatPI();
42741 test_ret += test_xmlTextWriterWriteFormatRaw();
42742 test_ret += test_xmlTextWriterWriteFormatString();
42743 test_ret += test_xmlTextWriterWritePI();
42744 test_ret += test_xmlTextWriterWriteRaw();
42745 test_ret += test_xmlTextWriterWriteRawLen();
42746 test_ret += test_xmlTextWriterWriteString();
42747 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42748 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42749 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42750 test_ret += test_xmlTextWriterWriteVFormatComment();
42751 test_ret += test_xmlTextWriterWriteVFormatDTD();
42752 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42753 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42754 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42755 test_ret += test_xmlTextWriterWriteVFormatElement();
42756 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42757 test_ret += test_xmlTextWriterWriteVFormatPI();
42758 test_ret += test_xmlTextWriterWriteVFormatRaw();
42759 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042760
Daniel Veillard42595322004-11-08 10:52:06 +000042761 if (test_ret != 0)
42762 printf("Module xmlwriter: %d errors\n", test_ret);
42763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042764}
42765
42766static int
42767test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042769
William M. Brack21e4ef22005-01-02 09:53:13 +000042770#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042771 int mem_base;
42772 double ret_val;
42773 int val; /* a boolean */
42774 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042775
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042776 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42777 mem_base = xmlMemBlocks();
42778 val = gen_int(n_val, 0);
42779
42780 ret_val = xmlXPathCastBooleanToNumber(val);
42781 desret_double(ret_val);
42782 call_tests++;
42783 des_int(n_val, val, 0);
42784 xmlResetLastError();
42785 if (mem_base != xmlMemBlocks()) {
42786 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042788 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042789 printf(" %d", n_val);
42790 printf("\n");
42791 }
42792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042793 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042794#endif
42795
Daniel Veillard42595322004-11-08 10:52:06 +000042796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042797}
42798
42799
42800static int
42801test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042803
William M. Brack21e4ef22005-01-02 09:53:13 +000042804#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042805 int mem_base;
42806 xmlChar * ret_val;
42807 int val; /* a boolean */
42808 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042809
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042810 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42811 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042812 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042813
42814 ret_val = xmlXPathCastBooleanToString(val);
42815 desret_xmlChar_ptr(ret_val);
42816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042817 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042818 xmlResetLastError();
42819 if (mem_base != xmlMemBlocks()) {
42820 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042822 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042823 printf(" %d", n_val);
42824 printf("\n");
42825 }
42826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042827 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042828#endif
42829
Daniel Veillard42595322004-11-08 10:52:06 +000042830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042831}
42832
42833
42834static int
42835test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042837
William M. Brack21e4ef22005-01-02 09:53:13 +000042838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042839 int mem_base;
42840 int ret_val;
42841 xmlNodeSetPtr ns; /* a node-set */
42842 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843
Daniel Veillardce682bc2004-11-05 17:22:25 +000042844 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42845 mem_base = xmlMemBlocks();
42846 ns = gen_xmlNodeSetPtr(n_ns, 0);
42847
42848 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42849 desret_int(ret_val);
42850 call_tests++;
42851 des_xmlNodeSetPtr(n_ns, ns, 0);
42852 xmlResetLastError();
42853 if (mem_base != xmlMemBlocks()) {
42854 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042856 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042857 printf(" %d", n_ns);
42858 printf("\n");
42859 }
42860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042861 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042862#endif
42863
Daniel Veillard42595322004-11-08 10:52:06 +000042864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865}
42866
42867
42868static int
42869test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042871
William M. Brack21e4ef22005-01-02 09:53:13 +000042872#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042873 int mem_base;
42874 double ret_val;
42875 xmlNodeSetPtr ns; /* a node-set */
42876 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042877
Daniel Veillardce682bc2004-11-05 17:22:25 +000042878 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42879 mem_base = xmlMemBlocks();
42880 ns = gen_xmlNodeSetPtr(n_ns, 0);
42881
42882 ret_val = xmlXPathCastNodeSetToNumber(ns);
42883 desret_double(ret_val);
42884 call_tests++;
42885 des_xmlNodeSetPtr(n_ns, ns, 0);
42886 xmlResetLastError();
42887 if (mem_base != xmlMemBlocks()) {
42888 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042890 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042891 printf(" %d", n_ns);
42892 printf("\n");
42893 }
42894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042895 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042896#endif
42897
Daniel Veillard42595322004-11-08 10:52:06 +000042898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042899}
42900
42901
42902static int
42903test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042905
William M. Brack21e4ef22005-01-02 09:53:13 +000042906#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042907 int mem_base;
42908 xmlChar * ret_val;
42909 xmlNodeSetPtr ns; /* a node-set */
42910 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042911
Daniel Veillardce682bc2004-11-05 17:22:25 +000042912 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42913 mem_base = xmlMemBlocks();
42914 ns = gen_xmlNodeSetPtr(n_ns, 0);
42915
42916 ret_val = xmlXPathCastNodeSetToString(ns);
42917 desret_xmlChar_ptr(ret_val);
42918 call_tests++;
42919 des_xmlNodeSetPtr(n_ns, ns, 0);
42920 xmlResetLastError();
42921 if (mem_base != xmlMemBlocks()) {
42922 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042925 printf(" %d", n_ns);
42926 printf("\n");
42927 }
42928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042929 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042930#endif
42931
Daniel Veillard42595322004-11-08 10:52:06 +000042932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042933}
42934
42935
42936static int
42937test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939
William M. Brack21e4ef22005-01-02 09:53:13 +000042940#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042941 int mem_base;
42942 double ret_val;
42943 xmlNodePtr node; /* a node */
42944 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042946 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42947 mem_base = xmlMemBlocks();
42948 node = gen_xmlNodePtr(n_node, 0);
42949
42950 ret_val = xmlXPathCastNodeToNumber(node);
42951 desret_double(ret_val);
42952 call_tests++;
42953 des_xmlNodePtr(n_node, node, 0);
42954 xmlResetLastError();
42955 if (mem_base != xmlMemBlocks()) {
42956 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042958 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042959 printf(" %d", n_node);
42960 printf("\n");
42961 }
42962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042963 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042964#endif
42965
Daniel Veillard42595322004-11-08 10:52:06 +000042966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042967}
42968
42969
42970static int
42971test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042973
William M. Brack21e4ef22005-01-02 09:53:13 +000042974#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042975 int mem_base;
42976 xmlChar * ret_val;
42977 xmlNodePtr node; /* a node */
42978 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042979
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042980 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042982 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042983
42984 ret_val = xmlXPathCastNodeToString(node);
42985 desret_xmlChar_ptr(ret_val);
42986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042987 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042988 xmlResetLastError();
42989 if (mem_base != xmlMemBlocks()) {
42990 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042992 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042993 printf(" %d", n_node);
42994 printf("\n");
42995 }
42996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042997 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042998#endif
42999
Daniel Veillard42595322004-11-08 10:52:06 +000043000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043001}
43002
43003
43004static int
43005test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043007
William M. Brack21e4ef22005-01-02 09:53:13 +000043008#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043009 int mem_base;
43010 int ret_val;
43011 double val; /* a number */
43012 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043013
Daniel Veillard3d95c732004-11-06 22:25:14 +000043014 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43015 mem_base = xmlMemBlocks();
43016 val = gen_double(n_val, 0);
43017
43018 ret_val = xmlXPathCastNumberToBoolean(val);
43019 desret_int(ret_val);
43020 call_tests++;
43021 des_double(n_val, val, 0);
43022 xmlResetLastError();
43023 if (mem_base != xmlMemBlocks()) {
43024 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043026 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043027 printf(" %d", n_val);
43028 printf("\n");
43029 }
43030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043031 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043032#endif
43033
Daniel Veillard42595322004-11-08 10:52:06 +000043034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043035}
43036
43037
43038static int
43039test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043041
William M. Brack21e4ef22005-01-02 09:53:13 +000043042#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043043 int mem_base;
43044 xmlChar * ret_val;
43045 double val; /* a number */
43046 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043047
Daniel Veillard3d95c732004-11-06 22:25:14 +000043048 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43049 mem_base = xmlMemBlocks();
43050 val = gen_double(n_val, 0);
43051
43052 ret_val = xmlXPathCastNumberToString(val);
43053 desret_xmlChar_ptr(ret_val);
43054 call_tests++;
43055 des_double(n_val, val, 0);
43056 xmlResetLastError();
43057 if (mem_base != xmlMemBlocks()) {
43058 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043060 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043061 printf(" %d", n_val);
43062 printf("\n");
43063 }
43064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043065 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043066#endif
43067
Daniel Veillard42595322004-11-08 10:52:06 +000043068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043069}
43070
43071
43072static int
43073test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043075
William M. Brack21e4ef22005-01-02 09:53:13 +000043076#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043077 int mem_base;
43078 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043079 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043080 int n_val;
43081
43082 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043084 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043085
William M. Brackf13f77f2004-11-12 16:03:48 +000043086 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043087 desret_int(ret_val);
43088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043089 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043090 xmlResetLastError();
43091 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043092 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043094 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043095 printf(" %d", n_val);
43096 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043097 }
43098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043099 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043100#endif
43101
Daniel Veillard42595322004-11-08 10:52:06 +000043102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043103}
43104
43105
43106static int
43107test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043109
William M. Brack21e4ef22005-01-02 09:53:13 +000043110#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043111 int mem_base;
43112 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043113 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043114 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043115
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043116 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43117 mem_base = xmlMemBlocks();
43118 val = gen_const_xmlChar_ptr(n_val, 0);
43119
William M. Brackf13f77f2004-11-12 16:03:48 +000043120 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043121 desret_double(ret_val);
43122 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043123 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043124 xmlResetLastError();
43125 if (mem_base != xmlMemBlocks()) {
43126 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043128 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043129 printf(" %d", n_val);
43130 printf("\n");
43131 }
43132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043133 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043134#endif
43135
Daniel Veillard42595322004-11-08 10:52:06 +000043136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043137}
43138
43139
43140static int
43141test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043143
William M. Brack21e4ef22005-01-02 09:53:13 +000043144#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043145 int mem_base;
43146 int ret_val;
43147 xmlXPathObjectPtr val; /* an XPath object */
43148 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043149
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043150 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043152 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043153
43154 ret_val = xmlXPathCastToBoolean(val);
43155 desret_int(ret_val);
43156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043157 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043158 xmlResetLastError();
43159 if (mem_base != xmlMemBlocks()) {
43160 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043162 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043163 printf(" %d", n_val);
43164 printf("\n");
43165 }
43166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043167 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043168#endif
43169
Daniel Veillard42595322004-11-08 10:52:06 +000043170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043171}
43172
43173
43174static int
43175test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043177
William M. Brack21e4ef22005-01-02 09:53:13 +000043178#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043179 int mem_base;
43180 double ret_val;
43181 xmlXPathObjectPtr val; /* an XPath object */
43182 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043183
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043184 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43185 mem_base = xmlMemBlocks();
43186 val = gen_xmlXPathObjectPtr(n_val, 0);
43187
43188 ret_val = xmlXPathCastToNumber(val);
43189 desret_double(ret_val);
43190 call_tests++;
43191 des_xmlXPathObjectPtr(n_val, val, 0);
43192 xmlResetLastError();
43193 if (mem_base != xmlMemBlocks()) {
43194 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043196 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043197 printf(" %d", n_val);
43198 printf("\n");
43199 }
43200 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043201 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043202#endif
43203
Daniel Veillard42595322004-11-08 10:52:06 +000043204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043205}
43206
43207
43208static int
43209test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043211
William M. Brack21e4ef22005-01-02 09:53:13 +000043212#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043213 int mem_base;
43214 xmlChar * ret_val;
43215 xmlXPathObjectPtr val; /* an XPath object */
43216 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043217
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043218 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43219 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043220 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043221
43222 ret_val = xmlXPathCastToString(val);
43223 desret_xmlChar_ptr(ret_val);
43224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043225 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043226 xmlResetLastError();
43227 if (mem_base != xmlMemBlocks()) {
43228 printf("Leak of %d blocks found in xmlXPathCastToString",
43229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043230 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043231 printf(" %d", n_val);
43232 printf("\n");
43233 }
43234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043235 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043236#endif
43237
Daniel Veillard42595322004-11-08 10:52:06 +000043238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043239}
43240
43241
43242static int
43243test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043245
William M. Brack21e4ef22005-01-02 09:53:13 +000043246#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043247 int mem_base;
43248 int ret_val;
43249 xmlNodePtr node1; /* the first node */
43250 int n_node1;
43251 xmlNodePtr node2; /* the second node */
43252 int n_node2;
43253
43254 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43255 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043257 node1 = gen_xmlNodePtr(n_node1, 0);
43258 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043259
43260 ret_val = xmlXPathCmpNodes(node1, node2);
43261 desret_int(ret_val);
43262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043263 des_xmlNodePtr(n_node1, node1, 0);
43264 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043265 xmlResetLastError();
43266 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043267 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043269 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043270 printf(" %d", n_node1);
43271 printf(" %d", n_node2);
43272 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043273 }
43274 }
43275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043276 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043277#endif
43278
Daniel Veillard42595322004-11-08 10:52:06 +000043279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043280}
43281
43282
43283static int
43284test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043286
43287
43288 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043290}
43291
Daniel Veillarda521d282004-11-09 14:59:59 +000043292#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043293
Daniel Veillardce682bc2004-11-05 17:22:25 +000043294#define gen_nb_xmlXPathCompExprPtr 1
43295static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43296 return(NULL);
43297}
43298static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43299}
Daniel Veillarda521d282004-11-09 14:59:59 +000043300#endif
43301
43302#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043303
43304#define gen_nb_xmlXPathContextPtr 1
43305static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43306 return(NULL);
43307}
43308static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43309}
Daniel Veillarda521d282004-11-09 14:59:59 +000043310#endif
43311
Daniel Veillardce682bc2004-11-05 17:22:25 +000043312
Daniel Veillardd93f6252004-11-02 15:53:51 +000043313static int
43314test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043316
William M. Brack21e4ef22005-01-02 09:53:13 +000043317#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043318 int mem_base;
43319 xmlXPathObjectPtr ret_val;
43320 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43321 int n_comp;
43322 xmlXPathContextPtr ctx; /* the XPath context */
43323 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043324
Daniel Veillardce682bc2004-11-05 17:22:25 +000043325 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43326 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43327 mem_base = xmlMemBlocks();
43328 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43329 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43330
43331 ret_val = xmlXPathCompiledEval(comp, ctx);
43332 desret_xmlXPathObjectPtr(ret_val);
43333 call_tests++;
43334 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43335 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43336 xmlResetLastError();
43337 if (mem_base != xmlMemBlocks()) {
43338 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043340 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043341 printf(" %d", n_comp);
43342 printf(" %d", n_ctx);
43343 printf("\n");
43344 }
43345 }
43346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043347 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043348#endif
43349
Daniel Veillard42595322004-11-08 10:52:06 +000043350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043351}
43352
43353
43354static int
43355test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043357
William M. Brack21e4ef22005-01-02 09:53:13 +000043358#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043359 int mem_base;
43360 xmlXPathObjectPtr ret_val;
43361 xmlXPathObjectPtr val; /* an XPath object */
43362 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043363
Daniel Veillard3d97e662004-11-04 10:49:00 +000043364 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43365 mem_base = xmlMemBlocks();
43366 val = gen_xmlXPathObjectPtr(n_val, 0);
43367
43368 ret_val = xmlXPathConvertBoolean(val);
43369 val = NULL;
43370 desret_xmlXPathObjectPtr(ret_val);
43371 call_tests++;
43372 des_xmlXPathObjectPtr(n_val, val, 0);
43373 xmlResetLastError();
43374 if (mem_base != xmlMemBlocks()) {
43375 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043377 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043378 printf(" %d", n_val);
43379 printf("\n");
43380 }
43381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043382 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043383#endif
43384
Daniel Veillard42595322004-11-08 10:52:06 +000043385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043386}
43387
43388
43389static int
43390test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043392
William M. Brack21e4ef22005-01-02 09:53:13 +000043393#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043394 int mem_base;
43395 xmlXPathObjectPtr ret_val;
43396 xmlXPathObjectPtr val; /* an XPath object */
43397 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043398
Daniel Veillard3d97e662004-11-04 10:49:00 +000043399 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43400 mem_base = xmlMemBlocks();
43401 val = gen_xmlXPathObjectPtr(n_val, 0);
43402
43403 ret_val = xmlXPathConvertNumber(val);
43404 val = NULL;
43405 desret_xmlXPathObjectPtr(ret_val);
43406 call_tests++;
43407 des_xmlXPathObjectPtr(n_val, val, 0);
43408 xmlResetLastError();
43409 if (mem_base != xmlMemBlocks()) {
43410 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043412 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043413 printf(" %d", n_val);
43414 printf("\n");
43415 }
43416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043417 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043418#endif
43419
Daniel Veillard42595322004-11-08 10:52:06 +000043420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043421}
43422
43423
43424static int
43425test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043427
William M. Brack21e4ef22005-01-02 09:53:13 +000043428#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043429 int mem_base;
43430 xmlXPathObjectPtr ret_val;
43431 xmlXPathObjectPtr val; /* an XPath object */
43432 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043433
Daniel Veillard3d97e662004-11-04 10:49:00 +000043434 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43435 mem_base = xmlMemBlocks();
43436 val = gen_xmlXPathObjectPtr(n_val, 0);
43437
43438 ret_val = xmlXPathConvertString(val);
43439 val = NULL;
43440 desret_xmlXPathObjectPtr(ret_val);
43441 call_tests++;
43442 des_xmlXPathObjectPtr(n_val, val, 0);
43443 xmlResetLastError();
43444 if (mem_base != xmlMemBlocks()) {
43445 printf("Leak of %d blocks found in xmlXPathConvertString",
43446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043447 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043448 printf(" %d", n_val);
43449 printf("\n");
43450 }
43451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043452 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043453#endif
43454
Daniel Veillard42595322004-11-08 10:52:06 +000043455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043456}
43457
43458
43459static int
43460test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043462
43463
43464 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043466}
43467
43468
43469static int
43470test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043472
William M. Brack21e4ef22005-01-02 09:53:13 +000043473#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043474 int mem_base;
43475 xmlXPathObjectPtr ret_val;
43476 xmlChar * str; /* the XPath expression */
43477 int n_str;
43478 xmlXPathContextPtr ctx; /* the XPath context */
43479 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043480
Daniel Veillardce682bc2004-11-05 17:22:25 +000043481 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43482 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43483 mem_base = xmlMemBlocks();
43484 str = gen_const_xmlChar_ptr(n_str, 0);
43485 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43486
William M. Brackf13f77f2004-11-12 16:03:48 +000043487 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043488 desret_xmlXPathObjectPtr(ret_val);
43489 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043490 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043491 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43492 xmlResetLastError();
43493 if (mem_base != xmlMemBlocks()) {
43494 printf("Leak of %d blocks found in xmlXPathEval",
43495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043496 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043497 printf(" %d", n_str);
43498 printf(" %d", n_ctx);
43499 printf("\n");
43500 }
43501 }
43502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043503 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043504#endif
43505
Daniel Veillard42595322004-11-08 10:52:06 +000043506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043507}
43508
43509
43510static int
43511test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043513
William M. Brack21e4ef22005-01-02 09:53:13 +000043514#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043515 int mem_base;
43516 xmlXPathObjectPtr ret_val;
43517 xmlChar * str; /* the XPath expression */
43518 int n_str;
43519 xmlXPathContextPtr ctxt; /* the XPath context */
43520 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043521
Daniel Veillardce682bc2004-11-05 17:22:25 +000043522 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43523 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43524 mem_base = xmlMemBlocks();
43525 str = gen_const_xmlChar_ptr(n_str, 0);
43526 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43527
William M. Brackf13f77f2004-11-12 16:03:48 +000043528 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043529 desret_xmlXPathObjectPtr(ret_val);
43530 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043531 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043532 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43533 xmlResetLastError();
43534 if (mem_base != xmlMemBlocks()) {
43535 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043537 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043538 printf(" %d", n_str);
43539 printf(" %d", n_ctxt);
43540 printf("\n");
43541 }
43542 }
43543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043544 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043545#endif
43546
Daniel Veillard42595322004-11-08 10:52:06 +000043547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043548}
43549
43550
43551static int
43552test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043554
William M. Brack21e4ef22005-01-02 09:53:13 +000043555#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043556 int mem_base;
43557 int ret_val;
43558 xmlXPathContextPtr ctxt; /* the XPath context */
43559 int n_ctxt;
43560 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43561 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043562
Daniel Veillardce682bc2004-11-05 17:22:25 +000043563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43564 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43565 mem_base = xmlMemBlocks();
43566 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43567 res = gen_xmlXPathObjectPtr(n_res, 1);
43568
43569 ret_val = xmlXPathEvalPredicate(ctxt, res);
43570 desret_int(ret_val);
43571 call_tests++;
43572 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43573 des_xmlXPathObjectPtr(n_res, res, 1);
43574 xmlResetLastError();
43575 if (mem_base != xmlMemBlocks()) {
43576 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043578 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043579 printf(" %d", n_ctxt);
43580 printf(" %d", n_res);
43581 printf("\n");
43582 }
43583 }
43584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043585 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043586#endif
43587
Daniel Veillard42595322004-11-08 10:52:06 +000043588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043589}
43590
43591
43592static int
43593test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043595
William M. Brack21e4ef22005-01-02 09:53:13 +000043596#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043597 int mem_base;
43598
43599 mem_base = xmlMemBlocks();
43600
43601 xmlXPathInit();
43602 call_tests++;
43603 xmlResetLastError();
43604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043605 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043610 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043611#endif
43612
Daniel Veillard42595322004-11-08 10:52:06 +000043613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043614}
43615
43616
43617static int
43618test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043620
William M. Brack21e4ef22005-01-02 09:53:13 +000043621#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043622 int mem_base;
43623 int ret_val;
43624 double val; /* a double value */
43625 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043626
Daniel Veillard3d95c732004-11-06 22:25:14 +000043627 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43628 mem_base = xmlMemBlocks();
43629 val = gen_double(n_val, 0);
43630
43631 ret_val = xmlXPathIsInf(val);
43632 desret_int(ret_val);
43633 call_tests++;
43634 des_double(n_val, val, 0);
43635 xmlResetLastError();
43636 if (mem_base != xmlMemBlocks()) {
43637 printf("Leak of %d blocks found in xmlXPathIsInf",
43638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043639 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043640 printf(" %d", n_val);
43641 printf("\n");
43642 }
43643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043644 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043645#endif
43646
Daniel Veillard42595322004-11-08 10:52:06 +000043647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043648}
43649
43650
43651static int
43652test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043654
William M. Brack21e4ef22005-01-02 09:53:13 +000043655#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043656 int mem_base;
43657 int ret_val;
43658 double val; /* a double value */
43659 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043660
Daniel Veillard3d95c732004-11-06 22:25:14 +000043661 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43662 mem_base = xmlMemBlocks();
43663 val = gen_double(n_val, 0);
43664
43665 ret_val = xmlXPathIsNaN(val);
43666 desret_int(ret_val);
43667 call_tests++;
43668 des_double(n_val, val, 0);
43669 xmlResetLastError();
43670 if (mem_base != xmlMemBlocks()) {
43671 printf("Leak of %d blocks found in xmlXPathIsNaN",
43672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043673 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043674 printf(" %d", n_val);
43675 printf("\n");
43676 }
43677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043678 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043679#endif
43680
Daniel Veillard42595322004-11-08 10:52:06 +000043681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043682}
43683
43684
43685static int
43686test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043688
43689
43690 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043692}
43693
43694
43695static int
43696test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043698
William M. Brack21e4ef22005-01-02 09:53:13 +000043699#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043700 int mem_base;
43701 xmlNodeSetPtr ret_val;
43702 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43703 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043704
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043705 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43706 mem_base = xmlMemBlocks();
43707 val = gen_xmlNodePtr(n_val, 0);
43708
43709 ret_val = xmlXPathNodeSetCreate(val);
43710 desret_xmlNodeSetPtr(ret_val);
43711 call_tests++;
43712 des_xmlNodePtr(n_val, val, 0);
43713 xmlResetLastError();
43714 if (mem_base != xmlMemBlocks()) {
43715 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43716 xmlMemBlocks() - mem_base);
43717 test_ret++;
43718 printf(" %d", n_val);
43719 printf("\n");
43720 }
43721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043722 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043723#endif
43724
Daniel Veillard42595322004-11-08 10:52:06 +000043725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043726}
43727
43728
43729static int
43730test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043732
William M. Brack21e4ef22005-01-02 09:53:13 +000043733#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043734 int mem_base;
43735 xmlXPathObjectPtr ret_val;
43736 xmlXPathObjectPtr val; /* the original object */
43737 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043738
Daniel Veillard3d97e662004-11-04 10:49:00 +000043739 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43740 mem_base = xmlMemBlocks();
43741 val = gen_xmlXPathObjectPtr(n_val, 0);
43742
43743 ret_val = xmlXPathObjectCopy(val);
43744 desret_xmlXPathObjectPtr(ret_val);
43745 call_tests++;
43746 des_xmlXPathObjectPtr(n_val, val, 0);
43747 xmlResetLastError();
43748 if (mem_base != xmlMemBlocks()) {
43749 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043751 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043752 printf(" %d", n_val);
43753 printf("\n");
43754 }
43755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043756 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043757#endif
43758
Daniel Veillard42595322004-11-08 10:52:06 +000043759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043760}
43761
43762
43763static int
43764test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043766
William M. Brack21e4ef22005-01-02 09:53:13 +000043767#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043768 int mem_base;
43769 long ret_val;
43770 xmlDocPtr doc; /* an input document */
43771 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043772
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043773 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43774 mem_base = xmlMemBlocks();
43775 doc = gen_xmlDocPtr(n_doc, 0);
43776
43777 ret_val = xmlXPathOrderDocElems(doc);
43778 desret_long(ret_val);
43779 call_tests++;
43780 des_xmlDocPtr(n_doc, doc, 0);
43781 xmlResetLastError();
43782 if (mem_base != xmlMemBlocks()) {
43783 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043785 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043786 printf(" %d", n_doc);
43787 printf("\n");
43788 }
43789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043790 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043791#endif
43792
Daniel Veillard42595322004-11-08 10:52:06 +000043793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043794}
43795
43796static int
43797test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043799
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043800 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043801 test_ret += test_xmlXPathCastBooleanToNumber();
43802 test_ret += test_xmlXPathCastBooleanToString();
43803 test_ret += test_xmlXPathCastNodeSetToBoolean();
43804 test_ret += test_xmlXPathCastNodeSetToNumber();
43805 test_ret += test_xmlXPathCastNodeSetToString();
43806 test_ret += test_xmlXPathCastNodeToNumber();
43807 test_ret += test_xmlXPathCastNodeToString();
43808 test_ret += test_xmlXPathCastNumberToBoolean();
43809 test_ret += test_xmlXPathCastNumberToString();
43810 test_ret += test_xmlXPathCastStringToBoolean();
43811 test_ret += test_xmlXPathCastStringToNumber();
43812 test_ret += test_xmlXPathCastToBoolean();
43813 test_ret += test_xmlXPathCastToNumber();
43814 test_ret += test_xmlXPathCastToString();
43815 test_ret += test_xmlXPathCmpNodes();
43816 test_ret += test_xmlXPathCompile();
43817 test_ret += test_xmlXPathCompiledEval();
43818 test_ret += test_xmlXPathConvertBoolean();
43819 test_ret += test_xmlXPathConvertNumber();
43820 test_ret += test_xmlXPathConvertString();
43821 test_ret += test_xmlXPathCtxtCompile();
43822 test_ret += test_xmlXPathEval();
43823 test_ret += test_xmlXPathEvalExpression();
43824 test_ret += test_xmlXPathEvalPredicate();
43825 test_ret += test_xmlXPathInit();
43826 test_ret += test_xmlXPathIsInf();
43827 test_ret += test_xmlXPathIsNaN();
43828 test_ret += test_xmlXPathNewContext();
43829 test_ret += test_xmlXPathNodeSetCreate();
43830 test_ret += test_xmlXPathObjectCopy();
43831 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043832
Daniel Veillard42595322004-11-08 10:52:06 +000043833 if (test_ret != 0)
43834 printf("Module xpath: %d errors\n", test_ret);
43835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043836}
Daniel Veillarda521d282004-11-09 14:59:59 +000043837#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043838
Daniel Veillarda82b1822004-11-08 16:24:57 +000043839#define gen_nb_xmlXPathParserContextPtr 1
43840static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43841 return(NULL);
43842}
43843static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43844}
Daniel Veillarda521d282004-11-09 14:59:59 +000043845#endif
43846
Daniel Veillarda82b1822004-11-08 16:24:57 +000043847
43848static int
43849test_valuePop(void) {
43850 int test_ret = 0;
43851
William M. Brack21e4ef22005-01-02 09:53:13 +000043852#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043853 int mem_base;
43854 xmlXPathObjectPtr ret_val;
43855 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43856 int n_ctxt;
43857
43858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43859 mem_base = xmlMemBlocks();
43860 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43861
43862 ret_val = valuePop(ctxt);
43863 desret_xmlXPathObjectPtr(ret_val);
43864 call_tests++;
43865 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43866 xmlResetLastError();
43867 if (mem_base != xmlMemBlocks()) {
43868 printf("Leak of %d blocks found in valuePop",
43869 xmlMemBlocks() - mem_base);
43870 test_ret++;
43871 printf(" %d", n_ctxt);
43872 printf("\n");
43873 }
43874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043875 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043876#endif
43877
Daniel Veillarda82b1822004-11-08 16:24:57 +000043878 return(test_ret);
43879}
43880
43881
43882static int
43883test_valuePush(void) {
43884 int test_ret = 0;
43885
William M. Brack21e4ef22005-01-02 09:53:13 +000043886#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043887 int mem_base;
43888 int ret_val;
43889 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43890 int n_ctxt;
43891 xmlXPathObjectPtr value; /* the XPath object */
43892 int n_value;
43893
43894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43895 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43896 mem_base = xmlMemBlocks();
43897 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43898 value = gen_xmlXPathObjectPtr(n_value, 1);
43899
43900 ret_val = valuePush(ctxt, value);
43901 desret_int(ret_val);
43902 call_tests++;
43903 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43904 des_xmlXPathObjectPtr(n_value, value, 1);
43905 xmlResetLastError();
43906 if (mem_base != xmlMemBlocks()) {
43907 printf("Leak of %d blocks found in valuePush",
43908 xmlMemBlocks() - mem_base);
43909 test_ret++;
43910 printf(" %d", n_ctxt);
43911 printf(" %d", n_value);
43912 printf("\n");
43913 }
43914 }
43915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043916 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043917#endif
43918
Daniel Veillarda82b1822004-11-08 16:24:57 +000043919 return(test_ret);
43920}
43921
43922
43923static int
43924test_xmlXPathAddValues(void) {
43925 int test_ret = 0;
43926
William M. Brack21e4ef22005-01-02 09:53:13 +000043927#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043928 int mem_base;
43929 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43930 int n_ctxt;
43931
43932 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43933 mem_base = xmlMemBlocks();
43934 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43935
43936 xmlXPathAddValues(ctxt);
43937 call_tests++;
43938 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43939 xmlResetLastError();
43940 if (mem_base != xmlMemBlocks()) {
43941 printf("Leak of %d blocks found in xmlXPathAddValues",
43942 xmlMemBlocks() - mem_base);
43943 test_ret++;
43944 printf(" %d", n_ctxt);
43945 printf("\n");
43946 }
43947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043948 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043949#endif
43950
Daniel Veillarda82b1822004-11-08 16:24:57 +000043951 return(test_ret);
43952}
43953
43954
43955static int
43956test_xmlXPathBooleanFunction(void) {
43957 int test_ret = 0;
43958
William M. Brack21e4ef22005-01-02 09:53:13 +000043959#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043960 int mem_base;
43961 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43962 int n_ctxt;
43963 int nargs; /* the number of arguments */
43964 int n_nargs;
43965
43966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43967 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43968 mem_base = xmlMemBlocks();
43969 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43970 nargs = gen_int(n_nargs, 1);
43971
43972 xmlXPathBooleanFunction(ctxt, nargs);
43973 call_tests++;
43974 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43975 des_int(n_nargs, nargs, 1);
43976 xmlResetLastError();
43977 if (mem_base != xmlMemBlocks()) {
43978 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43979 xmlMemBlocks() - mem_base);
43980 test_ret++;
43981 printf(" %d", n_ctxt);
43982 printf(" %d", n_nargs);
43983 printf("\n");
43984 }
43985 }
43986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043987 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043988#endif
43989
Daniel Veillarda82b1822004-11-08 16:24:57 +000043990 return(test_ret);
43991}
43992
43993
43994static int
43995test_xmlXPathCeilingFunction(void) {
43996 int test_ret = 0;
43997
William M. Brack21e4ef22005-01-02 09:53:13 +000043998#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043999 int mem_base;
44000 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44001 int n_ctxt;
44002 int nargs; /* the number of arguments */
44003 int n_nargs;
44004
44005 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44006 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44007 mem_base = xmlMemBlocks();
44008 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44009 nargs = gen_int(n_nargs, 1);
44010
44011 xmlXPathCeilingFunction(ctxt, nargs);
44012 call_tests++;
44013 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44014 des_int(n_nargs, nargs, 1);
44015 xmlResetLastError();
44016 if (mem_base != xmlMemBlocks()) {
44017 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44018 xmlMemBlocks() - mem_base);
44019 test_ret++;
44020 printf(" %d", n_ctxt);
44021 printf(" %d", n_nargs);
44022 printf("\n");
44023 }
44024 }
44025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044026 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044027#endif
44028
Daniel Veillarda82b1822004-11-08 16:24:57 +000044029 return(test_ret);
44030}
44031
44032
44033static int
44034test_xmlXPathCompareValues(void) {
44035 int test_ret = 0;
44036
William M. Brack21e4ef22005-01-02 09:53:13 +000044037#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044038 int mem_base;
44039 int ret_val;
44040 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44041 int n_ctxt;
44042 int inf; /* less than (1) or greater than (0) */
44043 int n_inf;
44044 int strict; /* is the comparison strict */
44045 int n_strict;
44046
44047 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44048 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44049 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44050 mem_base = xmlMemBlocks();
44051 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44052 inf = gen_int(n_inf, 1);
44053 strict = gen_int(n_strict, 2);
44054
44055 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44056 desret_int(ret_val);
44057 call_tests++;
44058 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44059 des_int(n_inf, inf, 1);
44060 des_int(n_strict, strict, 2);
44061 xmlResetLastError();
44062 if (mem_base != xmlMemBlocks()) {
44063 printf("Leak of %d blocks found in xmlXPathCompareValues",
44064 xmlMemBlocks() - mem_base);
44065 test_ret++;
44066 printf(" %d", n_ctxt);
44067 printf(" %d", n_inf);
44068 printf(" %d", n_strict);
44069 printf("\n");
44070 }
44071 }
44072 }
44073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044074 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044075#endif
44076
Daniel Veillarda82b1822004-11-08 16:24:57 +000044077 return(test_ret);
44078}
44079
44080
44081static int
44082test_xmlXPathConcatFunction(void) {
44083 int test_ret = 0;
44084
William M. Brack21e4ef22005-01-02 09:53:13 +000044085#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044086 int mem_base;
44087 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44088 int n_ctxt;
44089 int nargs; /* the number of arguments */
44090 int n_nargs;
44091
44092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44093 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44094 mem_base = xmlMemBlocks();
44095 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44096 nargs = gen_int(n_nargs, 1);
44097
44098 xmlXPathConcatFunction(ctxt, nargs);
44099 call_tests++;
44100 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44101 des_int(n_nargs, nargs, 1);
44102 xmlResetLastError();
44103 if (mem_base != xmlMemBlocks()) {
44104 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44105 xmlMemBlocks() - mem_base);
44106 test_ret++;
44107 printf(" %d", n_ctxt);
44108 printf(" %d", n_nargs);
44109 printf("\n");
44110 }
44111 }
44112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044113 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044114#endif
44115
Daniel Veillarda82b1822004-11-08 16:24:57 +000044116 return(test_ret);
44117}
44118
44119
44120static int
44121test_xmlXPathContainsFunction(void) {
44122 int test_ret = 0;
44123
William M. Brack21e4ef22005-01-02 09:53:13 +000044124#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044125 int mem_base;
44126 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44127 int n_ctxt;
44128 int nargs; /* the number of arguments */
44129 int n_nargs;
44130
44131 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44132 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44133 mem_base = xmlMemBlocks();
44134 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44135 nargs = gen_int(n_nargs, 1);
44136
44137 xmlXPathContainsFunction(ctxt, nargs);
44138 call_tests++;
44139 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44140 des_int(n_nargs, nargs, 1);
44141 xmlResetLastError();
44142 if (mem_base != xmlMemBlocks()) {
44143 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44144 xmlMemBlocks() - mem_base);
44145 test_ret++;
44146 printf(" %d", n_ctxt);
44147 printf(" %d", n_nargs);
44148 printf("\n");
44149 }
44150 }
44151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044152 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044153#endif
44154
Daniel Veillarda82b1822004-11-08 16:24:57 +000044155 return(test_ret);
44156}
44157
44158
44159static int
44160test_xmlXPathCountFunction(void) {
44161 int test_ret = 0;
44162
William M. Brack21e4ef22005-01-02 09:53:13 +000044163#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044164 int mem_base;
44165 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44166 int n_ctxt;
44167 int nargs; /* the number of arguments */
44168 int n_nargs;
44169
44170 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44171 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44172 mem_base = xmlMemBlocks();
44173 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44174 nargs = gen_int(n_nargs, 1);
44175
44176 xmlXPathCountFunction(ctxt, nargs);
44177 call_tests++;
44178 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44179 des_int(n_nargs, nargs, 1);
44180 xmlResetLastError();
44181 if (mem_base != xmlMemBlocks()) {
44182 printf("Leak of %d blocks found in xmlXPathCountFunction",
44183 xmlMemBlocks() - mem_base);
44184 test_ret++;
44185 printf(" %d", n_ctxt);
44186 printf(" %d", n_nargs);
44187 printf("\n");
44188 }
44189 }
44190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044191 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044192#endif
44193
Daniel Veillarda82b1822004-11-08 16:24:57 +000044194 return(test_ret);
44195}
44196
44197
44198static int
44199test_xmlXPathDebugDumpCompExpr(void) {
44200 int test_ret = 0;
44201
William M. Brack21e4ef22005-01-02 09:53:13 +000044202#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044203 int mem_base;
44204 FILE * output; /* the FILE * for the output */
44205 int n_output;
44206 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44207 int n_comp;
44208 int depth; /* the indentation level. */
44209 int n_depth;
44210
44211 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44212 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44213 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44214 mem_base = xmlMemBlocks();
44215 output = gen_FILE_ptr(n_output, 0);
44216 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44217 depth = gen_int(n_depth, 2);
44218
44219 xmlXPathDebugDumpCompExpr(output, comp, depth);
44220 call_tests++;
44221 des_FILE_ptr(n_output, output, 0);
44222 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44223 des_int(n_depth, depth, 2);
44224 xmlResetLastError();
44225 if (mem_base != xmlMemBlocks()) {
44226 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44227 xmlMemBlocks() - mem_base);
44228 test_ret++;
44229 printf(" %d", n_output);
44230 printf(" %d", n_comp);
44231 printf(" %d", n_depth);
44232 printf("\n");
44233 }
44234 }
44235 }
44236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044237 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044238#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044239
Daniel Veillarda82b1822004-11-08 16:24:57 +000044240 return(test_ret);
44241}
44242
44243
44244static int
44245test_xmlXPathDebugDumpObject(void) {
44246 int test_ret = 0;
44247
William M. Brack21e4ef22005-01-02 09:53:13 +000044248#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044249 int mem_base;
44250 FILE * output; /* the FILE * to dump the output */
44251 int n_output;
44252 xmlXPathObjectPtr cur; /* the object to inspect */
44253 int n_cur;
44254 int depth; /* indentation level */
44255 int n_depth;
44256
44257 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44258 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44259 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44260 mem_base = xmlMemBlocks();
44261 output = gen_FILE_ptr(n_output, 0);
44262 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44263 depth = gen_int(n_depth, 2);
44264
44265 xmlXPathDebugDumpObject(output, cur, depth);
44266 call_tests++;
44267 des_FILE_ptr(n_output, output, 0);
44268 des_xmlXPathObjectPtr(n_cur, cur, 1);
44269 des_int(n_depth, depth, 2);
44270 xmlResetLastError();
44271 if (mem_base != xmlMemBlocks()) {
44272 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44273 xmlMemBlocks() - mem_base);
44274 test_ret++;
44275 printf(" %d", n_output);
44276 printf(" %d", n_cur);
44277 printf(" %d", n_depth);
44278 printf("\n");
44279 }
44280 }
44281 }
44282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044283 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044284#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044285
Daniel Veillarda82b1822004-11-08 16:24:57 +000044286 return(test_ret);
44287}
44288
44289
44290static int
44291test_xmlXPathDifference(void) {
44292 int test_ret = 0;
44293
William M. Brack21e4ef22005-01-02 09:53:13 +000044294#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044295 int mem_base;
44296 xmlNodeSetPtr ret_val;
44297 xmlNodeSetPtr nodes1; /* a node-set */
44298 int n_nodes1;
44299 xmlNodeSetPtr nodes2; /* a node-set */
44300 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044301
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044302 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44303 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44304 mem_base = xmlMemBlocks();
44305 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44306 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44307
44308 ret_val = xmlXPathDifference(nodes1, nodes2);
44309 desret_xmlNodeSetPtr(ret_val);
44310 call_tests++;
44311 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44312 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44313 xmlResetLastError();
44314 if (mem_base != xmlMemBlocks()) {
44315 printf("Leak of %d blocks found in xmlXPathDifference",
44316 xmlMemBlocks() - mem_base);
44317 test_ret++;
44318 printf(" %d", n_nodes1);
44319 printf(" %d", n_nodes2);
44320 printf("\n");
44321 }
44322 }
44323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044324 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044325#endif
44326
Daniel Veillarda82b1822004-11-08 16:24:57 +000044327 return(test_ret);
44328}
44329
44330
44331static int
44332test_xmlXPathDistinct(void) {
44333 int test_ret = 0;
44334
William M. Brack21e4ef22005-01-02 09:53:13 +000044335#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044336 int mem_base;
44337 xmlNodeSetPtr ret_val;
44338 xmlNodeSetPtr nodes; /* a node-set */
44339 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044340
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044341 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44342 mem_base = xmlMemBlocks();
44343 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44344
44345 ret_val = xmlXPathDistinct(nodes);
44346 desret_xmlNodeSetPtr(ret_val);
44347 call_tests++;
44348 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44349 xmlResetLastError();
44350 if (mem_base != xmlMemBlocks()) {
44351 printf("Leak of %d blocks found in xmlXPathDistinct",
44352 xmlMemBlocks() - mem_base);
44353 test_ret++;
44354 printf(" %d", n_nodes);
44355 printf("\n");
44356 }
44357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044358 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044359#endif
44360
Daniel Veillarda82b1822004-11-08 16:24:57 +000044361 return(test_ret);
44362}
44363
44364
44365static int
44366test_xmlXPathDistinctSorted(void) {
44367 int test_ret = 0;
44368
William M. Brack21e4ef22005-01-02 09:53:13 +000044369#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044370 int mem_base;
44371 xmlNodeSetPtr ret_val;
44372 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44373 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044374
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044375 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44376 mem_base = xmlMemBlocks();
44377 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44378
44379 ret_val = xmlXPathDistinctSorted(nodes);
44380 desret_xmlNodeSetPtr(ret_val);
44381 call_tests++;
44382 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44383 xmlResetLastError();
44384 if (mem_base != xmlMemBlocks()) {
44385 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44386 xmlMemBlocks() - mem_base);
44387 test_ret++;
44388 printf(" %d", n_nodes);
44389 printf("\n");
44390 }
44391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044392 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044393#endif
44394
Daniel Veillarda82b1822004-11-08 16:24:57 +000044395 return(test_ret);
44396}
44397
44398
44399static int
44400test_xmlXPathDivValues(void) {
44401 int test_ret = 0;
44402
William M. Brack21e4ef22005-01-02 09:53:13 +000044403#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044404 int mem_base;
44405 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44406 int n_ctxt;
44407
44408 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44409 mem_base = xmlMemBlocks();
44410 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44411
44412 xmlXPathDivValues(ctxt);
44413 call_tests++;
44414 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44415 xmlResetLastError();
44416 if (mem_base != xmlMemBlocks()) {
44417 printf("Leak of %d blocks found in xmlXPathDivValues",
44418 xmlMemBlocks() - mem_base);
44419 test_ret++;
44420 printf(" %d", n_ctxt);
44421 printf("\n");
44422 }
44423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044424 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044425#endif
44426
Daniel Veillarda82b1822004-11-08 16:24:57 +000044427 return(test_ret);
44428}
44429
44430
44431static int
44432test_xmlXPathEqualValues(void) {
44433 int test_ret = 0;
44434
William M. Brack21e4ef22005-01-02 09:53:13 +000044435#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044436 int mem_base;
44437 int ret_val;
44438 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44439 int n_ctxt;
44440
44441 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44442 mem_base = xmlMemBlocks();
44443 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44444
44445 ret_val = xmlXPathEqualValues(ctxt);
44446 desret_int(ret_val);
44447 call_tests++;
44448 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44449 xmlResetLastError();
44450 if (mem_base != xmlMemBlocks()) {
44451 printf("Leak of %d blocks found in xmlXPathEqualValues",
44452 xmlMemBlocks() - mem_base);
44453 test_ret++;
44454 printf(" %d", n_ctxt);
44455 printf("\n");
44456 }
44457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044458 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044459#endif
44460
Daniel Veillarda82b1822004-11-08 16:24:57 +000044461 return(test_ret);
44462}
44463
44464
44465static int
44466test_xmlXPathErr(void) {
44467 int test_ret = 0;
44468
William M. Brack21e4ef22005-01-02 09:53:13 +000044469#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044470 int mem_base;
44471 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44472 int n_ctxt;
44473 int error; /* the error code */
44474 int n_error;
44475
44476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44477 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44478 mem_base = xmlMemBlocks();
44479 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44480 error = gen_int(n_error, 1);
44481
44482 xmlXPathErr(ctxt, error);
44483 call_tests++;
44484 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44485 des_int(n_error, error, 1);
44486 xmlResetLastError();
44487 if (mem_base != xmlMemBlocks()) {
44488 printf("Leak of %d blocks found in xmlXPathErr",
44489 xmlMemBlocks() - mem_base);
44490 test_ret++;
44491 printf(" %d", n_ctxt);
44492 printf(" %d", n_error);
44493 printf("\n");
44494 }
44495 }
44496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044497 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044498#endif
44499
Daniel Veillarda82b1822004-11-08 16:24:57 +000044500 return(test_ret);
44501}
44502
44503
44504static int
44505test_xmlXPathEvalExpr(void) {
44506 int test_ret = 0;
44507
William M. Brack21e4ef22005-01-02 09:53:13 +000044508#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044509 int mem_base;
44510 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44511 int n_ctxt;
44512
44513 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44514 mem_base = xmlMemBlocks();
44515 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44516
44517 xmlXPathEvalExpr(ctxt);
44518 call_tests++;
44519 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44520 xmlResetLastError();
44521 if (mem_base != xmlMemBlocks()) {
44522 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44523 xmlMemBlocks() - mem_base);
44524 test_ret++;
44525 printf(" %d", n_ctxt);
44526 printf("\n");
44527 }
44528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044529 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044530#endif
44531
Daniel Veillarda82b1822004-11-08 16:24:57 +000044532 return(test_ret);
44533}
44534
44535
44536static int
44537test_xmlXPathEvaluatePredicateResult(void) {
44538 int test_ret = 0;
44539
William M. Brack21e4ef22005-01-02 09:53:13 +000044540#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044541 int mem_base;
44542 int ret_val;
44543 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44544 int n_ctxt;
44545 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44546 int n_res;
44547
44548 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44549 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44550 mem_base = xmlMemBlocks();
44551 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44552 res = gen_xmlXPathObjectPtr(n_res, 1);
44553
44554 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44555 desret_int(ret_val);
44556 call_tests++;
44557 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44558 des_xmlXPathObjectPtr(n_res, res, 1);
44559 xmlResetLastError();
44560 if (mem_base != xmlMemBlocks()) {
44561 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44562 xmlMemBlocks() - mem_base);
44563 test_ret++;
44564 printf(" %d", n_ctxt);
44565 printf(" %d", n_res);
44566 printf("\n");
44567 }
44568 }
44569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044570 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044571#endif
44572
Daniel Veillarda82b1822004-11-08 16:24:57 +000044573 return(test_ret);
44574}
44575
44576
44577static int
44578test_xmlXPathFalseFunction(void) {
44579 int test_ret = 0;
44580
William M. Brack21e4ef22005-01-02 09:53:13 +000044581#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044582 int mem_base;
44583 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44584 int n_ctxt;
44585 int nargs; /* the number of arguments */
44586 int n_nargs;
44587
44588 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44589 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44590 mem_base = xmlMemBlocks();
44591 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44592 nargs = gen_int(n_nargs, 1);
44593
44594 xmlXPathFalseFunction(ctxt, nargs);
44595 call_tests++;
44596 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44597 des_int(n_nargs, nargs, 1);
44598 xmlResetLastError();
44599 if (mem_base != xmlMemBlocks()) {
44600 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44601 xmlMemBlocks() - mem_base);
44602 test_ret++;
44603 printf(" %d", n_ctxt);
44604 printf(" %d", n_nargs);
44605 printf("\n");
44606 }
44607 }
44608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044609 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044610#endif
44611
Daniel Veillarda82b1822004-11-08 16:24:57 +000044612 return(test_ret);
44613}
44614
44615
44616static int
44617test_xmlXPathFloorFunction(void) {
44618 int test_ret = 0;
44619
William M. Brack21e4ef22005-01-02 09:53:13 +000044620#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044621 int mem_base;
44622 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44623 int n_ctxt;
44624 int nargs; /* the number of arguments */
44625 int n_nargs;
44626
44627 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44628 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44629 mem_base = xmlMemBlocks();
44630 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44631 nargs = gen_int(n_nargs, 1);
44632
44633 xmlXPathFloorFunction(ctxt, nargs);
44634 call_tests++;
44635 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44636 des_int(n_nargs, nargs, 1);
44637 xmlResetLastError();
44638 if (mem_base != xmlMemBlocks()) {
44639 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44640 xmlMemBlocks() - mem_base);
44641 test_ret++;
44642 printf(" %d", n_ctxt);
44643 printf(" %d", n_nargs);
44644 printf("\n");
44645 }
44646 }
44647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044648 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044649#endif
44650
Daniel Veillarda82b1822004-11-08 16:24:57 +000044651 return(test_ret);
44652}
44653
44654
44655static int
44656test_xmlXPathFunctionLookup(void) {
44657 int test_ret = 0;
44658
44659
44660 /* missing type support */
44661 return(test_ret);
44662}
44663
44664
44665static int
44666test_xmlXPathFunctionLookupNS(void) {
44667 int test_ret = 0;
44668
44669
44670 /* missing type support */
44671 return(test_ret);
44672}
44673
44674
44675static int
44676test_xmlXPathHasSameNodes(void) {
44677 int test_ret = 0;
44678
William M. Brack21e4ef22005-01-02 09:53:13 +000044679#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044680 int mem_base;
44681 int ret_val;
44682 xmlNodeSetPtr nodes1; /* a node-set */
44683 int n_nodes1;
44684 xmlNodeSetPtr nodes2; /* a node-set */
44685 int n_nodes2;
44686
44687 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44688 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44689 mem_base = xmlMemBlocks();
44690 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44691 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44692
44693 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44694 desret_int(ret_val);
44695 call_tests++;
44696 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44697 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44698 xmlResetLastError();
44699 if (mem_base != xmlMemBlocks()) {
44700 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44701 xmlMemBlocks() - mem_base);
44702 test_ret++;
44703 printf(" %d", n_nodes1);
44704 printf(" %d", n_nodes2);
44705 printf("\n");
44706 }
44707 }
44708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044709 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044710#endif
44711
Daniel Veillarda82b1822004-11-08 16:24:57 +000044712 return(test_ret);
44713}
44714
44715
44716static int
44717test_xmlXPathIdFunction(void) {
44718 int test_ret = 0;
44719
William M. Brack21e4ef22005-01-02 09:53:13 +000044720#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044721 int mem_base;
44722 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44723 int n_ctxt;
44724 int nargs; /* the number of arguments */
44725 int n_nargs;
44726
44727 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44728 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44729 mem_base = xmlMemBlocks();
44730 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44731 nargs = gen_int(n_nargs, 1);
44732
44733 xmlXPathIdFunction(ctxt, nargs);
44734 call_tests++;
44735 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44736 des_int(n_nargs, nargs, 1);
44737 xmlResetLastError();
44738 if (mem_base != xmlMemBlocks()) {
44739 printf("Leak of %d blocks found in xmlXPathIdFunction",
44740 xmlMemBlocks() - mem_base);
44741 test_ret++;
44742 printf(" %d", n_ctxt);
44743 printf(" %d", n_nargs);
44744 printf("\n");
44745 }
44746 }
44747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044748 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044749#endif
44750
Daniel Veillarda82b1822004-11-08 16:24:57 +000044751 return(test_ret);
44752}
44753
44754
44755static int
44756test_xmlXPathIntersection(void) {
44757 int test_ret = 0;
44758
William M. Brack21e4ef22005-01-02 09:53:13 +000044759#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044760 int mem_base;
44761 xmlNodeSetPtr ret_val;
44762 xmlNodeSetPtr nodes1; /* a node-set */
44763 int n_nodes1;
44764 xmlNodeSetPtr nodes2; /* a node-set */
44765 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044766
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044767 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44768 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44769 mem_base = xmlMemBlocks();
44770 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44771 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44772
44773 ret_val = xmlXPathIntersection(nodes1, nodes2);
44774 desret_xmlNodeSetPtr(ret_val);
44775 call_tests++;
44776 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44777 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44778 xmlResetLastError();
44779 if (mem_base != xmlMemBlocks()) {
44780 printf("Leak of %d blocks found in xmlXPathIntersection",
44781 xmlMemBlocks() - mem_base);
44782 test_ret++;
44783 printf(" %d", n_nodes1);
44784 printf(" %d", n_nodes2);
44785 printf("\n");
44786 }
44787 }
44788 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044789 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044790#endif
44791
Daniel Veillarda82b1822004-11-08 16:24:57 +000044792 return(test_ret);
44793}
44794
44795
44796static int
44797test_xmlXPathIsNodeType(void) {
44798 int test_ret = 0;
44799
William M. Brack21e4ef22005-01-02 09:53:13 +000044800#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044801 int mem_base;
44802 int ret_val;
44803 xmlChar * name; /* a name string */
44804 int n_name;
44805
44806 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44807 mem_base = xmlMemBlocks();
44808 name = gen_const_xmlChar_ptr(n_name, 0);
44809
William M. Brackf13f77f2004-11-12 16:03:48 +000044810 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044811 desret_int(ret_val);
44812 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044813 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044814 xmlResetLastError();
44815 if (mem_base != xmlMemBlocks()) {
44816 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44817 xmlMemBlocks() - mem_base);
44818 test_ret++;
44819 printf(" %d", n_name);
44820 printf("\n");
44821 }
44822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044823 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044824#endif
44825
Daniel Veillarda82b1822004-11-08 16:24:57 +000044826 return(test_ret);
44827}
44828
44829
44830static int
44831test_xmlXPathLangFunction(void) {
44832 int test_ret = 0;
44833
William M. Brack21e4ef22005-01-02 09:53:13 +000044834#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044835 int mem_base;
44836 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44837 int n_ctxt;
44838 int nargs; /* the number of arguments */
44839 int n_nargs;
44840
44841 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44842 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44843 mem_base = xmlMemBlocks();
44844 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44845 nargs = gen_int(n_nargs, 1);
44846
44847 xmlXPathLangFunction(ctxt, nargs);
44848 call_tests++;
44849 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44850 des_int(n_nargs, nargs, 1);
44851 xmlResetLastError();
44852 if (mem_base != xmlMemBlocks()) {
44853 printf("Leak of %d blocks found in xmlXPathLangFunction",
44854 xmlMemBlocks() - mem_base);
44855 test_ret++;
44856 printf(" %d", n_ctxt);
44857 printf(" %d", n_nargs);
44858 printf("\n");
44859 }
44860 }
44861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044862 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044863#endif
44864
Daniel Veillarda82b1822004-11-08 16:24:57 +000044865 return(test_ret);
44866}
44867
44868
44869static int
44870test_xmlXPathLastFunction(void) {
44871 int test_ret = 0;
44872
William M. Brack21e4ef22005-01-02 09:53:13 +000044873#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044874 int mem_base;
44875 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44876 int n_ctxt;
44877 int nargs; /* the number of arguments */
44878 int n_nargs;
44879
44880 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44881 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44882 mem_base = xmlMemBlocks();
44883 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44884 nargs = gen_int(n_nargs, 1);
44885
44886 xmlXPathLastFunction(ctxt, nargs);
44887 call_tests++;
44888 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44889 des_int(n_nargs, nargs, 1);
44890 xmlResetLastError();
44891 if (mem_base != xmlMemBlocks()) {
44892 printf("Leak of %d blocks found in xmlXPathLastFunction",
44893 xmlMemBlocks() - mem_base);
44894 test_ret++;
44895 printf(" %d", n_ctxt);
44896 printf(" %d", n_nargs);
44897 printf("\n");
44898 }
44899 }
44900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044901 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044902#endif
44903
Daniel Veillarda82b1822004-11-08 16:24:57 +000044904 return(test_ret);
44905}
44906
44907
44908static int
44909test_xmlXPathLeading(void) {
44910 int test_ret = 0;
44911
William M. Brack21e4ef22005-01-02 09:53:13 +000044912#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044913 int mem_base;
44914 xmlNodeSetPtr ret_val;
44915 xmlNodeSetPtr nodes1; /* a node-set */
44916 int n_nodes1;
44917 xmlNodeSetPtr nodes2; /* a node-set */
44918 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044919
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044920 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44921 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44922 mem_base = xmlMemBlocks();
44923 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44924 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44925
44926 ret_val = xmlXPathLeading(nodes1, nodes2);
44927 desret_xmlNodeSetPtr(ret_val);
44928 call_tests++;
44929 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44930 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44931 xmlResetLastError();
44932 if (mem_base != xmlMemBlocks()) {
44933 printf("Leak of %d blocks found in xmlXPathLeading",
44934 xmlMemBlocks() - mem_base);
44935 test_ret++;
44936 printf(" %d", n_nodes1);
44937 printf(" %d", n_nodes2);
44938 printf("\n");
44939 }
44940 }
44941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044942 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044943#endif
44944
Daniel Veillarda82b1822004-11-08 16:24:57 +000044945 return(test_ret);
44946}
44947
44948
44949static int
44950test_xmlXPathLeadingSorted(void) {
44951 int test_ret = 0;
44952
William M. Brack21e4ef22005-01-02 09:53:13 +000044953#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044954 int mem_base;
44955 xmlNodeSetPtr ret_val;
44956 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44957 int n_nodes1;
44958 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44959 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044960
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044961 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44962 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44963 mem_base = xmlMemBlocks();
44964 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44965 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44966
44967 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44968 desret_xmlNodeSetPtr(ret_val);
44969 call_tests++;
44970 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44971 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44972 xmlResetLastError();
44973 if (mem_base != xmlMemBlocks()) {
44974 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44975 xmlMemBlocks() - mem_base);
44976 test_ret++;
44977 printf(" %d", n_nodes1);
44978 printf(" %d", n_nodes2);
44979 printf("\n");
44980 }
44981 }
44982 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044983 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044984#endif
44985
Daniel Veillarda82b1822004-11-08 16:24:57 +000044986 return(test_ret);
44987}
44988
44989
44990static int
44991test_xmlXPathLocalNameFunction(void) {
44992 int test_ret = 0;
44993
William M. Brack21e4ef22005-01-02 09:53:13 +000044994#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044995 int mem_base;
44996 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44997 int n_ctxt;
44998 int nargs; /* the number of arguments */
44999 int n_nargs;
45000
45001 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45002 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45003 mem_base = xmlMemBlocks();
45004 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45005 nargs = gen_int(n_nargs, 1);
45006
45007 xmlXPathLocalNameFunction(ctxt, nargs);
45008 call_tests++;
45009 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45010 des_int(n_nargs, nargs, 1);
45011 xmlResetLastError();
45012 if (mem_base != xmlMemBlocks()) {
45013 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45014 xmlMemBlocks() - mem_base);
45015 test_ret++;
45016 printf(" %d", n_ctxt);
45017 printf(" %d", n_nargs);
45018 printf("\n");
45019 }
45020 }
45021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045022 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045023#endif
45024
Daniel Veillarda82b1822004-11-08 16:24:57 +000045025 return(test_ret);
45026}
45027
45028
45029static int
45030test_xmlXPathModValues(void) {
45031 int test_ret = 0;
45032
William M. Brack21e4ef22005-01-02 09:53:13 +000045033#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045034 int mem_base;
45035 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45036 int n_ctxt;
45037
45038 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45039 mem_base = xmlMemBlocks();
45040 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45041
45042 xmlXPathModValues(ctxt);
45043 call_tests++;
45044 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45045 xmlResetLastError();
45046 if (mem_base != xmlMemBlocks()) {
45047 printf("Leak of %d blocks found in xmlXPathModValues",
45048 xmlMemBlocks() - mem_base);
45049 test_ret++;
45050 printf(" %d", n_ctxt);
45051 printf("\n");
45052 }
45053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045054 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045055#endif
45056
Daniel Veillarda82b1822004-11-08 16:24:57 +000045057 return(test_ret);
45058}
45059
45060
45061static int
45062test_xmlXPathMultValues(void) {
45063 int test_ret = 0;
45064
William M. Brack21e4ef22005-01-02 09:53:13 +000045065#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045066 int mem_base;
45067 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45068 int n_ctxt;
45069
45070 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45071 mem_base = xmlMemBlocks();
45072 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45073
45074 xmlXPathMultValues(ctxt);
45075 call_tests++;
45076 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45077 xmlResetLastError();
45078 if (mem_base != xmlMemBlocks()) {
45079 printf("Leak of %d blocks found in xmlXPathMultValues",
45080 xmlMemBlocks() - mem_base);
45081 test_ret++;
45082 printf(" %d", n_ctxt);
45083 printf("\n");
45084 }
45085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045086 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045087#endif
45088
Daniel Veillarda82b1822004-11-08 16:24:57 +000045089 return(test_ret);
45090}
45091
45092
45093static int
45094test_xmlXPathNamespaceURIFunction(void) {
45095 int test_ret = 0;
45096
William M. Brack21e4ef22005-01-02 09:53:13 +000045097#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045098 int mem_base;
45099 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45100 int n_ctxt;
45101 int nargs; /* the number of arguments */
45102 int n_nargs;
45103
45104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45105 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45106 mem_base = xmlMemBlocks();
45107 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45108 nargs = gen_int(n_nargs, 1);
45109
45110 xmlXPathNamespaceURIFunction(ctxt, nargs);
45111 call_tests++;
45112 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45113 des_int(n_nargs, nargs, 1);
45114 xmlResetLastError();
45115 if (mem_base != xmlMemBlocks()) {
45116 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45117 xmlMemBlocks() - mem_base);
45118 test_ret++;
45119 printf(" %d", n_ctxt);
45120 printf(" %d", n_nargs);
45121 printf("\n");
45122 }
45123 }
45124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045125 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045126#endif
45127
Daniel Veillarda82b1822004-11-08 16:24:57 +000045128 return(test_ret);
45129}
45130
45131
45132static int
45133test_xmlXPathNewBoolean(void) {
45134 int test_ret = 0;
45135
William M. Brack21e4ef22005-01-02 09:53:13 +000045136#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045137 int mem_base;
45138 xmlXPathObjectPtr ret_val;
45139 int val; /* the boolean value */
45140 int n_val;
45141
45142 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45143 mem_base = xmlMemBlocks();
45144 val = gen_int(n_val, 0);
45145
45146 ret_val = xmlXPathNewBoolean(val);
45147 desret_xmlXPathObjectPtr(ret_val);
45148 call_tests++;
45149 des_int(n_val, val, 0);
45150 xmlResetLastError();
45151 if (mem_base != xmlMemBlocks()) {
45152 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45153 xmlMemBlocks() - mem_base);
45154 test_ret++;
45155 printf(" %d", n_val);
45156 printf("\n");
45157 }
45158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045159 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045160#endif
45161
Daniel Veillarda82b1822004-11-08 16:24:57 +000045162 return(test_ret);
45163}
45164
45165
45166static int
45167test_xmlXPathNewCString(void) {
45168 int test_ret = 0;
45169
William M. Brack21e4ef22005-01-02 09:53:13 +000045170#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045171 int mem_base;
45172 xmlXPathObjectPtr ret_val;
45173 char * val; /* the char * value */
45174 int n_val;
45175
45176 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45177 mem_base = xmlMemBlocks();
45178 val = gen_const_char_ptr(n_val, 0);
45179
William M. Brackf13f77f2004-11-12 16:03:48 +000045180 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045181 desret_xmlXPathObjectPtr(ret_val);
45182 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045183 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045184 xmlResetLastError();
45185 if (mem_base != xmlMemBlocks()) {
45186 printf("Leak of %d blocks found in xmlXPathNewCString",
45187 xmlMemBlocks() - mem_base);
45188 test_ret++;
45189 printf(" %d", n_val);
45190 printf("\n");
45191 }
45192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045193 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045194#endif
45195
Daniel Veillarda82b1822004-11-08 16:24:57 +000045196 return(test_ret);
45197}
45198
45199
45200static int
45201test_xmlXPathNewFloat(void) {
45202 int test_ret = 0;
45203
William M. Brack21e4ef22005-01-02 09:53:13 +000045204#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045205 int mem_base;
45206 xmlXPathObjectPtr ret_val;
45207 double val; /* the double value */
45208 int n_val;
45209
45210 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45211 mem_base = xmlMemBlocks();
45212 val = gen_double(n_val, 0);
45213
45214 ret_val = xmlXPathNewFloat(val);
45215 desret_xmlXPathObjectPtr(ret_val);
45216 call_tests++;
45217 des_double(n_val, val, 0);
45218 xmlResetLastError();
45219 if (mem_base != xmlMemBlocks()) {
45220 printf("Leak of %d blocks found in xmlXPathNewFloat",
45221 xmlMemBlocks() - mem_base);
45222 test_ret++;
45223 printf(" %d", n_val);
45224 printf("\n");
45225 }
45226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045227 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045228#endif
45229
Daniel Veillarda82b1822004-11-08 16:24:57 +000045230 return(test_ret);
45231}
45232
45233
45234static int
45235test_xmlXPathNewNodeSet(void) {
45236 int test_ret = 0;
45237
William M. Brack21e4ef22005-01-02 09:53:13 +000045238#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045239 int mem_base;
45240 xmlXPathObjectPtr ret_val;
45241 xmlNodePtr val; /* the NodePtr value */
45242 int n_val;
45243
45244 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45245 mem_base = xmlMemBlocks();
45246 val = gen_xmlNodePtr(n_val, 0);
45247
45248 ret_val = xmlXPathNewNodeSet(val);
45249 desret_xmlXPathObjectPtr(ret_val);
45250 call_tests++;
45251 des_xmlNodePtr(n_val, val, 0);
45252 xmlResetLastError();
45253 if (mem_base != xmlMemBlocks()) {
45254 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45255 xmlMemBlocks() - mem_base);
45256 test_ret++;
45257 printf(" %d", n_val);
45258 printf("\n");
45259 }
45260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045261 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045262#endif
45263
Daniel Veillarda82b1822004-11-08 16:24:57 +000045264 return(test_ret);
45265}
45266
45267
45268static int
45269test_xmlXPathNewNodeSetList(void) {
45270 int test_ret = 0;
45271
William M. Brack21e4ef22005-01-02 09:53:13 +000045272#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045273 int mem_base;
45274 xmlXPathObjectPtr ret_val;
45275 xmlNodeSetPtr val; /* an existing NodeSet */
45276 int n_val;
45277
45278 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45279 mem_base = xmlMemBlocks();
45280 val = gen_xmlNodeSetPtr(n_val, 0);
45281
45282 ret_val = xmlXPathNewNodeSetList(val);
45283 desret_xmlXPathObjectPtr(ret_val);
45284 call_tests++;
45285 des_xmlNodeSetPtr(n_val, val, 0);
45286 xmlResetLastError();
45287 if (mem_base != xmlMemBlocks()) {
45288 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45289 xmlMemBlocks() - mem_base);
45290 test_ret++;
45291 printf(" %d", n_val);
45292 printf("\n");
45293 }
45294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045296#endif
45297
Daniel Veillarda82b1822004-11-08 16:24:57 +000045298 return(test_ret);
45299}
45300
45301
45302static int
45303test_xmlXPathNewParserContext(void) {
45304 int test_ret = 0;
45305
45306
45307 /* missing type support */
45308 return(test_ret);
45309}
45310
45311
45312static int
45313test_xmlXPathNewString(void) {
45314 int test_ret = 0;
45315
William M. Brack21e4ef22005-01-02 09:53:13 +000045316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045317 int mem_base;
45318 xmlXPathObjectPtr ret_val;
45319 xmlChar * val; /* the xmlChar * value */
45320 int n_val;
45321
45322 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45323 mem_base = xmlMemBlocks();
45324 val = gen_const_xmlChar_ptr(n_val, 0);
45325
William M. Brackf13f77f2004-11-12 16:03:48 +000045326 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045327 desret_xmlXPathObjectPtr(ret_val);
45328 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045329 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045330 xmlResetLastError();
45331 if (mem_base != xmlMemBlocks()) {
45332 printf("Leak of %d blocks found in xmlXPathNewString",
45333 xmlMemBlocks() - mem_base);
45334 test_ret++;
45335 printf(" %d", n_val);
45336 printf("\n");
45337 }
45338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045339 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045340#endif
45341
Daniel Veillarda82b1822004-11-08 16:24:57 +000045342 return(test_ret);
45343}
45344
45345
45346static int
45347test_xmlXPathNextAncestor(void) {
45348 int test_ret = 0;
45349
William M. Brack21e4ef22005-01-02 09:53:13 +000045350#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045351 int mem_base;
45352 xmlNodePtr ret_val;
45353 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45354 int n_ctxt;
45355 xmlNodePtr cur; /* the current node in the traversal */
45356 int n_cur;
45357
45358 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45359 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45360 mem_base = xmlMemBlocks();
45361 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45362 cur = gen_xmlNodePtr(n_cur, 1);
45363
45364 ret_val = xmlXPathNextAncestor(ctxt, cur);
45365 desret_xmlNodePtr(ret_val);
45366 call_tests++;
45367 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45368 des_xmlNodePtr(n_cur, cur, 1);
45369 xmlResetLastError();
45370 if (mem_base != xmlMemBlocks()) {
45371 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45372 xmlMemBlocks() - mem_base);
45373 test_ret++;
45374 printf(" %d", n_ctxt);
45375 printf(" %d", n_cur);
45376 printf("\n");
45377 }
45378 }
45379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045380 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045381#endif
45382
Daniel Veillarda82b1822004-11-08 16:24:57 +000045383 return(test_ret);
45384}
45385
45386
45387static int
45388test_xmlXPathNextAncestorOrSelf(void) {
45389 int test_ret = 0;
45390
William M. Brack21e4ef22005-01-02 09:53:13 +000045391#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045392 int mem_base;
45393 xmlNodePtr ret_val;
45394 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45395 int n_ctxt;
45396 xmlNodePtr cur; /* the current node in the traversal */
45397 int n_cur;
45398
45399 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45400 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45401 mem_base = xmlMemBlocks();
45402 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45403 cur = gen_xmlNodePtr(n_cur, 1);
45404
45405 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45406 desret_xmlNodePtr(ret_val);
45407 call_tests++;
45408 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45409 des_xmlNodePtr(n_cur, cur, 1);
45410 xmlResetLastError();
45411 if (mem_base != xmlMemBlocks()) {
45412 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45413 xmlMemBlocks() - mem_base);
45414 test_ret++;
45415 printf(" %d", n_ctxt);
45416 printf(" %d", n_cur);
45417 printf("\n");
45418 }
45419 }
45420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045421 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045422#endif
45423
Daniel Veillarda82b1822004-11-08 16:24:57 +000045424 return(test_ret);
45425}
45426
45427
45428static int
45429test_xmlXPathNextAttribute(void) {
45430 int test_ret = 0;
45431
William M. Brack21e4ef22005-01-02 09:53:13 +000045432#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045433 int mem_base;
45434 xmlNodePtr ret_val;
45435 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45436 int n_ctxt;
45437 xmlNodePtr cur; /* the current attribute in the traversal */
45438 int n_cur;
45439
45440 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45441 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45442 mem_base = xmlMemBlocks();
45443 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45444 cur = gen_xmlNodePtr(n_cur, 1);
45445
45446 ret_val = xmlXPathNextAttribute(ctxt, cur);
45447 desret_xmlNodePtr(ret_val);
45448 call_tests++;
45449 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45450 des_xmlNodePtr(n_cur, cur, 1);
45451 xmlResetLastError();
45452 if (mem_base != xmlMemBlocks()) {
45453 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45454 xmlMemBlocks() - mem_base);
45455 test_ret++;
45456 printf(" %d", n_ctxt);
45457 printf(" %d", n_cur);
45458 printf("\n");
45459 }
45460 }
45461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045462 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045463#endif
45464
Daniel Veillarda82b1822004-11-08 16:24:57 +000045465 return(test_ret);
45466}
45467
45468
45469static int
45470test_xmlXPathNextChild(void) {
45471 int test_ret = 0;
45472
William M. Brack21e4ef22005-01-02 09:53:13 +000045473#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045474 int mem_base;
45475 xmlNodePtr ret_val;
45476 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45477 int n_ctxt;
45478 xmlNodePtr cur; /* the current node in the traversal */
45479 int n_cur;
45480
45481 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45482 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45483 mem_base = xmlMemBlocks();
45484 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45485 cur = gen_xmlNodePtr(n_cur, 1);
45486
45487 ret_val = xmlXPathNextChild(ctxt, cur);
45488 desret_xmlNodePtr(ret_val);
45489 call_tests++;
45490 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45491 des_xmlNodePtr(n_cur, cur, 1);
45492 xmlResetLastError();
45493 if (mem_base != xmlMemBlocks()) {
45494 printf("Leak of %d blocks found in xmlXPathNextChild",
45495 xmlMemBlocks() - mem_base);
45496 test_ret++;
45497 printf(" %d", n_ctxt);
45498 printf(" %d", n_cur);
45499 printf("\n");
45500 }
45501 }
45502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045503 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045504#endif
45505
Daniel Veillarda82b1822004-11-08 16:24:57 +000045506 return(test_ret);
45507}
45508
45509
45510static int
45511test_xmlXPathNextDescendant(void) {
45512 int test_ret = 0;
45513
William M. Brack21e4ef22005-01-02 09:53:13 +000045514#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045515 int mem_base;
45516 xmlNodePtr ret_val;
45517 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45518 int n_ctxt;
45519 xmlNodePtr cur; /* the current node in the traversal */
45520 int n_cur;
45521
45522 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45523 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45524 mem_base = xmlMemBlocks();
45525 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45526 cur = gen_xmlNodePtr(n_cur, 1);
45527
45528 ret_val = xmlXPathNextDescendant(ctxt, cur);
45529 desret_xmlNodePtr(ret_val);
45530 call_tests++;
45531 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45532 des_xmlNodePtr(n_cur, cur, 1);
45533 xmlResetLastError();
45534 if (mem_base != xmlMemBlocks()) {
45535 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45536 xmlMemBlocks() - mem_base);
45537 test_ret++;
45538 printf(" %d", n_ctxt);
45539 printf(" %d", n_cur);
45540 printf("\n");
45541 }
45542 }
45543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045544 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045545#endif
45546
Daniel Veillarda82b1822004-11-08 16:24:57 +000045547 return(test_ret);
45548}
45549
45550
45551static int
45552test_xmlXPathNextDescendantOrSelf(void) {
45553 int test_ret = 0;
45554
William M. Brack21e4ef22005-01-02 09:53:13 +000045555#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045556 int mem_base;
45557 xmlNodePtr ret_val;
45558 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45559 int n_ctxt;
45560 xmlNodePtr cur; /* the current node in the traversal */
45561 int n_cur;
45562
45563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45564 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45565 mem_base = xmlMemBlocks();
45566 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45567 cur = gen_xmlNodePtr(n_cur, 1);
45568
45569 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45570 desret_xmlNodePtr(ret_val);
45571 call_tests++;
45572 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45573 des_xmlNodePtr(n_cur, cur, 1);
45574 xmlResetLastError();
45575 if (mem_base != xmlMemBlocks()) {
45576 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45577 xmlMemBlocks() - mem_base);
45578 test_ret++;
45579 printf(" %d", n_ctxt);
45580 printf(" %d", n_cur);
45581 printf("\n");
45582 }
45583 }
45584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045585 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045586#endif
45587
Daniel Veillarda82b1822004-11-08 16:24:57 +000045588 return(test_ret);
45589}
45590
45591
45592static int
45593test_xmlXPathNextFollowing(void) {
45594 int test_ret = 0;
45595
William M. Brack21e4ef22005-01-02 09:53:13 +000045596#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045597 int mem_base;
45598 xmlNodePtr ret_val;
45599 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45600 int n_ctxt;
45601 xmlNodePtr cur; /* the current node in the traversal */
45602 int n_cur;
45603
45604 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45605 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45606 mem_base = xmlMemBlocks();
45607 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45608 cur = gen_xmlNodePtr(n_cur, 1);
45609
45610 ret_val = xmlXPathNextFollowing(ctxt, cur);
45611 desret_xmlNodePtr(ret_val);
45612 call_tests++;
45613 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45614 des_xmlNodePtr(n_cur, cur, 1);
45615 xmlResetLastError();
45616 if (mem_base != xmlMemBlocks()) {
45617 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45618 xmlMemBlocks() - mem_base);
45619 test_ret++;
45620 printf(" %d", n_ctxt);
45621 printf(" %d", n_cur);
45622 printf("\n");
45623 }
45624 }
45625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045626 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045627#endif
45628
Daniel Veillarda82b1822004-11-08 16:24:57 +000045629 return(test_ret);
45630}
45631
45632
45633static int
45634test_xmlXPathNextFollowingSibling(void) {
45635 int test_ret = 0;
45636
William M. Brack21e4ef22005-01-02 09:53:13 +000045637#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045638 int mem_base;
45639 xmlNodePtr ret_val;
45640 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45641 int n_ctxt;
45642 xmlNodePtr cur; /* the current node in the traversal */
45643 int n_cur;
45644
45645 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45646 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45647 mem_base = xmlMemBlocks();
45648 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45649 cur = gen_xmlNodePtr(n_cur, 1);
45650
45651 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45652 desret_xmlNodePtr(ret_val);
45653 call_tests++;
45654 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45655 des_xmlNodePtr(n_cur, cur, 1);
45656 xmlResetLastError();
45657 if (mem_base != xmlMemBlocks()) {
45658 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45659 xmlMemBlocks() - mem_base);
45660 test_ret++;
45661 printf(" %d", n_ctxt);
45662 printf(" %d", n_cur);
45663 printf("\n");
45664 }
45665 }
45666 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045667 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045668#endif
45669
Daniel Veillarda82b1822004-11-08 16:24:57 +000045670 return(test_ret);
45671}
45672
45673
45674static int
45675test_xmlXPathNextNamespace(void) {
45676 int test_ret = 0;
45677
William M. Brack21e4ef22005-01-02 09:53:13 +000045678#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045679 int mem_base;
45680 xmlNodePtr ret_val;
45681 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45682 int n_ctxt;
45683 xmlNodePtr cur; /* the current attribute in the traversal */
45684 int n_cur;
45685
45686 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45687 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45688 mem_base = xmlMemBlocks();
45689 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45690 cur = gen_xmlNodePtr(n_cur, 1);
45691
45692 ret_val = xmlXPathNextNamespace(ctxt, cur);
45693 desret_xmlNodePtr(ret_val);
45694 call_tests++;
45695 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45696 des_xmlNodePtr(n_cur, cur, 1);
45697 xmlResetLastError();
45698 if (mem_base != xmlMemBlocks()) {
45699 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45700 xmlMemBlocks() - mem_base);
45701 test_ret++;
45702 printf(" %d", n_ctxt);
45703 printf(" %d", n_cur);
45704 printf("\n");
45705 }
45706 }
45707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045708 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045709#endif
45710
Daniel Veillarda82b1822004-11-08 16:24:57 +000045711 return(test_ret);
45712}
45713
45714
45715static int
45716test_xmlXPathNextParent(void) {
45717 int test_ret = 0;
45718
William M. Brack21e4ef22005-01-02 09:53:13 +000045719#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045720 int mem_base;
45721 xmlNodePtr ret_val;
45722 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45723 int n_ctxt;
45724 xmlNodePtr cur; /* the current node in the traversal */
45725 int n_cur;
45726
45727 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45728 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45729 mem_base = xmlMemBlocks();
45730 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45731 cur = gen_xmlNodePtr(n_cur, 1);
45732
45733 ret_val = xmlXPathNextParent(ctxt, cur);
45734 desret_xmlNodePtr(ret_val);
45735 call_tests++;
45736 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45737 des_xmlNodePtr(n_cur, cur, 1);
45738 xmlResetLastError();
45739 if (mem_base != xmlMemBlocks()) {
45740 printf("Leak of %d blocks found in xmlXPathNextParent",
45741 xmlMemBlocks() - mem_base);
45742 test_ret++;
45743 printf(" %d", n_ctxt);
45744 printf(" %d", n_cur);
45745 printf("\n");
45746 }
45747 }
45748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045749 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045750#endif
45751
Daniel Veillarda82b1822004-11-08 16:24:57 +000045752 return(test_ret);
45753}
45754
45755
45756static int
45757test_xmlXPathNextPreceding(void) {
45758 int test_ret = 0;
45759
William M. Brack21e4ef22005-01-02 09:53:13 +000045760#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045761 int mem_base;
45762 xmlNodePtr ret_val;
45763 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45764 int n_ctxt;
45765 xmlNodePtr cur; /* the current node in the traversal */
45766 int n_cur;
45767
45768 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45769 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45770 mem_base = xmlMemBlocks();
45771 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45772 cur = gen_xmlNodePtr(n_cur, 1);
45773
45774 ret_val = xmlXPathNextPreceding(ctxt, cur);
45775 desret_xmlNodePtr(ret_val);
45776 call_tests++;
45777 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45778 des_xmlNodePtr(n_cur, cur, 1);
45779 xmlResetLastError();
45780 if (mem_base != xmlMemBlocks()) {
45781 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45782 xmlMemBlocks() - mem_base);
45783 test_ret++;
45784 printf(" %d", n_ctxt);
45785 printf(" %d", n_cur);
45786 printf("\n");
45787 }
45788 }
45789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045790 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045791#endif
45792
Daniel Veillarda82b1822004-11-08 16:24:57 +000045793 return(test_ret);
45794}
45795
45796
45797static int
45798test_xmlXPathNextPrecedingSibling(void) {
45799 int test_ret = 0;
45800
William M. Brack21e4ef22005-01-02 09:53:13 +000045801#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045802 int mem_base;
45803 xmlNodePtr ret_val;
45804 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45805 int n_ctxt;
45806 xmlNodePtr cur; /* the current node in the traversal */
45807 int n_cur;
45808
45809 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45810 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45811 mem_base = xmlMemBlocks();
45812 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45813 cur = gen_xmlNodePtr(n_cur, 1);
45814
45815 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45816 desret_xmlNodePtr(ret_val);
45817 call_tests++;
45818 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45819 des_xmlNodePtr(n_cur, cur, 1);
45820 xmlResetLastError();
45821 if (mem_base != xmlMemBlocks()) {
45822 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45823 xmlMemBlocks() - mem_base);
45824 test_ret++;
45825 printf(" %d", n_ctxt);
45826 printf(" %d", n_cur);
45827 printf("\n");
45828 }
45829 }
45830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045831 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045832#endif
45833
Daniel Veillarda82b1822004-11-08 16:24:57 +000045834 return(test_ret);
45835}
45836
45837
45838static int
45839test_xmlXPathNextSelf(void) {
45840 int test_ret = 0;
45841
William M. Brack21e4ef22005-01-02 09:53:13 +000045842#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045843 int mem_base;
45844 xmlNodePtr ret_val;
45845 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45846 int n_ctxt;
45847 xmlNodePtr cur; /* the current node in the traversal */
45848 int n_cur;
45849
45850 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45851 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45852 mem_base = xmlMemBlocks();
45853 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45854 cur = gen_xmlNodePtr(n_cur, 1);
45855
45856 ret_val = xmlXPathNextSelf(ctxt, cur);
45857 desret_xmlNodePtr(ret_val);
45858 call_tests++;
45859 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45860 des_xmlNodePtr(n_cur, cur, 1);
45861 xmlResetLastError();
45862 if (mem_base != xmlMemBlocks()) {
45863 printf("Leak of %d blocks found in xmlXPathNextSelf",
45864 xmlMemBlocks() - mem_base);
45865 test_ret++;
45866 printf(" %d", n_ctxt);
45867 printf(" %d", n_cur);
45868 printf("\n");
45869 }
45870 }
45871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045872 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045873#endif
45874
Daniel Veillarda82b1822004-11-08 16:24:57 +000045875 return(test_ret);
45876}
45877
45878
45879static int
45880test_xmlXPathNodeLeading(void) {
45881 int test_ret = 0;
45882
William M. Brack21e4ef22005-01-02 09:53:13 +000045883#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045884 int mem_base;
45885 xmlNodeSetPtr ret_val;
45886 xmlNodeSetPtr nodes; /* a node-set */
45887 int n_nodes;
45888 xmlNodePtr node; /* a node */
45889 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045890
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045891 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45892 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45893 mem_base = xmlMemBlocks();
45894 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45895 node = gen_xmlNodePtr(n_node, 1);
45896
45897 ret_val = xmlXPathNodeLeading(nodes, node);
45898 desret_xmlNodeSetPtr(ret_val);
45899 call_tests++;
45900 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45901 des_xmlNodePtr(n_node, node, 1);
45902 xmlResetLastError();
45903 if (mem_base != xmlMemBlocks()) {
45904 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45905 xmlMemBlocks() - mem_base);
45906 test_ret++;
45907 printf(" %d", n_nodes);
45908 printf(" %d", n_node);
45909 printf("\n");
45910 }
45911 }
45912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045913 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045914#endif
45915
Daniel Veillarda82b1822004-11-08 16:24:57 +000045916 return(test_ret);
45917}
45918
45919
45920static int
45921test_xmlXPathNodeLeadingSorted(void) {
45922 int test_ret = 0;
45923
William M. Brack21e4ef22005-01-02 09:53:13 +000045924#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045925 int mem_base;
45926 xmlNodeSetPtr ret_val;
45927 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45928 int n_nodes;
45929 xmlNodePtr node; /* a node */
45930 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045931
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045932 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45933 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45934 mem_base = xmlMemBlocks();
45935 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45936 node = gen_xmlNodePtr(n_node, 1);
45937
45938 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45939 desret_xmlNodeSetPtr(ret_val);
45940 call_tests++;
45941 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45942 des_xmlNodePtr(n_node, node, 1);
45943 xmlResetLastError();
45944 if (mem_base != xmlMemBlocks()) {
45945 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45946 xmlMemBlocks() - mem_base);
45947 test_ret++;
45948 printf(" %d", n_nodes);
45949 printf(" %d", n_node);
45950 printf("\n");
45951 }
45952 }
45953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045954 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045955#endif
45956
Daniel Veillarda82b1822004-11-08 16:24:57 +000045957 return(test_ret);
45958}
45959
45960
45961static int
45962test_xmlXPathNodeSetAdd(void) {
45963 int test_ret = 0;
45964
William M. Brack21e4ef22005-01-02 09:53:13 +000045965#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045966 int mem_base;
45967 xmlNodeSetPtr cur; /* the initial node set */
45968 int n_cur;
45969 xmlNodePtr val; /* a new xmlNodePtr */
45970 int n_val;
45971
45972 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45973 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45974 mem_base = xmlMemBlocks();
45975 cur = gen_xmlNodeSetPtr(n_cur, 0);
45976 val = gen_xmlNodePtr(n_val, 1);
45977
45978 xmlXPathNodeSetAdd(cur, val);
45979 call_tests++;
45980 des_xmlNodeSetPtr(n_cur, cur, 0);
45981 des_xmlNodePtr(n_val, val, 1);
45982 xmlResetLastError();
45983 if (mem_base != xmlMemBlocks()) {
45984 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45985 xmlMemBlocks() - mem_base);
45986 test_ret++;
45987 printf(" %d", n_cur);
45988 printf(" %d", n_val);
45989 printf("\n");
45990 }
45991 }
45992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045993 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045994#endif
45995
Daniel Veillarda82b1822004-11-08 16:24:57 +000045996 return(test_ret);
45997}
45998
45999
46000static int
46001test_xmlXPathNodeSetAddNs(void) {
46002 int test_ret = 0;
46003
William M. Brack21e4ef22005-01-02 09:53:13 +000046004#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046005 int mem_base;
46006 xmlNodeSetPtr cur; /* the initial node set */
46007 int n_cur;
46008 xmlNodePtr node; /* the hosting node */
46009 int n_node;
46010 xmlNsPtr ns; /* a the namespace node */
46011 int n_ns;
46012
46013 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46014 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46015 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46016 mem_base = xmlMemBlocks();
46017 cur = gen_xmlNodeSetPtr(n_cur, 0);
46018 node = gen_xmlNodePtr(n_node, 1);
46019 ns = gen_xmlNsPtr(n_ns, 2);
46020
46021 xmlXPathNodeSetAddNs(cur, node, ns);
46022 call_tests++;
46023 des_xmlNodeSetPtr(n_cur, cur, 0);
46024 des_xmlNodePtr(n_node, node, 1);
46025 des_xmlNsPtr(n_ns, ns, 2);
46026 xmlResetLastError();
46027 if (mem_base != xmlMemBlocks()) {
46028 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46029 xmlMemBlocks() - mem_base);
46030 test_ret++;
46031 printf(" %d", n_cur);
46032 printf(" %d", n_node);
46033 printf(" %d", n_ns);
46034 printf("\n");
46035 }
46036 }
46037 }
46038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046039 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046040#endif
46041
Daniel Veillarda82b1822004-11-08 16:24:57 +000046042 return(test_ret);
46043}
46044
46045
46046static int
46047test_xmlXPathNodeSetAddUnique(void) {
46048 int test_ret = 0;
46049
William M. Brack21e4ef22005-01-02 09:53:13 +000046050#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046051 int mem_base;
46052 xmlNodeSetPtr cur; /* the initial node set */
46053 int n_cur;
46054 xmlNodePtr val; /* a new xmlNodePtr */
46055 int n_val;
46056
46057 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46058 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46059 mem_base = xmlMemBlocks();
46060 cur = gen_xmlNodeSetPtr(n_cur, 0);
46061 val = gen_xmlNodePtr(n_val, 1);
46062
46063 xmlXPathNodeSetAddUnique(cur, val);
46064 call_tests++;
46065 des_xmlNodeSetPtr(n_cur, cur, 0);
46066 des_xmlNodePtr(n_val, val, 1);
46067 xmlResetLastError();
46068 if (mem_base != xmlMemBlocks()) {
46069 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46070 xmlMemBlocks() - mem_base);
46071 test_ret++;
46072 printf(" %d", n_cur);
46073 printf(" %d", n_val);
46074 printf("\n");
46075 }
46076 }
46077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046078 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046079#endif
46080
Daniel Veillarda82b1822004-11-08 16:24:57 +000046081 return(test_ret);
46082}
46083
46084
46085static int
46086test_xmlXPathNodeSetContains(void) {
46087 int test_ret = 0;
46088
William M. Brack21e4ef22005-01-02 09:53:13 +000046089#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046090 int mem_base;
46091 int ret_val;
46092 xmlNodeSetPtr cur; /* the node-set */
46093 int n_cur;
46094 xmlNodePtr val; /* the node */
46095 int n_val;
46096
46097 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46098 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46099 mem_base = xmlMemBlocks();
46100 cur = gen_xmlNodeSetPtr(n_cur, 0);
46101 val = gen_xmlNodePtr(n_val, 1);
46102
46103 ret_val = xmlXPathNodeSetContains(cur, val);
46104 desret_int(ret_val);
46105 call_tests++;
46106 des_xmlNodeSetPtr(n_cur, cur, 0);
46107 des_xmlNodePtr(n_val, val, 1);
46108 xmlResetLastError();
46109 if (mem_base != xmlMemBlocks()) {
46110 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46111 xmlMemBlocks() - mem_base);
46112 test_ret++;
46113 printf(" %d", n_cur);
46114 printf(" %d", n_val);
46115 printf("\n");
46116 }
46117 }
46118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046119 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046120#endif
46121
Daniel Veillarda82b1822004-11-08 16:24:57 +000046122 return(test_ret);
46123}
46124
46125
46126static int
46127test_xmlXPathNodeSetDel(void) {
46128 int test_ret = 0;
46129
William M. Brack21e4ef22005-01-02 09:53:13 +000046130#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046131 int mem_base;
46132 xmlNodeSetPtr cur; /* the initial node set */
46133 int n_cur;
46134 xmlNodePtr val; /* an xmlNodePtr */
46135 int n_val;
46136
46137 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46138 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46139 mem_base = xmlMemBlocks();
46140 cur = gen_xmlNodeSetPtr(n_cur, 0);
46141 val = gen_xmlNodePtr(n_val, 1);
46142
46143 xmlXPathNodeSetDel(cur, val);
46144 call_tests++;
46145 des_xmlNodeSetPtr(n_cur, cur, 0);
46146 des_xmlNodePtr(n_val, val, 1);
46147 xmlResetLastError();
46148 if (mem_base != xmlMemBlocks()) {
46149 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46150 xmlMemBlocks() - mem_base);
46151 test_ret++;
46152 printf(" %d", n_cur);
46153 printf(" %d", n_val);
46154 printf("\n");
46155 }
46156 }
46157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046158 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046159#endif
46160
Daniel Veillarda82b1822004-11-08 16:24:57 +000046161 return(test_ret);
46162}
46163
46164
46165static int
46166test_xmlXPathNodeSetMerge(void) {
46167 int test_ret = 0;
46168
William M. Brack21e4ef22005-01-02 09:53:13 +000046169#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046170 int mem_base;
46171 xmlNodeSetPtr ret_val;
46172 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46173 int n_val1;
46174 xmlNodeSetPtr val2; /* the second NodeSet */
46175 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046176
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046177 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46178 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46179 mem_base = xmlMemBlocks();
46180 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46181 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46182
46183 ret_val = xmlXPathNodeSetMerge(val1, val2);
46184 desret_xmlNodeSetPtr(ret_val);
46185 call_tests++;
46186 des_xmlNodeSetPtr(n_val1, val1, 0);
46187 des_xmlNodeSetPtr(n_val2, val2, 1);
46188 xmlResetLastError();
46189 if (mem_base != xmlMemBlocks()) {
46190 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46191 xmlMemBlocks() - mem_base);
46192 test_ret++;
46193 printf(" %d", n_val1);
46194 printf(" %d", n_val2);
46195 printf("\n");
46196 }
46197 }
46198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046199 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046200#endif
46201
Daniel Veillarda82b1822004-11-08 16:24:57 +000046202 return(test_ret);
46203}
46204
46205
46206static int
46207test_xmlXPathNodeSetRemove(void) {
46208 int test_ret = 0;
46209
William M. Brack21e4ef22005-01-02 09:53:13 +000046210#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046211 int mem_base;
46212 xmlNodeSetPtr cur; /* the initial node set */
46213 int n_cur;
46214 int val; /* the index to remove */
46215 int n_val;
46216
46217 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46218 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46219 mem_base = xmlMemBlocks();
46220 cur = gen_xmlNodeSetPtr(n_cur, 0);
46221 val = gen_int(n_val, 1);
46222
46223 xmlXPathNodeSetRemove(cur, val);
46224 call_tests++;
46225 des_xmlNodeSetPtr(n_cur, cur, 0);
46226 des_int(n_val, val, 1);
46227 xmlResetLastError();
46228 if (mem_base != xmlMemBlocks()) {
46229 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46230 xmlMemBlocks() - mem_base);
46231 test_ret++;
46232 printf(" %d", n_cur);
46233 printf(" %d", n_val);
46234 printf("\n");
46235 }
46236 }
46237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046238 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046239#endif
46240
Daniel Veillarda82b1822004-11-08 16:24:57 +000046241 return(test_ret);
46242}
46243
46244
46245static int
46246test_xmlXPathNodeSetSort(void) {
46247 int test_ret = 0;
46248
William M. Brack21e4ef22005-01-02 09:53:13 +000046249#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046250 int mem_base;
46251 xmlNodeSetPtr set; /* the node set */
46252 int n_set;
46253
46254 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46255 mem_base = xmlMemBlocks();
46256 set = gen_xmlNodeSetPtr(n_set, 0);
46257
46258 xmlXPathNodeSetSort(set);
46259 call_tests++;
46260 des_xmlNodeSetPtr(n_set, set, 0);
46261 xmlResetLastError();
46262 if (mem_base != xmlMemBlocks()) {
46263 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46264 xmlMemBlocks() - mem_base);
46265 test_ret++;
46266 printf(" %d", n_set);
46267 printf("\n");
46268 }
46269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046270 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046271#endif
46272
Daniel Veillarda82b1822004-11-08 16:24:57 +000046273 return(test_ret);
46274}
46275
46276
46277static int
46278test_xmlXPathNodeTrailing(void) {
46279 int test_ret = 0;
46280
William M. Brack21e4ef22005-01-02 09:53:13 +000046281#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046282 int mem_base;
46283 xmlNodeSetPtr ret_val;
46284 xmlNodeSetPtr nodes; /* a node-set */
46285 int n_nodes;
46286 xmlNodePtr node; /* a node */
46287 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046288
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046289 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46290 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46291 mem_base = xmlMemBlocks();
46292 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46293 node = gen_xmlNodePtr(n_node, 1);
46294
46295 ret_val = xmlXPathNodeTrailing(nodes, node);
46296 desret_xmlNodeSetPtr(ret_val);
46297 call_tests++;
46298 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46299 des_xmlNodePtr(n_node, node, 1);
46300 xmlResetLastError();
46301 if (mem_base != xmlMemBlocks()) {
46302 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46303 xmlMemBlocks() - mem_base);
46304 test_ret++;
46305 printf(" %d", n_nodes);
46306 printf(" %d", n_node);
46307 printf("\n");
46308 }
46309 }
46310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046311 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046312#endif
46313
Daniel Veillarda82b1822004-11-08 16:24:57 +000046314 return(test_ret);
46315}
46316
46317
46318static int
46319test_xmlXPathNodeTrailingSorted(void) {
46320 int test_ret = 0;
46321
William M. Brack21e4ef22005-01-02 09:53:13 +000046322#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046323 int mem_base;
46324 xmlNodeSetPtr ret_val;
46325 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46326 int n_nodes;
46327 xmlNodePtr node; /* a node */
46328 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046329
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046330 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46331 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46332 mem_base = xmlMemBlocks();
46333 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46334 node = gen_xmlNodePtr(n_node, 1);
46335
46336 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46337 desret_xmlNodeSetPtr(ret_val);
46338 call_tests++;
46339 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46340 des_xmlNodePtr(n_node, node, 1);
46341 xmlResetLastError();
46342 if (mem_base != xmlMemBlocks()) {
46343 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46344 xmlMemBlocks() - mem_base);
46345 test_ret++;
46346 printf(" %d", n_nodes);
46347 printf(" %d", n_node);
46348 printf("\n");
46349 }
46350 }
46351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046352 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046353#endif
46354
Daniel Veillarda82b1822004-11-08 16:24:57 +000046355 return(test_ret);
46356}
46357
46358
46359static int
46360test_xmlXPathNormalizeFunction(void) {
46361 int test_ret = 0;
46362
William M. Brack21e4ef22005-01-02 09:53:13 +000046363#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046364 int mem_base;
46365 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46366 int n_ctxt;
46367 int nargs; /* the number of arguments */
46368 int n_nargs;
46369
46370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46371 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46372 mem_base = xmlMemBlocks();
46373 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46374 nargs = gen_int(n_nargs, 1);
46375
46376 xmlXPathNormalizeFunction(ctxt, nargs);
46377 call_tests++;
46378 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46379 des_int(n_nargs, nargs, 1);
46380 xmlResetLastError();
46381 if (mem_base != xmlMemBlocks()) {
46382 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46383 xmlMemBlocks() - mem_base);
46384 test_ret++;
46385 printf(" %d", n_ctxt);
46386 printf(" %d", n_nargs);
46387 printf("\n");
46388 }
46389 }
46390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046391 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046392#endif
46393
Daniel Veillarda82b1822004-11-08 16:24:57 +000046394 return(test_ret);
46395}
46396
46397
46398static int
46399test_xmlXPathNotEqualValues(void) {
46400 int test_ret = 0;
46401
William M. Brack21e4ef22005-01-02 09:53:13 +000046402#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046403 int mem_base;
46404 int ret_val;
46405 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46406 int n_ctxt;
46407
46408 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46409 mem_base = xmlMemBlocks();
46410 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46411
46412 ret_val = xmlXPathNotEqualValues(ctxt);
46413 desret_int(ret_val);
46414 call_tests++;
46415 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46416 xmlResetLastError();
46417 if (mem_base != xmlMemBlocks()) {
46418 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46419 xmlMemBlocks() - mem_base);
46420 test_ret++;
46421 printf(" %d", n_ctxt);
46422 printf("\n");
46423 }
46424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046425 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046426#endif
46427
Daniel Veillarda82b1822004-11-08 16:24:57 +000046428 return(test_ret);
46429}
46430
46431
46432static int
46433test_xmlXPathNotFunction(void) {
46434 int test_ret = 0;
46435
William M. Brack21e4ef22005-01-02 09:53:13 +000046436#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046437 int mem_base;
46438 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46439 int n_ctxt;
46440 int nargs; /* the number of arguments */
46441 int n_nargs;
46442
46443 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46444 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46445 mem_base = xmlMemBlocks();
46446 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46447 nargs = gen_int(n_nargs, 1);
46448
46449 xmlXPathNotFunction(ctxt, nargs);
46450 call_tests++;
46451 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46452 des_int(n_nargs, nargs, 1);
46453 xmlResetLastError();
46454 if (mem_base != xmlMemBlocks()) {
46455 printf("Leak of %d blocks found in xmlXPathNotFunction",
46456 xmlMemBlocks() - mem_base);
46457 test_ret++;
46458 printf(" %d", n_ctxt);
46459 printf(" %d", n_nargs);
46460 printf("\n");
46461 }
46462 }
46463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046464 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046465#endif
46466
Daniel Veillarda82b1822004-11-08 16:24:57 +000046467 return(test_ret);
46468}
46469
46470
46471static int
46472test_xmlXPathNsLookup(void) {
46473 int test_ret = 0;
46474
William M. Brack21e4ef22005-01-02 09:53:13 +000046475#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046476 int mem_base;
46477 const xmlChar * ret_val;
46478 xmlXPathContextPtr ctxt; /* the XPath context */
46479 int n_ctxt;
46480 xmlChar * prefix; /* the namespace prefix value */
46481 int n_prefix;
46482
46483 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46484 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46485 mem_base = xmlMemBlocks();
46486 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46487 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46488
William M. Brackf13f77f2004-11-12 16:03:48 +000046489 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046490 desret_const_xmlChar_ptr(ret_val);
46491 call_tests++;
46492 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046493 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046494 xmlResetLastError();
46495 if (mem_base != xmlMemBlocks()) {
46496 printf("Leak of %d blocks found in xmlXPathNsLookup",
46497 xmlMemBlocks() - mem_base);
46498 test_ret++;
46499 printf(" %d", n_ctxt);
46500 printf(" %d", n_prefix);
46501 printf("\n");
46502 }
46503 }
46504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046505 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046506#endif
46507
Daniel Veillarda82b1822004-11-08 16:24:57 +000046508 return(test_ret);
46509}
46510
46511
46512static int
46513test_xmlXPathNumberFunction(void) {
46514 int test_ret = 0;
46515
William M. Brack21e4ef22005-01-02 09:53:13 +000046516#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046517 int mem_base;
46518 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46519 int n_ctxt;
46520 int nargs; /* the number of arguments */
46521 int n_nargs;
46522
46523 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46524 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46525 mem_base = xmlMemBlocks();
46526 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46527 nargs = gen_int(n_nargs, 1);
46528
46529 xmlXPathNumberFunction(ctxt, nargs);
46530 call_tests++;
46531 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46532 des_int(n_nargs, nargs, 1);
46533 xmlResetLastError();
46534 if (mem_base != xmlMemBlocks()) {
46535 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46536 xmlMemBlocks() - mem_base);
46537 test_ret++;
46538 printf(" %d", n_ctxt);
46539 printf(" %d", n_nargs);
46540 printf("\n");
46541 }
46542 }
46543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046544 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046545#endif
46546
Daniel Veillarda82b1822004-11-08 16:24:57 +000046547 return(test_ret);
46548}
46549
46550
46551static int
46552test_xmlXPathParseNCName(void) {
46553 int test_ret = 0;
46554
William M. Brack21e4ef22005-01-02 09:53:13 +000046555#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046556 int mem_base;
46557 xmlChar * ret_val;
46558 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46559 int n_ctxt;
46560
46561 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46562 mem_base = xmlMemBlocks();
46563 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46564
46565 ret_val = xmlXPathParseNCName(ctxt);
46566 desret_xmlChar_ptr(ret_val);
46567 call_tests++;
46568 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46569 xmlResetLastError();
46570 if (mem_base != xmlMemBlocks()) {
46571 printf("Leak of %d blocks found in xmlXPathParseNCName",
46572 xmlMemBlocks() - mem_base);
46573 test_ret++;
46574 printf(" %d", n_ctxt);
46575 printf("\n");
46576 }
46577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046578 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046579#endif
46580
Daniel Veillarda82b1822004-11-08 16:24:57 +000046581 return(test_ret);
46582}
46583
46584
46585static int
46586test_xmlXPathParseName(void) {
46587 int test_ret = 0;
46588
William M. Brack21e4ef22005-01-02 09:53:13 +000046589#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046590 int mem_base;
46591 xmlChar * ret_val;
46592 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46593 int n_ctxt;
46594
46595 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46596 mem_base = xmlMemBlocks();
46597 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46598
46599 ret_val = xmlXPathParseName(ctxt);
46600 desret_xmlChar_ptr(ret_val);
46601 call_tests++;
46602 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46603 xmlResetLastError();
46604 if (mem_base != xmlMemBlocks()) {
46605 printf("Leak of %d blocks found in xmlXPathParseName",
46606 xmlMemBlocks() - mem_base);
46607 test_ret++;
46608 printf(" %d", n_ctxt);
46609 printf("\n");
46610 }
46611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046612 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046613#endif
46614
Daniel Veillarda82b1822004-11-08 16:24:57 +000046615 return(test_ret);
46616}
46617
46618
46619static int
46620test_xmlXPathPopBoolean(void) {
46621 int test_ret = 0;
46622
William M. Brack21e4ef22005-01-02 09:53:13 +000046623#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046624 int mem_base;
46625 int ret_val;
46626 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46627 int n_ctxt;
46628
46629 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46630 mem_base = xmlMemBlocks();
46631 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46632
46633 ret_val = xmlXPathPopBoolean(ctxt);
46634 desret_int(ret_val);
46635 call_tests++;
46636 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46637 xmlResetLastError();
46638 if (mem_base != xmlMemBlocks()) {
46639 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46640 xmlMemBlocks() - mem_base);
46641 test_ret++;
46642 printf(" %d", n_ctxt);
46643 printf("\n");
46644 }
46645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046646 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046647#endif
46648
Daniel Veillarda82b1822004-11-08 16:24:57 +000046649 return(test_ret);
46650}
46651
46652
46653static int
46654test_xmlXPathPopExternal(void) {
46655 int test_ret = 0;
46656
William M. Brack21e4ef22005-01-02 09:53:13 +000046657#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046658 int mem_base;
46659 void * ret_val;
46660 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46661 int n_ctxt;
46662
46663 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46664 mem_base = xmlMemBlocks();
46665 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46666
46667 ret_val = xmlXPathPopExternal(ctxt);
46668 desret_void_ptr(ret_val);
46669 call_tests++;
46670 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46671 xmlResetLastError();
46672 if (mem_base != xmlMemBlocks()) {
46673 printf("Leak of %d blocks found in xmlXPathPopExternal",
46674 xmlMemBlocks() - mem_base);
46675 test_ret++;
46676 printf(" %d", n_ctxt);
46677 printf("\n");
46678 }
46679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046680 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046681#endif
46682
Daniel Veillarda82b1822004-11-08 16:24:57 +000046683 return(test_ret);
46684}
46685
46686
46687static int
46688test_xmlXPathPopNodeSet(void) {
46689 int test_ret = 0;
46690
William M. Brack21e4ef22005-01-02 09:53:13 +000046691#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046692 int mem_base;
46693 xmlNodeSetPtr ret_val;
46694 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46695 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046696
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46698 mem_base = xmlMemBlocks();
46699 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46700
46701 ret_val = xmlXPathPopNodeSet(ctxt);
46702 desret_xmlNodeSetPtr(ret_val);
46703 call_tests++;
46704 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46705 xmlResetLastError();
46706 if (mem_base != xmlMemBlocks()) {
46707 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46708 xmlMemBlocks() - mem_base);
46709 test_ret++;
46710 printf(" %d", n_ctxt);
46711 printf("\n");
46712 }
46713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046714 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046715#endif
46716
Daniel Veillarda82b1822004-11-08 16:24:57 +000046717 return(test_ret);
46718}
46719
46720
46721static int
46722test_xmlXPathPopNumber(void) {
46723 int test_ret = 0;
46724
William M. Brack21e4ef22005-01-02 09:53:13 +000046725#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046726 int mem_base;
46727 double ret_val;
46728 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46729 int n_ctxt;
46730
46731 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46732 mem_base = xmlMemBlocks();
46733 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46734
46735 ret_val = xmlXPathPopNumber(ctxt);
46736 desret_double(ret_val);
46737 call_tests++;
46738 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46739 xmlResetLastError();
46740 if (mem_base != xmlMemBlocks()) {
46741 printf("Leak of %d blocks found in xmlXPathPopNumber",
46742 xmlMemBlocks() - mem_base);
46743 test_ret++;
46744 printf(" %d", n_ctxt);
46745 printf("\n");
46746 }
46747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046748 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046749#endif
46750
Daniel Veillarda82b1822004-11-08 16:24:57 +000046751 return(test_ret);
46752}
46753
46754
46755static int
46756test_xmlXPathPopString(void) {
46757 int test_ret = 0;
46758
William M. Brack21e4ef22005-01-02 09:53:13 +000046759#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046760 int mem_base;
46761 xmlChar * ret_val;
46762 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46763 int n_ctxt;
46764
46765 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46766 mem_base = xmlMemBlocks();
46767 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46768
46769 ret_val = xmlXPathPopString(ctxt);
46770 desret_xmlChar_ptr(ret_val);
46771 call_tests++;
46772 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46773 xmlResetLastError();
46774 if (mem_base != xmlMemBlocks()) {
46775 printf("Leak of %d blocks found in xmlXPathPopString",
46776 xmlMemBlocks() - mem_base);
46777 test_ret++;
46778 printf(" %d", n_ctxt);
46779 printf("\n");
46780 }
46781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046782 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046783#endif
46784
Daniel Veillarda82b1822004-11-08 16:24:57 +000046785 return(test_ret);
46786}
46787
46788
46789static int
46790test_xmlXPathPositionFunction(void) {
46791 int test_ret = 0;
46792
William M. Brack21e4ef22005-01-02 09:53:13 +000046793#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046794 int mem_base;
46795 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46796 int n_ctxt;
46797 int nargs; /* the number of arguments */
46798 int n_nargs;
46799
46800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46801 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46802 mem_base = xmlMemBlocks();
46803 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46804 nargs = gen_int(n_nargs, 1);
46805
46806 xmlXPathPositionFunction(ctxt, nargs);
46807 call_tests++;
46808 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46809 des_int(n_nargs, nargs, 1);
46810 xmlResetLastError();
46811 if (mem_base != xmlMemBlocks()) {
46812 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46813 xmlMemBlocks() - mem_base);
46814 test_ret++;
46815 printf(" %d", n_ctxt);
46816 printf(" %d", n_nargs);
46817 printf("\n");
46818 }
46819 }
46820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046821 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046822#endif
46823
Daniel Veillarda82b1822004-11-08 16:24:57 +000046824 return(test_ret);
46825}
46826
46827
46828static int
46829test_xmlXPathRegisterAllFunctions(void) {
46830 int test_ret = 0;
46831
William M. Brack21e4ef22005-01-02 09:53:13 +000046832#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046833 int mem_base;
46834 xmlXPathContextPtr ctxt; /* the XPath context */
46835 int n_ctxt;
46836
46837 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46838 mem_base = xmlMemBlocks();
46839 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46840
46841 xmlXPathRegisterAllFunctions(ctxt);
46842 call_tests++;
46843 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46844 xmlResetLastError();
46845 if (mem_base != xmlMemBlocks()) {
46846 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46847 xmlMemBlocks() - mem_base);
46848 test_ret++;
46849 printf(" %d", n_ctxt);
46850 printf("\n");
46851 }
46852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046853 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046854#endif
46855
Daniel Veillarda82b1822004-11-08 16:24:57 +000046856 return(test_ret);
46857}
46858
46859
46860static int
46861test_xmlXPathRegisterFunc(void) {
46862 int test_ret = 0;
46863
46864
46865 /* missing type support */
46866 return(test_ret);
46867}
46868
46869
46870static int
46871test_xmlXPathRegisterFuncLookup(void) {
46872 int test_ret = 0;
46873
46874
46875 /* missing type support */
46876 return(test_ret);
46877}
46878
46879
46880static int
46881test_xmlXPathRegisterFuncNS(void) {
46882 int test_ret = 0;
46883
46884
46885 /* missing type support */
46886 return(test_ret);
46887}
46888
46889
46890static int
46891test_xmlXPathRegisterNs(void) {
46892 int test_ret = 0;
46893
William M. Brack21e4ef22005-01-02 09:53:13 +000046894#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046895 int mem_base;
46896 int ret_val;
46897 xmlXPathContextPtr ctxt; /* the XPath context */
46898 int n_ctxt;
46899 xmlChar * prefix; /* the namespace prefix */
46900 int n_prefix;
46901 xmlChar * ns_uri; /* the namespace name */
46902 int n_ns_uri;
46903
46904 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46905 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46906 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46907 mem_base = xmlMemBlocks();
46908 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46909 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46910 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46911
William M. Brackf13f77f2004-11-12 16:03:48 +000046912 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046913 desret_int(ret_val);
46914 call_tests++;
46915 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046916 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46917 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046918 xmlResetLastError();
46919 if (mem_base != xmlMemBlocks()) {
46920 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46921 xmlMemBlocks() - mem_base);
46922 test_ret++;
46923 printf(" %d", n_ctxt);
46924 printf(" %d", n_prefix);
46925 printf(" %d", n_ns_uri);
46926 printf("\n");
46927 }
46928 }
46929 }
46930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046931 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046932#endif
46933
Daniel Veillarda82b1822004-11-08 16:24:57 +000046934 return(test_ret);
46935}
46936
46937
46938static int
46939test_xmlXPathRegisterVariable(void) {
46940 int test_ret = 0;
46941
William M. Brack21e4ef22005-01-02 09:53:13 +000046942#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046943 int mem_base;
46944 int ret_val;
46945 xmlXPathContextPtr ctxt; /* the XPath context */
46946 int n_ctxt;
46947 xmlChar * name; /* the variable name */
46948 int n_name;
46949 xmlXPathObjectPtr value; /* the variable value or NULL */
46950 int n_value;
46951
46952 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46953 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46954 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46955 mem_base = xmlMemBlocks();
46956 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46957 name = gen_const_xmlChar_ptr(n_name, 1);
46958 value = gen_xmlXPathObjectPtr(n_value, 2);
46959
William M. Brackf13f77f2004-11-12 16:03:48 +000046960 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046961 desret_int(ret_val);
46962 call_tests++;
46963 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046964 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046965 des_xmlXPathObjectPtr(n_value, value, 2);
46966 xmlResetLastError();
46967 if (mem_base != xmlMemBlocks()) {
46968 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46969 xmlMemBlocks() - mem_base);
46970 test_ret++;
46971 printf(" %d", n_ctxt);
46972 printf(" %d", n_name);
46973 printf(" %d", n_value);
46974 printf("\n");
46975 }
46976 }
46977 }
46978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046979 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046980#endif
46981
Daniel Veillarda82b1822004-11-08 16:24:57 +000046982 return(test_ret);
46983}
46984
46985
46986static int
46987test_xmlXPathRegisterVariableLookup(void) {
46988 int test_ret = 0;
46989
46990
46991 /* missing type support */
46992 return(test_ret);
46993}
46994
46995
46996static int
46997test_xmlXPathRegisterVariableNS(void) {
46998 int test_ret = 0;
46999
William M. Brack21e4ef22005-01-02 09:53:13 +000047000#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047001 int mem_base;
47002 int ret_val;
47003 xmlXPathContextPtr ctxt; /* the XPath context */
47004 int n_ctxt;
47005 xmlChar * name; /* the variable name */
47006 int n_name;
47007 xmlChar * ns_uri; /* the variable namespace URI */
47008 int n_ns_uri;
47009 xmlXPathObjectPtr value; /* the variable value or NULL */
47010 int n_value;
47011
47012 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47013 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47014 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47015 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47016 mem_base = xmlMemBlocks();
47017 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47018 name = gen_const_xmlChar_ptr(n_name, 1);
47019 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47020 value = gen_xmlXPathObjectPtr(n_value, 3);
47021
William M. Brackf13f77f2004-11-12 16:03:48 +000047022 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047023 desret_int(ret_val);
47024 call_tests++;
47025 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047026 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47027 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047028 des_xmlXPathObjectPtr(n_value, value, 3);
47029 xmlResetLastError();
47030 if (mem_base != xmlMemBlocks()) {
47031 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47032 xmlMemBlocks() - mem_base);
47033 test_ret++;
47034 printf(" %d", n_ctxt);
47035 printf(" %d", n_name);
47036 printf(" %d", n_ns_uri);
47037 printf(" %d", n_value);
47038 printf("\n");
47039 }
47040 }
47041 }
47042 }
47043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047044 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047045#endif
47046
Daniel Veillarda82b1822004-11-08 16:24:57 +000047047 return(test_ret);
47048}
47049
47050
47051static int
47052test_xmlXPathRegisteredFuncsCleanup(void) {
47053 int test_ret = 0;
47054
William M. Brack21e4ef22005-01-02 09:53:13 +000047055#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047056 int mem_base;
47057 xmlXPathContextPtr ctxt; /* the XPath context */
47058 int n_ctxt;
47059
47060 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47061 mem_base = xmlMemBlocks();
47062 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47063
47064 xmlXPathRegisteredFuncsCleanup(ctxt);
47065 call_tests++;
47066 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47067 xmlResetLastError();
47068 if (mem_base != xmlMemBlocks()) {
47069 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47070 xmlMemBlocks() - mem_base);
47071 test_ret++;
47072 printf(" %d", n_ctxt);
47073 printf("\n");
47074 }
47075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047076 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047077#endif
47078
Daniel Veillarda82b1822004-11-08 16:24:57 +000047079 return(test_ret);
47080}
47081
47082
47083static int
47084test_xmlXPathRegisteredNsCleanup(void) {
47085 int test_ret = 0;
47086
William M. Brack21e4ef22005-01-02 09:53:13 +000047087#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047088 int mem_base;
47089 xmlXPathContextPtr ctxt; /* the XPath context */
47090 int n_ctxt;
47091
47092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47093 mem_base = xmlMemBlocks();
47094 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47095
47096 xmlXPathRegisteredNsCleanup(ctxt);
47097 call_tests++;
47098 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47099 xmlResetLastError();
47100 if (mem_base != xmlMemBlocks()) {
47101 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47102 xmlMemBlocks() - mem_base);
47103 test_ret++;
47104 printf(" %d", n_ctxt);
47105 printf("\n");
47106 }
47107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047108 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047109#endif
47110
Daniel Veillarda82b1822004-11-08 16:24:57 +000047111 return(test_ret);
47112}
47113
47114
47115static int
47116test_xmlXPathRegisteredVariablesCleanup(void) {
47117 int test_ret = 0;
47118
William M. Brack21e4ef22005-01-02 09:53:13 +000047119#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047120 int mem_base;
47121 xmlXPathContextPtr ctxt; /* the XPath context */
47122 int n_ctxt;
47123
47124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47125 mem_base = xmlMemBlocks();
47126 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47127
47128 xmlXPathRegisteredVariablesCleanup(ctxt);
47129 call_tests++;
47130 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47131 xmlResetLastError();
47132 if (mem_base != xmlMemBlocks()) {
47133 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47134 xmlMemBlocks() - mem_base);
47135 test_ret++;
47136 printf(" %d", n_ctxt);
47137 printf("\n");
47138 }
47139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047140 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047141#endif
47142
Daniel Veillarda82b1822004-11-08 16:24:57 +000047143 return(test_ret);
47144}
47145
47146
47147static int
47148test_xmlXPathRoot(void) {
47149 int test_ret = 0;
47150
William M. Brack21e4ef22005-01-02 09:53:13 +000047151#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047152 int mem_base;
47153 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47154 int n_ctxt;
47155
47156 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47157 mem_base = xmlMemBlocks();
47158 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47159
47160 xmlXPathRoot(ctxt);
47161 call_tests++;
47162 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47163 xmlResetLastError();
47164 if (mem_base != xmlMemBlocks()) {
47165 printf("Leak of %d blocks found in xmlXPathRoot",
47166 xmlMemBlocks() - mem_base);
47167 test_ret++;
47168 printf(" %d", n_ctxt);
47169 printf("\n");
47170 }
47171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047172 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047173#endif
47174
Daniel Veillarda82b1822004-11-08 16:24:57 +000047175 return(test_ret);
47176}
47177
47178
47179static int
47180test_xmlXPathRoundFunction(void) {
47181 int test_ret = 0;
47182
William M. Brack21e4ef22005-01-02 09:53:13 +000047183#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047184 int mem_base;
47185 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47186 int n_ctxt;
47187 int nargs; /* the number of arguments */
47188 int n_nargs;
47189
47190 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47191 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47192 mem_base = xmlMemBlocks();
47193 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47194 nargs = gen_int(n_nargs, 1);
47195
47196 xmlXPathRoundFunction(ctxt, nargs);
47197 call_tests++;
47198 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47199 des_int(n_nargs, nargs, 1);
47200 xmlResetLastError();
47201 if (mem_base != xmlMemBlocks()) {
47202 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47203 xmlMemBlocks() - mem_base);
47204 test_ret++;
47205 printf(" %d", n_ctxt);
47206 printf(" %d", n_nargs);
47207 printf("\n");
47208 }
47209 }
47210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047211 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047212#endif
47213
Daniel Veillarda82b1822004-11-08 16:24:57 +000047214 return(test_ret);
47215}
47216
47217
47218static int
47219test_xmlXPathStartsWithFunction(void) {
47220 int test_ret = 0;
47221
William M. Brack21e4ef22005-01-02 09:53:13 +000047222#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047223 int mem_base;
47224 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47225 int n_ctxt;
47226 int nargs; /* the number of arguments */
47227 int n_nargs;
47228
47229 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47230 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47231 mem_base = xmlMemBlocks();
47232 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47233 nargs = gen_int(n_nargs, 1);
47234
47235 xmlXPathStartsWithFunction(ctxt, nargs);
47236 call_tests++;
47237 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47238 des_int(n_nargs, nargs, 1);
47239 xmlResetLastError();
47240 if (mem_base != xmlMemBlocks()) {
47241 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47242 xmlMemBlocks() - mem_base);
47243 test_ret++;
47244 printf(" %d", n_ctxt);
47245 printf(" %d", n_nargs);
47246 printf("\n");
47247 }
47248 }
47249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047250 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047251#endif
47252
Daniel Veillarda82b1822004-11-08 16:24:57 +000047253 return(test_ret);
47254}
47255
47256
47257static int
47258test_xmlXPathStringEvalNumber(void) {
47259 int test_ret = 0;
47260
William M. Brack21e4ef22005-01-02 09:53:13 +000047261#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047262 int mem_base;
47263 double ret_val;
47264 xmlChar * str; /* A string to scan */
47265 int n_str;
47266
47267 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47268 mem_base = xmlMemBlocks();
47269 str = gen_const_xmlChar_ptr(n_str, 0);
47270
William M. Brackf13f77f2004-11-12 16:03:48 +000047271 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047272 desret_double(ret_val);
47273 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047274 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047275 xmlResetLastError();
47276 if (mem_base != xmlMemBlocks()) {
47277 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47278 xmlMemBlocks() - mem_base);
47279 test_ret++;
47280 printf(" %d", n_str);
47281 printf("\n");
47282 }
47283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047284 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047285#endif
47286
Daniel Veillarda82b1822004-11-08 16:24:57 +000047287 return(test_ret);
47288}
47289
47290
47291static int
47292test_xmlXPathStringFunction(void) {
47293 int test_ret = 0;
47294
William M. Brack21e4ef22005-01-02 09:53:13 +000047295#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047296 int mem_base;
47297 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47298 int n_ctxt;
47299 int nargs; /* the number of arguments */
47300 int n_nargs;
47301
47302 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47303 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47304 mem_base = xmlMemBlocks();
47305 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47306 nargs = gen_int(n_nargs, 1);
47307
47308 xmlXPathStringFunction(ctxt, nargs);
47309 call_tests++;
47310 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47311 des_int(n_nargs, nargs, 1);
47312 xmlResetLastError();
47313 if (mem_base != xmlMemBlocks()) {
47314 printf("Leak of %d blocks found in xmlXPathStringFunction",
47315 xmlMemBlocks() - mem_base);
47316 test_ret++;
47317 printf(" %d", n_ctxt);
47318 printf(" %d", n_nargs);
47319 printf("\n");
47320 }
47321 }
47322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047323 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047324#endif
47325
Daniel Veillarda82b1822004-11-08 16:24:57 +000047326 return(test_ret);
47327}
47328
47329
47330static int
47331test_xmlXPathStringLengthFunction(void) {
47332 int test_ret = 0;
47333
William M. Brack21e4ef22005-01-02 09:53:13 +000047334#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047335 int mem_base;
47336 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47337 int n_ctxt;
47338 int nargs; /* the number of arguments */
47339 int n_nargs;
47340
47341 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47342 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47343 mem_base = xmlMemBlocks();
47344 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47345 nargs = gen_int(n_nargs, 1);
47346
47347 xmlXPathStringLengthFunction(ctxt, nargs);
47348 call_tests++;
47349 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47350 des_int(n_nargs, nargs, 1);
47351 xmlResetLastError();
47352 if (mem_base != xmlMemBlocks()) {
47353 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47354 xmlMemBlocks() - mem_base);
47355 test_ret++;
47356 printf(" %d", n_ctxt);
47357 printf(" %d", n_nargs);
47358 printf("\n");
47359 }
47360 }
47361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047362 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047363#endif
47364
Daniel Veillarda82b1822004-11-08 16:24:57 +000047365 return(test_ret);
47366}
47367
47368
47369static int
47370test_xmlXPathSubValues(void) {
47371 int test_ret = 0;
47372
William M. Brack21e4ef22005-01-02 09:53:13 +000047373#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047374 int mem_base;
47375 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47376 int n_ctxt;
47377
47378 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47379 mem_base = xmlMemBlocks();
47380 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47381
47382 xmlXPathSubValues(ctxt);
47383 call_tests++;
47384 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47385 xmlResetLastError();
47386 if (mem_base != xmlMemBlocks()) {
47387 printf("Leak of %d blocks found in xmlXPathSubValues",
47388 xmlMemBlocks() - mem_base);
47389 test_ret++;
47390 printf(" %d", n_ctxt);
47391 printf("\n");
47392 }
47393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047394 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047395#endif
47396
Daniel Veillarda82b1822004-11-08 16:24:57 +000047397 return(test_ret);
47398}
47399
47400
47401static int
47402test_xmlXPathSubstringAfterFunction(void) {
47403 int test_ret = 0;
47404
William M. Brack21e4ef22005-01-02 09:53:13 +000047405#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047406 int mem_base;
47407 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47408 int n_ctxt;
47409 int nargs; /* the number of arguments */
47410 int n_nargs;
47411
47412 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47413 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47414 mem_base = xmlMemBlocks();
47415 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47416 nargs = gen_int(n_nargs, 1);
47417
47418 xmlXPathSubstringAfterFunction(ctxt, nargs);
47419 call_tests++;
47420 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47421 des_int(n_nargs, nargs, 1);
47422 xmlResetLastError();
47423 if (mem_base != xmlMemBlocks()) {
47424 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47425 xmlMemBlocks() - mem_base);
47426 test_ret++;
47427 printf(" %d", n_ctxt);
47428 printf(" %d", n_nargs);
47429 printf("\n");
47430 }
47431 }
47432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047433 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047434#endif
47435
Daniel Veillarda82b1822004-11-08 16:24:57 +000047436 return(test_ret);
47437}
47438
47439
47440static int
47441test_xmlXPathSubstringBeforeFunction(void) {
47442 int test_ret = 0;
47443
William M. Brack21e4ef22005-01-02 09:53:13 +000047444#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047445 int mem_base;
47446 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47447 int n_ctxt;
47448 int nargs; /* the number of arguments */
47449 int n_nargs;
47450
47451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47452 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47453 mem_base = xmlMemBlocks();
47454 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47455 nargs = gen_int(n_nargs, 1);
47456
47457 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47458 call_tests++;
47459 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47460 des_int(n_nargs, nargs, 1);
47461 xmlResetLastError();
47462 if (mem_base != xmlMemBlocks()) {
47463 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47464 xmlMemBlocks() - mem_base);
47465 test_ret++;
47466 printf(" %d", n_ctxt);
47467 printf(" %d", n_nargs);
47468 printf("\n");
47469 }
47470 }
47471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047472 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047473#endif
47474
Daniel Veillarda82b1822004-11-08 16:24:57 +000047475 return(test_ret);
47476}
47477
47478
47479static int
47480test_xmlXPathSubstringFunction(void) {
47481 int test_ret = 0;
47482
William M. Brack21e4ef22005-01-02 09:53:13 +000047483#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047484 int mem_base;
47485 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47486 int n_ctxt;
47487 int nargs; /* the number of arguments */
47488 int n_nargs;
47489
47490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47491 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47492 mem_base = xmlMemBlocks();
47493 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47494 nargs = gen_int(n_nargs, 1);
47495
47496 xmlXPathSubstringFunction(ctxt, nargs);
47497 call_tests++;
47498 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47499 des_int(n_nargs, nargs, 1);
47500 xmlResetLastError();
47501 if (mem_base != xmlMemBlocks()) {
47502 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47503 xmlMemBlocks() - mem_base);
47504 test_ret++;
47505 printf(" %d", n_ctxt);
47506 printf(" %d", n_nargs);
47507 printf("\n");
47508 }
47509 }
47510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047511 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047512#endif
47513
Daniel Veillarda82b1822004-11-08 16:24:57 +000047514 return(test_ret);
47515}
47516
47517
47518static int
47519test_xmlXPathSumFunction(void) {
47520 int test_ret = 0;
47521
William M. Brack21e4ef22005-01-02 09:53:13 +000047522#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047523 int mem_base;
47524 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47525 int n_ctxt;
47526 int nargs; /* the number of arguments */
47527 int n_nargs;
47528
47529 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47530 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47531 mem_base = xmlMemBlocks();
47532 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47533 nargs = gen_int(n_nargs, 1);
47534
47535 xmlXPathSumFunction(ctxt, nargs);
47536 call_tests++;
47537 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47538 des_int(n_nargs, nargs, 1);
47539 xmlResetLastError();
47540 if (mem_base != xmlMemBlocks()) {
47541 printf("Leak of %d blocks found in xmlXPathSumFunction",
47542 xmlMemBlocks() - mem_base);
47543 test_ret++;
47544 printf(" %d", n_ctxt);
47545 printf(" %d", n_nargs);
47546 printf("\n");
47547 }
47548 }
47549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047550 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047551#endif
47552
Daniel Veillarda82b1822004-11-08 16:24:57 +000047553 return(test_ret);
47554}
47555
47556
47557static int
47558test_xmlXPathTrailing(void) {
47559 int test_ret = 0;
47560
William M. Brack21e4ef22005-01-02 09:53:13 +000047561#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047562 int mem_base;
47563 xmlNodeSetPtr ret_val;
47564 xmlNodeSetPtr nodes1; /* a node-set */
47565 int n_nodes1;
47566 xmlNodeSetPtr nodes2; /* a node-set */
47567 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047568
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047569 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47570 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47571 mem_base = xmlMemBlocks();
47572 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47573 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47574
47575 ret_val = xmlXPathTrailing(nodes1, nodes2);
47576 desret_xmlNodeSetPtr(ret_val);
47577 call_tests++;
47578 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47579 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47580 xmlResetLastError();
47581 if (mem_base != xmlMemBlocks()) {
47582 printf("Leak of %d blocks found in xmlXPathTrailing",
47583 xmlMemBlocks() - mem_base);
47584 test_ret++;
47585 printf(" %d", n_nodes1);
47586 printf(" %d", n_nodes2);
47587 printf("\n");
47588 }
47589 }
47590 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047591 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047592#endif
47593
Daniel Veillarda82b1822004-11-08 16:24:57 +000047594 return(test_ret);
47595}
47596
47597
47598static int
47599test_xmlXPathTrailingSorted(void) {
47600 int test_ret = 0;
47601
William M. Brack21e4ef22005-01-02 09:53:13 +000047602#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047603 int mem_base;
47604 xmlNodeSetPtr ret_val;
47605 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47606 int n_nodes1;
47607 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47608 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047609
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047610 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47611 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47612 mem_base = xmlMemBlocks();
47613 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47614 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47615
47616 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47617 desret_xmlNodeSetPtr(ret_val);
47618 call_tests++;
47619 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47620 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47621 xmlResetLastError();
47622 if (mem_base != xmlMemBlocks()) {
47623 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47624 xmlMemBlocks() - mem_base);
47625 test_ret++;
47626 printf(" %d", n_nodes1);
47627 printf(" %d", n_nodes2);
47628 printf("\n");
47629 }
47630 }
47631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047632 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047633#endif
47634
Daniel Veillarda82b1822004-11-08 16:24:57 +000047635 return(test_ret);
47636}
47637
47638
47639static int
47640test_xmlXPathTranslateFunction(void) {
47641 int test_ret = 0;
47642
William M. Brack21e4ef22005-01-02 09:53:13 +000047643#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047644 int mem_base;
47645 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47646 int n_ctxt;
47647 int nargs; /* the number of arguments */
47648 int n_nargs;
47649
47650 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47651 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47652 mem_base = xmlMemBlocks();
47653 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47654 nargs = gen_int(n_nargs, 1);
47655
47656 xmlXPathTranslateFunction(ctxt, nargs);
47657 call_tests++;
47658 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47659 des_int(n_nargs, nargs, 1);
47660 xmlResetLastError();
47661 if (mem_base != xmlMemBlocks()) {
47662 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47663 xmlMemBlocks() - mem_base);
47664 test_ret++;
47665 printf(" %d", n_ctxt);
47666 printf(" %d", n_nargs);
47667 printf("\n");
47668 }
47669 }
47670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047671 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047672#endif
47673
Daniel Veillarda82b1822004-11-08 16:24:57 +000047674 return(test_ret);
47675}
47676
47677
47678static int
47679test_xmlXPathTrueFunction(void) {
47680 int test_ret = 0;
47681
William M. Brack21e4ef22005-01-02 09:53:13 +000047682#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047683 int mem_base;
47684 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47685 int n_ctxt;
47686 int nargs; /* the number of arguments */
47687 int n_nargs;
47688
47689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47690 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47691 mem_base = xmlMemBlocks();
47692 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47693 nargs = gen_int(n_nargs, 1);
47694
47695 xmlXPathTrueFunction(ctxt, nargs);
47696 call_tests++;
47697 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47698 des_int(n_nargs, nargs, 1);
47699 xmlResetLastError();
47700 if (mem_base != xmlMemBlocks()) {
47701 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47702 xmlMemBlocks() - mem_base);
47703 test_ret++;
47704 printf(" %d", n_ctxt);
47705 printf(" %d", n_nargs);
47706 printf("\n");
47707 }
47708 }
47709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047710 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047711#endif
47712
Daniel Veillarda82b1822004-11-08 16:24:57 +000047713 return(test_ret);
47714}
47715
47716
47717static int
47718test_xmlXPathValueFlipSign(void) {
47719 int test_ret = 0;
47720
William M. Brack21e4ef22005-01-02 09:53:13 +000047721#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047722 int mem_base;
47723 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47724 int n_ctxt;
47725
47726 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47727 mem_base = xmlMemBlocks();
47728 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47729
47730 xmlXPathValueFlipSign(ctxt);
47731 call_tests++;
47732 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47733 xmlResetLastError();
47734 if (mem_base != xmlMemBlocks()) {
47735 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47736 xmlMemBlocks() - mem_base);
47737 test_ret++;
47738 printf(" %d", n_ctxt);
47739 printf("\n");
47740 }
47741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047742 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047743#endif
47744
Daniel Veillarda82b1822004-11-08 16:24:57 +000047745 return(test_ret);
47746}
47747
47748
47749static int
47750test_xmlXPathVariableLookup(void) {
47751 int test_ret = 0;
47752
William M. Brack21e4ef22005-01-02 09:53:13 +000047753#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047754 int mem_base;
47755 xmlXPathObjectPtr ret_val;
47756 xmlXPathContextPtr ctxt; /* the XPath context */
47757 int n_ctxt;
47758 xmlChar * name; /* the variable name */
47759 int n_name;
47760
47761 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47762 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47763 mem_base = xmlMemBlocks();
47764 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47765 name = gen_const_xmlChar_ptr(n_name, 1);
47766
William M. Brackf13f77f2004-11-12 16:03:48 +000047767 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047768 desret_xmlXPathObjectPtr(ret_val);
47769 call_tests++;
47770 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047771 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047772 xmlResetLastError();
47773 if (mem_base != xmlMemBlocks()) {
47774 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47775 xmlMemBlocks() - mem_base);
47776 test_ret++;
47777 printf(" %d", n_ctxt);
47778 printf(" %d", n_name);
47779 printf("\n");
47780 }
47781 }
47782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047783 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047784#endif
47785
Daniel Veillarda82b1822004-11-08 16:24:57 +000047786 return(test_ret);
47787}
47788
47789
47790static int
47791test_xmlXPathVariableLookupNS(void) {
47792 int test_ret = 0;
47793
William M. Brack21e4ef22005-01-02 09:53:13 +000047794#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047795 int mem_base;
47796 xmlXPathObjectPtr ret_val;
47797 xmlXPathContextPtr ctxt; /* the XPath context */
47798 int n_ctxt;
47799 xmlChar * name; /* the variable name */
47800 int n_name;
47801 xmlChar * ns_uri; /* the variable namespace URI */
47802 int n_ns_uri;
47803
47804 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47805 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47806 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47807 mem_base = xmlMemBlocks();
47808 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47809 name = gen_const_xmlChar_ptr(n_name, 1);
47810 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47811
William M. Brackf13f77f2004-11-12 16:03:48 +000047812 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047813 desret_xmlXPathObjectPtr(ret_val);
47814 call_tests++;
47815 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047816 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47817 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047818 xmlResetLastError();
47819 if (mem_base != xmlMemBlocks()) {
47820 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47821 xmlMemBlocks() - mem_base);
47822 test_ret++;
47823 printf(" %d", n_ctxt);
47824 printf(" %d", n_name);
47825 printf(" %d", n_ns_uri);
47826 printf("\n");
47827 }
47828 }
47829 }
47830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047831 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047832#endif
47833
Daniel Veillarda82b1822004-11-08 16:24:57 +000047834 return(test_ret);
47835}
47836
47837
47838static int
47839test_xmlXPathWrapCString(void) {
47840 int test_ret = 0;
47841
William M. Brack21e4ef22005-01-02 09:53:13 +000047842#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047843 int mem_base;
47844 xmlXPathObjectPtr ret_val;
47845 char * val; /* the char * value */
47846 int n_val;
47847
47848 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47849 mem_base = xmlMemBlocks();
47850 val = gen_char_ptr(n_val, 0);
47851
47852 ret_val = xmlXPathWrapCString(val);
47853 desret_xmlXPathObjectPtr(ret_val);
47854 call_tests++;
47855 des_char_ptr(n_val, val, 0);
47856 xmlResetLastError();
47857 if (mem_base != xmlMemBlocks()) {
47858 printf("Leak of %d blocks found in xmlXPathWrapCString",
47859 xmlMemBlocks() - mem_base);
47860 test_ret++;
47861 printf(" %d", n_val);
47862 printf("\n");
47863 }
47864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047865 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047866#endif
47867
Daniel Veillarda82b1822004-11-08 16:24:57 +000047868 return(test_ret);
47869}
47870
47871
47872static int
47873test_xmlXPathWrapExternal(void) {
47874 int test_ret = 0;
47875
William M. Brack21e4ef22005-01-02 09:53:13 +000047876#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047877 int mem_base;
47878 xmlXPathObjectPtr ret_val;
47879 void * val; /* the user data */
47880 int n_val;
47881
47882 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47883 mem_base = xmlMemBlocks();
47884 val = gen_void_ptr(n_val, 0);
47885
47886 ret_val = xmlXPathWrapExternal(val);
47887 desret_xmlXPathObjectPtr(ret_val);
47888 call_tests++;
47889 des_void_ptr(n_val, val, 0);
47890 xmlResetLastError();
47891 if (mem_base != xmlMemBlocks()) {
47892 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47893 xmlMemBlocks() - mem_base);
47894 test_ret++;
47895 printf(" %d", n_val);
47896 printf("\n");
47897 }
47898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047899 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047900#endif
47901
Daniel Veillarda82b1822004-11-08 16:24:57 +000047902 return(test_ret);
47903}
47904
47905
47906static int
47907test_xmlXPathWrapNodeSet(void) {
47908 int test_ret = 0;
47909
William M. Brack21e4ef22005-01-02 09:53:13 +000047910#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047911 int mem_base;
47912 xmlXPathObjectPtr ret_val;
47913 xmlNodeSetPtr val; /* the NodePtr value */
47914 int n_val;
47915
47916 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47917 mem_base = xmlMemBlocks();
47918 val = gen_xmlNodeSetPtr(n_val, 0);
47919
47920 ret_val = xmlXPathWrapNodeSet(val);
47921 desret_xmlXPathObjectPtr(ret_val);
47922 call_tests++;
47923 des_xmlNodeSetPtr(n_val, val, 0);
47924 xmlResetLastError();
47925 if (mem_base != xmlMemBlocks()) {
47926 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47927 xmlMemBlocks() - mem_base);
47928 test_ret++;
47929 printf(" %d", n_val);
47930 printf("\n");
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_xmlXPatherror(void) {
47942 int test_ret = 0;
47943
William M. Brack21e4ef22005-01-02 09:53:13 +000047944#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047945 int mem_base;
47946 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47947 int n_ctxt;
47948 const char * file; /* the file name */
47949 int n_file;
47950 int line; /* the line number */
47951 int n_line;
47952 int no; /* the error number */
47953 int n_no;
47954
47955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47956 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47957 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47958 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47959 mem_base = xmlMemBlocks();
47960 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47961 file = gen_filepath(n_file, 1);
47962 line = gen_int(n_line, 2);
47963 no = gen_int(n_no, 3);
47964
47965 xmlXPatherror(ctxt, file, line, no);
47966 call_tests++;
47967 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47968 des_filepath(n_file, file, 1);
47969 des_int(n_line, line, 2);
47970 des_int(n_no, no, 3);
47971 xmlResetLastError();
47972 if (mem_base != xmlMemBlocks()) {
47973 printf("Leak of %d blocks found in xmlXPatherror",
47974 xmlMemBlocks() - mem_base);
47975 test_ret++;
47976 printf(" %d", n_ctxt);
47977 printf(" %d", n_file);
47978 printf(" %d", n_line);
47979 printf(" %d", n_no);
47980 printf("\n");
47981 }
47982 }
47983 }
47984 }
47985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047986 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047987#endif
47988
Daniel Veillarda82b1822004-11-08 16:24:57 +000047989 return(test_ret);
47990}
47991
47992static int
47993test_xpathInternals(void) {
47994 int test_ret = 0;
47995
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047996 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047997 test_ret += test_valuePop();
47998 test_ret += test_valuePush();
47999 test_ret += test_xmlXPathAddValues();
48000 test_ret += test_xmlXPathBooleanFunction();
48001 test_ret += test_xmlXPathCeilingFunction();
48002 test_ret += test_xmlXPathCompareValues();
48003 test_ret += test_xmlXPathConcatFunction();
48004 test_ret += test_xmlXPathContainsFunction();
48005 test_ret += test_xmlXPathCountFunction();
48006 test_ret += test_xmlXPathDebugDumpCompExpr();
48007 test_ret += test_xmlXPathDebugDumpObject();
48008 test_ret += test_xmlXPathDifference();
48009 test_ret += test_xmlXPathDistinct();
48010 test_ret += test_xmlXPathDistinctSorted();
48011 test_ret += test_xmlXPathDivValues();
48012 test_ret += test_xmlXPathEqualValues();
48013 test_ret += test_xmlXPathErr();
48014 test_ret += test_xmlXPathEvalExpr();
48015 test_ret += test_xmlXPathEvaluatePredicateResult();
48016 test_ret += test_xmlXPathFalseFunction();
48017 test_ret += test_xmlXPathFloorFunction();
48018 test_ret += test_xmlXPathFunctionLookup();
48019 test_ret += test_xmlXPathFunctionLookupNS();
48020 test_ret += test_xmlXPathHasSameNodes();
48021 test_ret += test_xmlXPathIdFunction();
48022 test_ret += test_xmlXPathIntersection();
48023 test_ret += test_xmlXPathIsNodeType();
48024 test_ret += test_xmlXPathLangFunction();
48025 test_ret += test_xmlXPathLastFunction();
48026 test_ret += test_xmlXPathLeading();
48027 test_ret += test_xmlXPathLeadingSorted();
48028 test_ret += test_xmlXPathLocalNameFunction();
48029 test_ret += test_xmlXPathModValues();
48030 test_ret += test_xmlXPathMultValues();
48031 test_ret += test_xmlXPathNamespaceURIFunction();
48032 test_ret += test_xmlXPathNewBoolean();
48033 test_ret += test_xmlXPathNewCString();
48034 test_ret += test_xmlXPathNewFloat();
48035 test_ret += test_xmlXPathNewNodeSet();
48036 test_ret += test_xmlXPathNewNodeSetList();
48037 test_ret += test_xmlXPathNewParserContext();
48038 test_ret += test_xmlXPathNewString();
48039 test_ret += test_xmlXPathNextAncestor();
48040 test_ret += test_xmlXPathNextAncestorOrSelf();
48041 test_ret += test_xmlXPathNextAttribute();
48042 test_ret += test_xmlXPathNextChild();
48043 test_ret += test_xmlXPathNextDescendant();
48044 test_ret += test_xmlXPathNextDescendantOrSelf();
48045 test_ret += test_xmlXPathNextFollowing();
48046 test_ret += test_xmlXPathNextFollowingSibling();
48047 test_ret += test_xmlXPathNextNamespace();
48048 test_ret += test_xmlXPathNextParent();
48049 test_ret += test_xmlXPathNextPreceding();
48050 test_ret += test_xmlXPathNextPrecedingSibling();
48051 test_ret += test_xmlXPathNextSelf();
48052 test_ret += test_xmlXPathNodeLeading();
48053 test_ret += test_xmlXPathNodeLeadingSorted();
48054 test_ret += test_xmlXPathNodeSetAdd();
48055 test_ret += test_xmlXPathNodeSetAddNs();
48056 test_ret += test_xmlXPathNodeSetAddUnique();
48057 test_ret += test_xmlXPathNodeSetContains();
48058 test_ret += test_xmlXPathNodeSetDel();
48059 test_ret += test_xmlXPathNodeSetMerge();
48060 test_ret += test_xmlXPathNodeSetRemove();
48061 test_ret += test_xmlXPathNodeSetSort();
48062 test_ret += test_xmlXPathNodeTrailing();
48063 test_ret += test_xmlXPathNodeTrailingSorted();
48064 test_ret += test_xmlXPathNormalizeFunction();
48065 test_ret += test_xmlXPathNotEqualValues();
48066 test_ret += test_xmlXPathNotFunction();
48067 test_ret += test_xmlXPathNsLookup();
48068 test_ret += test_xmlXPathNumberFunction();
48069 test_ret += test_xmlXPathParseNCName();
48070 test_ret += test_xmlXPathParseName();
48071 test_ret += test_xmlXPathPopBoolean();
48072 test_ret += test_xmlXPathPopExternal();
48073 test_ret += test_xmlXPathPopNodeSet();
48074 test_ret += test_xmlXPathPopNumber();
48075 test_ret += test_xmlXPathPopString();
48076 test_ret += test_xmlXPathPositionFunction();
48077 test_ret += test_xmlXPathRegisterAllFunctions();
48078 test_ret += test_xmlXPathRegisterFunc();
48079 test_ret += test_xmlXPathRegisterFuncLookup();
48080 test_ret += test_xmlXPathRegisterFuncNS();
48081 test_ret += test_xmlXPathRegisterNs();
48082 test_ret += test_xmlXPathRegisterVariable();
48083 test_ret += test_xmlXPathRegisterVariableLookup();
48084 test_ret += test_xmlXPathRegisterVariableNS();
48085 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48086 test_ret += test_xmlXPathRegisteredNsCleanup();
48087 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48088 test_ret += test_xmlXPathRoot();
48089 test_ret += test_xmlXPathRoundFunction();
48090 test_ret += test_xmlXPathStartsWithFunction();
48091 test_ret += test_xmlXPathStringEvalNumber();
48092 test_ret += test_xmlXPathStringFunction();
48093 test_ret += test_xmlXPathStringLengthFunction();
48094 test_ret += test_xmlXPathSubValues();
48095 test_ret += test_xmlXPathSubstringAfterFunction();
48096 test_ret += test_xmlXPathSubstringBeforeFunction();
48097 test_ret += test_xmlXPathSubstringFunction();
48098 test_ret += test_xmlXPathSumFunction();
48099 test_ret += test_xmlXPathTrailing();
48100 test_ret += test_xmlXPathTrailingSorted();
48101 test_ret += test_xmlXPathTranslateFunction();
48102 test_ret += test_xmlXPathTrueFunction();
48103 test_ret += test_xmlXPathValueFlipSign();
48104 test_ret += test_xmlXPathVariableLookup();
48105 test_ret += test_xmlXPathVariableLookupNS();
48106 test_ret += test_xmlXPathWrapCString();
48107 test_ret += test_xmlXPathWrapExternal();
48108 test_ret += test_xmlXPathWrapNodeSet();
48109 test_ret += test_xmlXPatherror();
48110
48111 if (test_ret != 0)
48112 printf("Module xpathInternals: %d errors\n", test_ret);
48113 return(test_ret);
48114}
48115
Daniel Veillardd93f6252004-11-02 15:53:51 +000048116static int
48117test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048119
William M. Brack21e4ef22005-01-02 09:53:13 +000048120#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048121 int mem_base;
48122 xmlNodePtr ret_val;
48123 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48124 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048125
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048126 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048128 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048129
48130 ret_val = xmlXPtrBuildNodeList(obj);
48131 desret_xmlNodePtr(ret_val);
48132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048133 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048134 xmlResetLastError();
48135 if (mem_base != xmlMemBlocks()) {
48136 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048138 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048139 printf(" %d", n_obj);
48140 printf("\n");
48141 }
48142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048143 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048144#endif
48145
Daniel Veillard42595322004-11-08 10:52:06 +000048146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048147}
48148
48149
48150static int
48151test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048153
William M. Brack21e4ef22005-01-02 09:53:13 +000048154#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048155 int mem_base;
48156 xmlXPathObjectPtr ret_val;
48157 xmlChar * str; /* the XPointer expression */
48158 int n_str;
48159 xmlXPathContextPtr ctx; /* the XPointer context */
48160 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048161
Daniel Veillardce682bc2004-11-05 17:22:25 +000048162 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48163 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48164 mem_base = xmlMemBlocks();
48165 str = gen_const_xmlChar_ptr(n_str, 0);
48166 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48167
William M. Brackf13f77f2004-11-12 16:03:48 +000048168 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048169 desret_xmlXPathObjectPtr(ret_val);
48170 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048171 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048172 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48173 xmlResetLastError();
48174 if (mem_base != xmlMemBlocks()) {
48175 printf("Leak of %d blocks found in xmlXPtrEval",
48176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048177 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048178 printf(" %d", n_str);
48179 printf(" %d", n_ctx);
48180 printf("\n");
48181 }
48182 }
48183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048184 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048185#endif
48186
Daniel Veillard42595322004-11-08 10:52:06 +000048187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048188}
48189
48190
48191static int
48192test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048194
William M. Brack21e4ef22005-01-02 09:53:13 +000048195#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048196 int mem_base;
48197 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48198 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048199
Daniel Veillardce682bc2004-11-05 17:22:25 +000048200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48201 mem_base = xmlMemBlocks();
48202 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48203
48204 xmlXPtrEvalRangePredicate(ctxt);
48205 call_tests++;
48206 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48207 xmlResetLastError();
48208 if (mem_base != xmlMemBlocks()) {
48209 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048211 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048212 printf(" %d", n_ctxt);
48213 printf("\n");
48214 }
48215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048216 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048217#endif
48218
Daniel Veillard42595322004-11-08 10:52:06 +000048219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048220}
48221
Daniel Veillarda521d282004-11-09 14:59:59 +000048222#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048223
Daniel Veillardce682bc2004-11-05 17:22:25 +000048224#define gen_nb_xmlLocationSetPtr 1
48225static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48226 return(NULL);
48227}
48228static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48229}
Daniel Veillarda521d282004-11-09 14:59:59 +000048230#endif
48231
Daniel Veillardce682bc2004-11-05 17:22:25 +000048232
Daniel Veillardd93f6252004-11-02 15:53:51 +000048233static int
48234test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048236
William M. Brack21e4ef22005-01-02 09:53:13 +000048237#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048238 int mem_base;
48239 xmlLocationSetPtr cur; /* the initial range set */
48240 int n_cur;
48241 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48242 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048243
Daniel Veillardce682bc2004-11-05 17:22:25 +000048244 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48245 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48246 mem_base = xmlMemBlocks();
48247 cur = gen_xmlLocationSetPtr(n_cur, 0);
48248 val = gen_xmlXPathObjectPtr(n_val, 1);
48249
48250 xmlXPtrLocationSetAdd(cur, val);
48251 call_tests++;
48252 des_xmlLocationSetPtr(n_cur, cur, 0);
48253 des_xmlXPathObjectPtr(n_val, val, 1);
48254 xmlResetLastError();
48255 if (mem_base != xmlMemBlocks()) {
48256 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048258 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048259 printf(" %d", n_cur);
48260 printf(" %d", n_val);
48261 printf("\n");
48262 }
48263 }
48264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048265 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048266#endif
48267
Daniel Veillard42595322004-11-08 10:52:06 +000048268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048269}
48270
48271
48272static int
48273test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048275
48276
48277 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048279}
48280
48281
48282static int
48283test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048285
William M. Brack21e4ef22005-01-02 09:53:13 +000048286#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048287 int mem_base;
48288 xmlLocationSetPtr cur; /* the initial range set */
48289 int n_cur;
48290 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48291 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048292
Daniel Veillardce682bc2004-11-05 17:22:25 +000048293 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48294 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48295 mem_base = xmlMemBlocks();
48296 cur = gen_xmlLocationSetPtr(n_cur, 0);
48297 val = gen_xmlXPathObjectPtr(n_val, 1);
48298
48299 xmlXPtrLocationSetDel(cur, val);
48300 call_tests++;
48301 des_xmlLocationSetPtr(n_cur, cur, 0);
48302 des_xmlXPathObjectPtr(n_val, val, 1);
48303 xmlResetLastError();
48304 if (mem_base != xmlMemBlocks()) {
48305 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048307 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048308 printf(" %d", n_cur);
48309 printf(" %d", n_val);
48310 printf("\n");
48311 }
48312 }
48313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048314 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048315#endif
48316
Daniel Veillard42595322004-11-08 10:52:06 +000048317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048318}
48319
48320
48321static int
48322test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048324
48325
48326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048328}
48329
48330
48331static int
48332test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048334
William M. Brack21e4ef22005-01-02 09:53:13 +000048335#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048336 int mem_base;
48337 xmlLocationSetPtr cur; /* the initial range set */
48338 int n_cur;
48339 int val; /* the index to remove */
48340 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048341
Daniel Veillardce682bc2004-11-05 17:22:25 +000048342 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48343 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48344 mem_base = xmlMemBlocks();
48345 cur = gen_xmlLocationSetPtr(n_cur, 0);
48346 val = gen_int(n_val, 1);
48347
48348 xmlXPtrLocationSetRemove(cur, val);
48349 call_tests++;
48350 des_xmlLocationSetPtr(n_cur, cur, 0);
48351 des_int(n_val, val, 1);
48352 xmlResetLastError();
48353 if (mem_base != xmlMemBlocks()) {
48354 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048356 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048357 printf(" %d", n_cur);
48358 printf(" %d", n_val);
48359 printf("\n");
48360 }
48361 }
48362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048363 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048364#endif
48365
Daniel Veillard42595322004-11-08 10:52:06 +000048366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048367}
48368
48369
48370static int
48371test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048373
William M. Brack21e4ef22005-01-02 09:53:13 +000048374#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048375 int mem_base;
48376 xmlXPathObjectPtr ret_val;
48377 xmlNodePtr start; /* the starting and ending node */
48378 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048379
Daniel Veillard3d97e662004-11-04 10:49:00 +000048380 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48381 mem_base = xmlMemBlocks();
48382 start = gen_xmlNodePtr(n_start, 0);
48383
48384 ret_val = xmlXPtrNewCollapsedRange(start);
48385 desret_xmlXPathObjectPtr(ret_val);
48386 call_tests++;
48387 des_xmlNodePtr(n_start, start, 0);
48388 xmlResetLastError();
48389 if (mem_base != xmlMemBlocks()) {
48390 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048392 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048393 printf(" %d", n_start);
48394 printf("\n");
48395 }
48396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048397 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048398#endif
48399
Daniel Veillard42595322004-11-08 10:52:06 +000048400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048401}
48402
48403
48404static int
48405test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048407
48408
48409 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048411}
48412
48413
48414static int
48415test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048417
William M. Brack21e4ef22005-01-02 09:53:13 +000048418#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048419 int mem_base;
48420 xmlXPathObjectPtr ret_val;
48421 xmlNodeSetPtr set; /* a node set */
48422 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048423
Daniel Veillardce682bc2004-11-05 17:22:25 +000048424 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48425 mem_base = xmlMemBlocks();
48426 set = gen_xmlNodeSetPtr(n_set, 0);
48427
48428 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48429 desret_xmlXPathObjectPtr(ret_val);
48430 call_tests++;
48431 des_xmlNodeSetPtr(n_set, set, 0);
48432 xmlResetLastError();
48433 if (mem_base != xmlMemBlocks()) {
48434 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048436 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048437 printf(" %d", n_set);
48438 printf("\n");
48439 }
48440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048441 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048442#endif
48443
Daniel Veillard42595322004-11-08 10:52:06 +000048444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048445}
48446
48447
48448static int
48449test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048451
William M. Brack21e4ef22005-01-02 09:53:13 +000048452#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048453 int mem_base;
48454 xmlXPathObjectPtr ret_val;
48455 xmlNodePtr start; /* the start NodePtr value */
48456 int n_start;
48457 xmlNodePtr end; /* the end NodePtr value or NULL */
48458 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048459
Daniel Veillard3d97e662004-11-04 10:49:00 +000048460 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48461 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48462 mem_base = xmlMemBlocks();
48463 start = gen_xmlNodePtr(n_start, 0);
48464 end = gen_xmlNodePtr(n_end, 1);
48465
48466 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48467 desret_xmlXPathObjectPtr(ret_val);
48468 call_tests++;
48469 des_xmlNodePtr(n_start, start, 0);
48470 des_xmlNodePtr(n_end, end, 1);
48471 xmlResetLastError();
48472 if (mem_base != xmlMemBlocks()) {
48473 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048475 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048476 printf(" %d", n_start);
48477 printf(" %d", n_end);
48478 printf("\n");
48479 }
48480 }
48481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048482 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048483#endif
48484
Daniel Veillard42595322004-11-08 10:52:06 +000048485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048486}
48487
48488
48489static int
48490test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048492
William M. Brack21e4ef22005-01-02 09:53:13 +000048493#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048494 int mem_base;
48495 xmlXPathObjectPtr ret_val;
48496 xmlNodePtr start; /* the starting node */
48497 int n_start;
48498 int startindex; /* the start index */
48499 int n_startindex;
48500 xmlNodePtr end; /* the ending point */
48501 int n_end;
48502 int endindex; /* the ending index */
48503 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048504
Daniel Veillard3d97e662004-11-04 10:49:00 +000048505 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48506 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48507 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48508 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48509 mem_base = xmlMemBlocks();
48510 start = gen_xmlNodePtr(n_start, 0);
48511 startindex = gen_int(n_startindex, 1);
48512 end = gen_xmlNodePtr(n_end, 2);
48513 endindex = gen_int(n_endindex, 3);
48514
48515 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48516 desret_xmlXPathObjectPtr(ret_val);
48517 call_tests++;
48518 des_xmlNodePtr(n_start, start, 0);
48519 des_int(n_startindex, startindex, 1);
48520 des_xmlNodePtr(n_end, end, 2);
48521 des_int(n_endindex, endindex, 3);
48522 xmlResetLastError();
48523 if (mem_base != xmlMemBlocks()) {
48524 printf("Leak of %d blocks found in xmlXPtrNewRange",
48525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048526 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048527 printf(" %d", n_start);
48528 printf(" %d", n_startindex);
48529 printf(" %d", n_end);
48530 printf(" %d", n_endindex);
48531 printf("\n");
48532 }
48533 }
48534 }
48535 }
48536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048537 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048538#endif
48539
Daniel Veillard42595322004-11-08 10:52:06 +000048540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048541}
48542
48543
48544static int
48545test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048547
William M. Brack21e4ef22005-01-02 09:53:13 +000048548#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048549 int mem_base;
48550 xmlXPathObjectPtr ret_val;
48551 xmlNodePtr start; /* the starting node */
48552 int n_start;
48553 xmlXPathObjectPtr end; /* the ending object */
48554 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048555
Daniel Veillard3d97e662004-11-04 10:49:00 +000048556 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48557 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48558 mem_base = xmlMemBlocks();
48559 start = gen_xmlNodePtr(n_start, 0);
48560 end = gen_xmlXPathObjectPtr(n_end, 1);
48561
48562 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48563 desret_xmlXPathObjectPtr(ret_val);
48564 call_tests++;
48565 des_xmlNodePtr(n_start, start, 0);
48566 des_xmlXPathObjectPtr(n_end, end, 1);
48567 xmlResetLastError();
48568 if (mem_base != xmlMemBlocks()) {
48569 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048571 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048572 printf(" %d", n_start);
48573 printf(" %d", n_end);
48574 printf("\n");
48575 }
48576 }
48577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048578 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048579#endif
48580
Daniel Veillard42595322004-11-08 10:52:06 +000048581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048582}
48583
48584
48585static int
48586test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048588
William M. Brack21e4ef22005-01-02 09:53:13 +000048589#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048590 int mem_base;
48591 xmlXPathObjectPtr ret_val;
48592 xmlNodePtr start; /* the starting node */
48593 int n_start;
48594 xmlXPathObjectPtr end; /* the ending point */
48595 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048596
Daniel Veillard3d97e662004-11-04 10:49:00 +000048597 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48598 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48599 mem_base = xmlMemBlocks();
48600 start = gen_xmlNodePtr(n_start, 0);
48601 end = gen_xmlXPathObjectPtr(n_end, 1);
48602
48603 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48604 desret_xmlXPathObjectPtr(ret_val);
48605 call_tests++;
48606 des_xmlNodePtr(n_start, start, 0);
48607 des_xmlXPathObjectPtr(n_end, end, 1);
48608 xmlResetLastError();
48609 if (mem_base != xmlMemBlocks()) {
48610 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048612 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048613 printf(" %d", n_start);
48614 printf(" %d", n_end);
48615 printf("\n");
48616 }
48617 }
48618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048619 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048620#endif
48621
Daniel Veillard42595322004-11-08 10:52:06 +000048622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048623}
48624
48625
48626static int
48627test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048629
William M. Brack21e4ef22005-01-02 09:53:13 +000048630#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048631 int mem_base;
48632 xmlXPathObjectPtr ret_val;
48633 xmlNodePtr start; /* the starting node */
48634 int n_start;
48635 xmlNodePtr end; /* the ending node */
48636 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048637
Daniel Veillard3d97e662004-11-04 10:49:00 +000048638 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48639 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48640 mem_base = xmlMemBlocks();
48641 start = gen_xmlNodePtr(n_start, 0);
48642 end = gen_xmlNodePtr(n_end, 1);
48643
48644 ret_val = xmlXPtrNewRangeNodes(start, end);
48645 desret_xmlXPathObjectPtr(ret_val);
48646 call_tests++;
48647 des_xmlNodePtr(n_start, start, 0);
48648 des_xmlNodePtr(n_end, end, 1);
48649 xmlResetLastError();
48650 if (mem_base != xmlMemBlocks()) {
48651 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048653 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048654 printf(" %d", n_start);
48655 printf(" %d", n_end);
48656 printf("\n");
48657 }
48658 }
48659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048660 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048661#endif
48662
Daniel Veillard42595322004-11-08 10:52:06 +000048663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048664}
48665
48666
48667static int
48668test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048670
William M. Brack21e4ef22005-01-02 09:53:13 +000048671#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048672 int mem_base;
48673 xmlXPathObjectPtr ret_val;
48674 xmlXPathObjectPtr start; /* the starting point */
48675 int n_start;
48676 xmlNodePtr end; /* the ending node */
48677 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048678
Daniel Veillard3d97e662004-11-04 10:49:00 +000048679 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48680 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48681 mem_base = xmlMemBlocks();
48682 start = gen_xmlXPathObjectPtr(n_start, 0);
48683 end = gen_xmlNodePtr(n_end, 1);
48684
48685 ret_val = xmlXPtrNewRangePointNode(start, end);
48686 desret_xmlXPathObjectPtr(ret_val);
48687 call_tests++;
48688 des_xmlXPathObjectPtr(n_start, start, 0);
48689 des_xmlNodePtr(n_end, end, 1);
48690 xmlResetLastError();
48691 if (mem_base != xmlMemBlocks()) {
48692 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048694 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048695 printf(" %d", n_start);
48696 printf(" %d", n_end);
48697 printf("\n");
48698 }
48699 }
48700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048701 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048702#endif
48703
Daniel Veillard42595322004-11-08 10:52:06 +000048704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048705}
48706
48707
48708static int
48709test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048711
William M. Brack21e4ef22005-01-02 09:53:13 +000048712#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048713 int mem_base;
48714 xmlXPathObjectPtr ret_val;
48715 xmlXPathObjectPtr start; /* the starting point */
48716 int n_start;
48717 xmlXPathObjectPtr end; /* the ending point */
48718 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048719
Daniel Veillard3d97e662004-11-04 10:49:00 +000048720 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48721 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48722 mem_base = xmlMemBlocks();
48723 start = gen_xmlXPathObjectPtr(n_start, 0);
48724 end = gen_xmlXPathObjectPtr(n_end, 1);
48725
48726 ret_val = xmlXPtrNewRangePoints(start, end);
48727 desret_xmlXPathObjectPtr(ret_val);
48728 call_tests++;
48729 des_xmlXPathObjectPtr(n_start, start, 0);
48730 des_xmlXPathObjectPtr(n_end, end, 1);
48731 xmlResetLastError();
48732 if (mem_base != xmlMemBlocks()) {
48733 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048735 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048736 printf(" %d", n_start);
48737 printf(" %d", n_end);
48738 printf("\n");
48739 }
48740 }
48741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048742 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048743#endif
48744
Daniel Veillard42595322004-11-08 10:52:06 +000048745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048746}
48747
48748
48749static int
48750test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048752
William M. Brack21e4ef22005-01-02 09:53:13 +000048753#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048754 int mem_base;
48755 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48756 int n_ctxt;
48757 int nargs; /* the number of args */
48758 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048759
Daniel Veillardce682bc2004-11-05 17:22:25 +000048760 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48761 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48762 mem_base = xmlMemBlocks();
48763 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48764 nargs = gen_int(n_nargs, 1);
48765
48766 xmlXPtrRangeToFunction(ctxt, nargs);
48767 call_tests++;
48768 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48769 des_int(n_nargs, nargs, 1);
48770 xmlResetLastError();
48771 if (mem_base != xmlMemBlocks()) {
48772 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048774 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048775 printf(" %d", n_ctxt);
48776 printf(" %d", n_nargs);
48777 printf("\n");
48778 }
48779 }
48780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048781 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048782#endif
48783
Daniel Veillard42595322004-11-08 10:52:06 +000048784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048785}
48786
48787
48788static int
48789test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048791
William M. Brack21e4ef22005-01-02 09:53:13 +000048792#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048793 int mem_base;
48794 xmlXPathObjectPtr ret_val;
48795 xmlLocationSetPtr val; /* the LocationSet value */
48796 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048797
Daniel Veillardce682bc2004-11-05 17:22:25 +000048798 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48799 mem_base = xmlMemBlocks();
48800 val = gen_xmlLocationSetPtr(n_val, 0);
48801
48802 ret_val = xmlXPtrWrapLocationSet(val);
48803 desret_xmlXPathObjectPtr(ret_val);
48804 call_tests++;
48805 des_xmlLocationSetPtr(n_val, val, 0);
48806 xmlResetLastError();
48807 if (mem_base != xmlMemBlocks()) {
48808 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048810 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048811 printf(" %d", n_val);
48812 printf("\n");
48813 }
48814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048815 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048816#endif
48817
Daniel Veillard42595322004-11-08 10:52:06 +000048818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048819}
48820
48821static int
48822test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048824
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048825 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048826 test_ret += test_xmlXPtrBuildNodeList();
48827 test_ret += test_xmlXPtrEval();
48828 test_ret += test_xmlXPtrEvalRangePredicate();
48829 test_ret += test_xmlXPtrLocationSetAdd();
48830 test_ret += test_xmlXPtrLocationSetCreate();
48831 test_ret += test_xmlXPtrLocationSetDel();
48832 test_ret += test_xmlXPtrLocationSetMerge();
48833 test_ret += test_xmlXPtrLocationSetRemove();
48834 test_ret += test_xmlXPtrNewCollapsedRange();
48835 test_ret += test_xmlXPtrNewContext();
48836 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48837 test_ret += test_xmlXPtrNewLocationSetNodes();
48838 test_ret += test_xmlXPtrNewRange();
48839 test_ret += test_xmlXPtrNewRangeNodeObject();
48840 test_ret += test_xmlXPtrNewRangeNodePoint();
48841 test_ret += test_xmlXPtrNewRangeNodes();
48842 test_ret += test_xmlXPtrNewRangePointNode();
48843 test_ret += test_xmlXPtrNewRangePoints();
48844 test_ret += test_xmlXPtrRangeToFunction();
48845 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048846
Daniel Veillard42595322004-11-08 10:52:06 +000048847 if (test_ret != 0)
48848 printf("Module xpointer: %d errors\n", test_ret);
48849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048850}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048851static int
48852test_module(const char *module) {
48853 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48854 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048855 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048856 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048857 if (!strcmp(module, "catalog")) return(test_catalog());
48858 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048859 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048860 if (!strcmp(module, "dict")) return(test_dict());
48861 if (!strcmp(module, "encoding")) return(test_encoding());
48862 if (!strcmp(module, "entities")) return(test_entities());
48863 if (!strcmp(module, "hash")) return(test_hash());
48864 if (!strcmp(module, "list")) return(test_list());
48865 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48866 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48867 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048868 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048869 if (!strcmp(module, "pattern")) return(test_pattern());
48870 if (!strcmp(module, "relaxng")) return(test_relaxng());
48871 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48872 if (!strcmp(module, "tree")) return(test_tree());
48873 if (!strcmp(module, "uri")) return(test_uri());
48874 if (!strcmp(module, "valid")) return(test_valid());
48875 if (!strcmp(module, "xinclude")) return(test_xinclude());
48876 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048877 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048878 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000048879 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048880 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048881 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048882 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48883 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48884 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48885 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048886 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048887 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48888 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048889 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048890 if (!strcmp(module, "xpointer")) return(test_xpointer());
48891 return(0);
48892}